コード例 #1
0
        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);
        }
コード例 #2
0
        private void Connect(ICanvas canvas, IThumb pin, IDiagramCreator creator)
        {
            if (pin == null)
            {
                return;
            }

            Context.CurrentRoot = pin.GetParent() as IThumb;

            double x;
            double y;

            ModelEditor.GetPinPosition(Context.CurrentRoot, pin, out x, out y);

            Context.CurrentLine = WireEditor.Connect(canvas,
                                                     Context.CurrentRoot, Context.CurrentLine,
                                                     x, y,
                                                     creator);

            if (Context.CurrentLine == null)
            {
                Context.CurrentRoot = null;
            }
        }