示例#1
0
 public void GestureMove(IPointerEvent evnt)
 {
     if (Update(evnt))
     {
         evnt.RepaintCanvas();
     }
 }
示例#2
0
        public void GestureComplete(IPointerEvent evnt)
        {
            Location cur = current;

            if (currentValid)
            {
                // Console.WriteLine("**** Adding {0} ****", master.GetType().Name);
                layoutModel.Execute((ILayoutAccess lo) => {
                    if (master is ModuleComponent)
                    {
                        ProjectModule sub = ((ModuleComponent)master).Module;
                        if (sub.HasDescendent(lo.Layout))
                        {
                            return;
                        }
                    }
                    Component clone = lo.AddComponent(master, cur.X, cur.Y);
                    WireTools.CheckForSplits(lo, layoutModel.WiringPoints, new Component[] { clone });
                });
            }
            this.current      = new Location(0, 0);
            this.currentValid = false;
            OnGestureCompleteEvent(true);
            layoutModel.Gesture = null;
            evnt.RepaintCanvas();
        }
示例#3
0
        public void GestureComplete(IPointerEvent evnt)
        {
            ComponentInstance toMove = moving;

            if (toMove != null)
            {
                moving = null;
                layoutCanvas.Execute((ILayoutAccess lo) => {
                    Component comp          = toMove.Component;
                    List <Location> toCheck = new List <Location>();
                    foreach (ConnectionPoint conn in comp.Connections)
                    {
                        toCheck.Add(movingLocation.Translate(conn.Dx, conn.Dy));
                    }

                    if (curValid)
                    {
                        lo.MoveComponent(toMove.Component, curDx, curDy);
                        layoutCanvas.WiringPoints.Update();
                        WireTools.CheckForMerges(lo, layoutCanvas.WiringPoints, toCheck);
                        layoutCanvas.WiringPoints.Update();
                        WireTools.CheckForSplits(lo, layoutCanvas.WiringPoints, new Component[] { comp });
                    }
                    else
                    {
                        lo.RemoveComponent(toMove.Component);
                        layoutCanvas.WiringPoints.Update();
                        WireTools.CheckForMerges(lo, layoutCanvas.WiringPoints, toCheck);
                    }
                });
                layoutCanvas.Hidden  = null;
                layoutCanvas.Gesture = null;
                evnt.RepaintCanvas();
            }
        }
示例#4
0
 public void GestureCancel(IPointerEvent evnt)
 {
     this.current      = new Location(0, 0);
     this.currentValid = false;
     OnGestureCompleteEvent(false);
     evnt.RepaintCanvas();
 }
示例#5
0
 public void GestureCancel(IPointerEvent evnt)
 {
     moving              = null;
     curValid            = false;
     layoutCanvas.Hidden = null;
     evnt.RepaintCanvas();
 }
示例#6
0
        public void GestureMove(IPointerEvent evnt)
        {
            double scale = 1.0 / evnt.Model.Zoom;

            evnt.Model.CenterX = initX - (int)(0.5 + (evnt.RawX - startX) * scale);
            evnt.Model.CenterY = initY - (int)(0.5 + (evnt.RawY - startY) * scale);
            evnt.RepaintCanvas();
        }
示例#7
0
 public void GestureStart(IPointerEvent evnt)
 {
     if (moving != null)
     {
         initX = evnt.X;
         initY = evnt.Y;
         layoutCanvas.Hidden = new Component[] { moving.Component };
         Update(evnt);
         evnt.RepaintCanvas();
     }
 }
示例#8
0
 public void GestureMove(IPointerEvent evnt)
 {
     if (layoutCanvas.WiringPoints != null)
     {
         Location eLoc    = new Location(evnt.X, evnt.Y);
         Location snapLoc = Constants.SnapToGrid(eLoc);
         if (layoutCanvas.WiringPoints.Contains(snapLoc))
         {
             if (current != snapLoc)
             {
                 current = snapLoc;
                 evnt.RepaintCanvas();
             }
         }
         else
         {
             if (current != null)
             {
                 current = null;
                 evnt.RepaintCanvas();
             }
         }
     }
 }
示例#9
0
        private void GestureStart(IPointerEvent evnt, bool considerPoke)
        {
            IGesture newGesture = GetGesture(evnt, considerPoke);

            if (newGesture != null)
            {
                if (current != null)
                {
                    current = null;
                    evnt.RepaintCanvas();
                }
                layoutCanvas.Gesture = newGesture;
                newGesture.GestureStart(evnt);
            }
        }
示例#10
0
        public void GestureComplete(IPointerEvent evnt)
        {
            Location loc1 = Constants.SnapToGrid(new Location(evnt.X, evnt.Y));

            if (loc0 != loc1)
            {
                WireSegment[] proposedSegs = GetSegments(loc0, loc1, evnt.IsModified(GestureModifier.Alt));
                // Console.WriteLine("**** Adding Wire ****");
                layoutModel.Execute((ILayoutAccess lo) => {
                    foreach (WireSegment seg in proposedSegs)
                    {
                        AddWireSegment(lo, layoutModel.WiringPoints, seg);
                        layoutModel.WiringPoints.Update();
                    }
                });
            }
            layoutModel.Gesture = null;
            evnt.RepaintCanvas();
        }
示例#11
0
        public void GestureMove(IPointerEvent evnt)
        {
            Location pt  = Constants.SnapToGrid(new Location(evnt.X, evnt.Y));
            bool     mod = evnt.IsModified(GestureModifier.Alt);

            if (pt != loc1 || mod != isModified)
            {
                loc1       = pt;
                isModified = mod;
                if (loc0.X == loc1.X)
                {
                    horzFirst = false;
                }
                else if (loc0.Y == loc1.Y)
                {
                    horzFirst = true;
                }
                evnt.RepaintCanvas();
            }
        }
示例#12
0
 public void RepaintCanvas()
 {
     master.RepaintCanvas();
 }
示例#13
0
 public void Repaint()
 {
     evnt.RepaintCanvas();
 }