Example #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);
            }
        }
        private bool CanScale()
        {
            if (PointOutBlock == null)
            {
                return(false);
            }

            return(BlockConverter.CanConvert(PointOutBlock) && !BlockConverter.GetLocked(PointOutBlock));
        }
Example #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();
        }
        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();
        }