/// <summary> /// Constructor /// </summary> /// <param name="sketch">SketchPanel to add a label to</param> /// <param name="inkStrokes">InkOverlay strokes</param> /// <param name="inkStrokes">A StrokeCollection strokes</param> /// <param name="label">Label to apply</param> /// <param name="domainInfo">DomainInfo for our Labeler</param> public EndPointMoveCmd(InkToSketchWPF.InkCanvasSketch inkSketch, Sketch.EndPoint oldLoc, Point newLoc, Stroke attachedStroke, Sketch.Shape shapeAtNewLoc) { isUndoable = true; this.inkSketch = inkSketch; oldLocation = oldLoc; newLocation = newLoc; this.attachedStroke = attachedStroke; this.shapeAtNewLoc = shapeAtNewLoc; this.changedShape = inkSketch.GetSketchSubstrokeByInk(attachedStroke).ParentShape; oldInternalConnection = changedShape.ConnectedShapes.Contains(changedShape); newIsWire = Domain.LogicDomain.IsWire(shapeAtNewLoc.Type); substrokesInNewShape = shapeAtNewLoc.SubstrokesL; // Make a new stroke comprising 100 points along the straight line between oldLocation and newLocation System.Windows.Input.StylusPointCollection line = new System.Windows.Input.StylusPointCollection(); for (double m = 0; m <= 1; m += 0.01) { double midX = oldLocation.X + m * (newLocation.X - oldLocation.X); double midY = oldLocation.Y + m * (newLocation.Y - oldLocation.Y); line.Add(new System.Windows.Input.StylusPoint(midX, midY)); } this.newStroke = new Stroke(line); }