Esempio n. 1
0
        public bool MouseDown(MouseEventArgs e)
        {
            if (IsSuspended)
            {
                return(false);
            }
            Connectable elem = null;

            HitTestResult result = VisualTreeHelper.HitTest(Canvas, e.GetPosition(Canvas));

            if (result.VisualHit != null)
            {
                elem = GetConnectable(result.VisualHit as Visual);
                if (ShapeFactory.Exists(elem))
                {
                    SelectionManager.SelectShape(elem);
                    movedShape   = SelectionManager.SelectedShape as Connectable;
                    moving       = true;
                    shift        = e.GetPosition(movedShape);
                    initialPoint = new Point(Canvas.GetLeft(movedShape), Canvas.GetTop(movedShape));
                    ActivateTool();
                    return(true);
                }
            }
            return(false);
        }
Esempio n. 2
0
            public void Redo()
            {
                if (mShape != null)
                {
                    Canvas.Children.Add(mShape);

                    ShapeFactory.Shapes.Add(mShape);
                    SelectionManager.SelectShape(mShape);
                }
            }