コード例 #1
0
        protected override void OnParentMouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton != MouseButtonState.Pressed)
            {
                return;
            }

            _startPoint = e.GetPosition(this);
            _lastPoint  = _startPoint;

            if (!BlockConverter.CanConvert(PointOutBlock))
            {
                return;
            }

            _canMove = PointOutBlock != null && !BlockConverter.GetLocked(PointOutBlock);

            if (_canMove)
            {
                StartMouseMovementTracking();
                var date    = AxisXConverter.ScreenToData(0);
                var newDate = date.Add(StepMin);
                _stepMinDistance = AxisXConverter.DataToScreen(newDate);
            }
        }
コード例 #2
0
        private bool CanScale()
        {
            if (PointOutBlock == null)
            {
                return(false);
            }

            return(BlockConverter.CanConvert(PointOutBlock) && !BlockConverter.GetLocked(PointOutBlock));
        }
コード例 #3
0
        protected override void OnParentMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (_canMove)
            {
                if (PointOutBlock != null && !Equals(GetMoveOffSet(), 0.0d))
                {
                    if (!BlockConverter.CanConvert(PointOutBlock))
                    {
                        return;
                    }

                    //Henry modified
                    LayerContainer.OnRaiseAfterMouseUpEvent(this); // presenter is called
                    //this.FindAncestor<BlockGrid>().InvalidateVisual(); // redraw blockgird only
                }
            }
            EndOperation();
        }
コード例 #4
0
        protected override void OnParentMouseUp(object sender, MouseButtonEventArgs e)
        {
            if (PointOutBlock != null && IsMouseDragging())
            {
                if (!BlockConverter.CanConvert(PointOutBlock))
                {
                    return;
                }

                //Henry modified
                //InvalidateVisual(); // do not change the order, 通过重绘改变 DropedPlacement

                if (!InvalidPlacement && DropedPlacement != null)
                {
                    LayerContainer.OnRaiseAfterMouseUpEvent(this);
                }
            }
            EndOperation();
        }