Exemple #1
0
 public void Undo()
 {
     Document = (Document)_undo.Undo();
     RecreateEventsHandlers();
     _resizeAction?.UpdateResizeCorner();
     base.Invalidate();
 }
Exemple #2
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            var selectionRectangle = _selectionArea.GetUnsignedRectangle();

            if ((_moveAction != null) && _moveAction.IsMoving)
            {
                var eventClickArg = new ElementEventArgs(_selectedElement);
                OnElementClick(eventClickArg);

                _moveAction.End();
                _moveAction = null;

                var eventMouseUpArg = new ElementMouseEventArgs(_selectedElement, e.X, e.Y);
                OnElementMouseUp(eventMouseUpArg);

                if (_changed)
                {
                    AddUndo();
                }
            }

            // Select
            if (_isMultiSelection)
            {
                EndSelectElements(selectionRectangle);
            }
            // Add element
            else if (_isAddSelection)
            {
                EndAddElement(selectionRectangle);
            }

            // Add link
            else if (_isAddLink)
            {
                EndAddLink();
                AddUndo();
            }

            // Resize
            if (_resizeAction != null)
            {
                if (_resizeAction.IsResizing)
                {
                    var mousePoint = Gsc2Goc(new Point(e.X, e.Y));
                    _resizeAction.End(mousePoint);

                    AddUndo();
                }
                _resizeAction.UpdateResizeCorner();
            }

            RestartInitValues();

            base.Invalidate();

            base.OnMouseUp(e);
        }