private void MouseCreateCanvasConnection(ICanvas canvas, IPoint point) { var root = Insert.Pin(canvas, point, Context.DiagramCreator, Context.EnableSnap); Context.CurrentRoot = root; double x = Context.CurrentRoot.GetX(); double y = Context.CurrentRoot.GetY(); Context.CurrentLine = WireEditor.Connect(canvas, Context.CurrentRoot, Context.CurrentLine, x, y, Context.DiagramCreator); if (Context.CurrentLine == null) { Context.CurrentRoot = null; } Context.CurrentRoot = root; Context.CurrentLine = WireEditor.Connect(canvas, Context.CurrentRoot, Context.CurrentLine, x, y, Context.DiagramCreator); }
public IElement Add(ICanvas canvas, string type, IPoint point) { var context = Context.DiagramCreator; var snap = Context.EnableSnap; switch (type) { case Constants.TagElementInput: return(Insert.Input(canvas, point, context, snap)); case Constants.TagElementOutput: return(Insert.Output(canvas, point, context, snap)); case Constants.TagElementAndGate: return(Insert.AndGate(canvas, point, context, snap)); case Constants.TagElementOrGate: return(Insert.OrGate(canvas, point, context, snap)); case Constants.TagElementPin: return(Insert.Pin(canvas, point, context, snap)); default: return(null); } }