Пример #1
0
 public virtual void HandleDragMove(object sender, MouseEventArgs e)
 {
     using (Handle.Host.Figure.DirtManager.BeginDirty()) {
         _moveRequest.MoveDelta = (Size)e.Location - (Size)_startPoint;
         _targets.ShowFeedback(_moveRequest);
     }
 }
Пример #2
0
        public override bool HandleDragMove(MouseEventArgs e)
        {
            using (_Host.RootEditor.Figure.DirtManager.BeginDirty()) {
                if (_targets != null)
                {
                    _targets.HideFeedback(_moveRequest);
                }

                var delta      = (Size)e.Location - (Size)_startPoint;
                var horizontal = Math.Abs(delta.Width) > Math.Abs(delta.Height);
                horizontal = Math.Abs(delta.Width) < 40 && Math.Abs(delta.Height) < 40 ? false: horizontal;

                var content = _Host.RootEditor.Content;
                if (horizontal)
                {
                    _moveRequest.MovingEditors = content.Children.Where(edi => edi.Figure.Left > _startPoint.X).ToArray();
                }
                else
                {
                    _moveRequest.MovingEditors = content.Children.Where(edi => edi.Figure.Top > _startPoint.Y).ToArray();
                }
                _targets = new EditorBundle(_moveRequest.MovingEditors);

                var moveDelta = horizontal ?
                                new Size(delta.Width, 0) :
                                new Size(0, delta.Height);
                _moveRequest.MoveDelta = moveDelta;
                _targets.ShowFeedback(_moveRequest);

                _spaceRequest.Horizontal = horizontal;
                if (horizontal)
                {
                    _spaceRequest.Bounds = RectUtil.GetRectangleFromDiagonalPoints(_startPoint, new Point(e.X, _startPoint.Y + 20));
                }
                else
                {
                    _spaceRequest.Bounds = RectUtil.GetRectangleFromDiagonalPoints(_startPoint, new Point(_startPoint.X + 20, e.Y));
                }
                _Host.RootEditor.Content.ShowFeedback(_spaceRequest);
            }

            return(true);
        }