예제 #1
0
        public void Update()
        {
            var bb = Owner.BoundingBox;

            switch (Direction)
            {
            case ResizeDirections.TopLeft:
                ForceSetPositionOfCenter(bb.TopLeft);
                HandleShape.ForceSetPositionOfCenter(bb.TopLeft);
                break;

            case ResizeDirections.Top:
                ForceSetPositionOfCenter(bb.TopCenter);
                HandleShape.ForceSetPositionOfCenter(bb.TopCenter);
                break;

            case ResizeDirections.TopRight:
                ForceSetPositionOfCenter(bb.TopRight);
                HandleShape.ForceSetPositionOfCenter(bb.TopRight);
                break;

            case ResizeDirections.Right:
                ForceSetPositionOfCenter(bb.RightCenter);
                HandleShape.ForceSetPositionOfCenter(bb.RightCenter);
                break;

            case ResizeDirections.BottomRight:
                ForceSetPositionOfCenter(bb.BottomRight);
                HandleShape.ForceSetPositionOfCenter(bb.BottomRight);
                break;

            case ResizeDirections.Bottom:
                ForceSetPositionOfCenter(bb.BottomCenter);
                HandleShape.ForceSetPositionOfCenter(bb.BottomCenter);
                break;

            case ResizeDirections.BottomLeft:
                ForceSetPositionOfCenter(bb.BottomLeft);
                HandleShape.ForceSetPositionOfCenter(bb.BottomLeft);
                break;

            case ResizeDirections.Left:
                ForceSetPositionOfCenter(bb.LeftCenter);
                HandleShape.ForceSetPositionOfCenter(bb.LeftCenter);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
예제 #2
0
        public override void OnDrag(Canvas canvas, float dxSum, float dySum, float dx, float dy, bool isShiftKey, bool isCtrlKey)
        {
            base.OnDrag(canvas, dxSum, dySum, dx, dy, isShiftKey, isCtrlKey);

            _centerHandle?.ForceSetPositionOfCenter(BoundingBox.Center);
        }