Пример #1
0
        public virtual ShapeAnchor GetBottomRightAnchor()
        {
            Size        anchorSize = new Size(anchorWidthHeight, anchorWidthHeight);
            Rectangle   r          = new Rectangle(ZoomRectangle.BottomRightCorner().Move(-anchorWidthHeight, -anchorWidthHeight), anchorSize);
            ShapeAnchor anchor     = new ShapeAnchor(GripType.BottomRight, r, Cursors.SizeNWSE);

            return(anchor);
        }
Пример #2
0
        public void UpdateSize(GraphicElement el, ShapeAnchor anchor, Point delta)
        {
            Point     adjustedDelta = anchor.AdjustedDelta(delta);
            Rectangle newRect       = anchor.Resize(el.DisplayRectangle, adjustedDelta);

            UpdateDisplayRectangle(el, newRect, adjustedDelta);
            UpdateConnections(el);
        }
Пример #3
0
        public virtual bool SnapCheck(ShapeAnchor anchor, Point delta)
        {
            UpdateSize(anchor, delta);
            canvas.Controller.UpdateSelectedElement.Fire(this, new ElementEventArgs()
            {
                Element = this
            });

            return(false);
        }
Пример #4
0
        protected void SetAnchorCursor()
        {
            ShapeAnchor anchor = HoverShape.GetAnchors().FirstOrDefault(a => a.Near(CurrentMousePosition));

            // Hover shape could have changed as we move from a shape to a connector's anchor.
            if (anchor != null)
            {
                Controller.Canvas.Cursor = anchor.Cursor;
            }
        }
Пример #5
0
        public void UpdateSize(GraphicElement el, ShapeAnchor anchor, Point delta)
        {
            Point     adjustedDelta = anchor.AdjustedDelta(InverseZoomAdjust(delta));
            Rectangle newRect       = anchor.Resize(el.DisplayRectangle, adjustedDelta);

            UpdateDisplayRectangle(el, newRect, adjustedDelta);
            UpdateConnections(el);
            UpdateSelectedElement.Fire(this, new ElementEventArgs()
            {
                Element = el
            });
        }
Пример #6
0
 public override void UpdateSize(ShapeAnchor anchor, Point delta)
 {
     if (anchor.Type == GripType.TopMiddle)
     {
         hyAdjust += delta.Y;
         UpdatePath();
         Rectangle newRect = RecalcDisplayRectangle();
         canvas.Controller.UpdateDisplayRectangle(this, newRect, delta);
     }
     else
     {
         base.UpdateSize(anchor, delta);
     }
 }
Пример #7
0
        public void DeleteSelectedElements()
        {
            selectedAnchor        = null;
            showingAnchorsElement = null;
            dragging = false;

            selectedElements.ForEach(el =>
            {
                DeleteElement(el);
            });

            selectedElements.Clear();
            canvas.Invalidate();
        }
Пример #8
0
        public override bool SnapCheck(ShapeAnchor anchor, Point delta)
        {
            bool ret = canvas.Controller.Snap(anchor.Type, ref delta);

            if (ret)
            {
                MoveAnchor(anchor.Type, delta);
            }
            else
            {
                ret = base.SnapCheck(anchor, delta);
            }

            return(ret);
        }
Пример #9
0
        public override void UpdateSize(ShapeAnchor anchor, Point delta)
        {
            if (anchor.Type == GripType.Start)
            {
                startPoint = startPoint.Move(delta);
            }
            else
            {
                endPoint = endPoint.Move(delta);
            }

            UpdatePath();
            Rectangle newRect = RecalcDisplayRectangle();

            canvas.Controller.UpdateDisplayRectangle(this, newRect, delta);
        }
Пример #10
0
        public void DeleteSelectedElements()
        {
            selectedAnchor        = null;
            showingAnchorsElement = null;
            dragging = false;

            // TODO: Optimize for redrawing just selected elements (we remove call to DeleteElement when we do this)
            selectedElements.ForEach(el =>
            {
                el.GroupChildren.ForEach(child => child.Parent = null);
                DeleteElement(el);
            });

            selectedElements.Clear();
            canvas.Invalidate();
        }
Пример #11
0
        public override bool SnapCheck(ShapeAnchor anchor, Point delta)
        {
            bool ret = canvas.Controller.Snap(anchor.Type, ref delta);

            if (ret)
            {
                // Allow the entire line to move if snapped.
                Move(delta);
            }
            else
            {
                // Otherwise, move just the anchor point with axis constraints.
                ret = base.SnapCheck(anchor, delta);
            }

            return(ret);
        }
Пример #12
0
 public void DeleteElement()
 {
     if (selectedElement != null)
     {
         selectedElement.DetachAll();
         EraseTopToBottom(elements);
         elements.Remove(selectedElement);
         selectedElement.Dispose();
         selectedElement       = null;
         selectedAnchor        = null;
         showingAnchorsElement = null;
         dragging = false;
         DrawBottomToTop(elements);
         ElementSelected.Fire(this, new ElementEventArgs());
         // Need to refresh the entire screen to remove the element from the screen itself.
         canvas.Invalidate();
     }
 }
Пример #13
0
        public override void UpdateSize(ShapeAnchor anchor, Point delta)
        {
            if (anchor.Type == GripType.Start)
            {
                // X1
                //this.AnchorMoveUndoRedo(nameof(StartPoint), StartPoint.Move(delta), false);
                StartPoint = StartPoint.Move(delta);
            }
            else
            {
                // X1
                //this.AnchorMoveUndoRedo(nameof(EndPoint), EndPoint.Move(delta), false);
                EndPoint = EndPoint.Move(delta);
            }

            UpdatePath();
            Rectangle newRect = RecalcDisplayRectangle();

            canvas.Controller.UpdateDisplayRectangle(this, newRect, delta);
        }
Пример #14
0
        public override void SetAnchorCursor(GraphicElement el)
        {
            ShapeAnchor anchor = el.GetAnchors().FirstOrDefault(a => a.Near(mousePosition));

            canvas.Cursor = anchor == null ? Cursors.Arrow : anchor.Cursor;
        }
Пример #15
0
 public virtual void UpdateSize(ShapeAnchor anchor, Point delta)
 {
     canvas.Controller.UpdateSize(this, anchor, delta);
 }