Example #1
0
        private void HandlePosition(PointF point)
        {
            if (!TimelineActionManager.Instance.OnionSkinEnable || TimelineActionManager.Instance.AutoKey)
            {
                VisualObject visualObject = this.selectedParentObjects.FirstOrDefault <VisualObject>();
                if (visualObject != null)
                {
                    PointF pointF   = visualObject.TransformToParent(this.lastMousePoint);
                    PointF pointF2  = visualObject.TransformToParent(point);
                    PointF position = this.Position;
                    PointF pointF3  = new PointF(position.X + pointF2.X - pointF.X, position.Y + pointF2.Y - pointF.Y);
                    if (this.isShiftDown)
                    {
                        switch (this.moveDirection)
                        {
                        case MoveDirection.NONE:
                            this.Position = pointF3;
                            break;

                        case MoveDirection.X:
                            this.Position = new PointF(pointF3.X, this.Position.Y);
                            break;

                        case MoveDirection.Y:
                            this.Position = new PointF(this.Position.X, pointF3.Y);
                            break;
                        }
                        if (this.moveDirection == MoveDirection.NONE)
                        {
                            if (pointF2.X - pointF.X != 0f)
                            {
                                this.moveDirection = MoveDirection.X;
                            }
                            else
                            {
                                this.moveDirection = MoveDirection.Y;
                            }
                        }
                    }
                    else
                    {
                        this.Position = pointF3;
                    }
                }
            }
        }
Example #2
0
        private void HandlePosition(PointF point)
        {
            if (TimelineActionManager.Instance.OnionSkinEnable && !TimelineActionManager.Instance.AutoKey)
            {
                return;
            }
            VisualObject visualObject = this.selectedParentObjects.FirstOrDefault <VisualObject>();

            if (visualObject == null)
            {
                return;
            }
            PointF parent1  = visualObject.TransformToParent(this.lastMousePoint);
            PointF parent2  = visualObject.TransformToParent(point);
            PointF position = this.Position;
            PointF pointF   = new PointF(position.X + parent2.X - parent1.X, position.Y + parent2.Y - parent1.Y);

            if (this.isShiftDown)
            {
                switch (this.moveDirection)
                {
                case MoveDirection.NONE:
                    this.Position = pointF;
                    break;

                case MoveDirection.X:
                    this.Position = new PointF(pointF.X, this.Position.Y);
                    break;

                case MoveDirection.Y:
                    this.Position = new PointF(this.Position.X, pointF.Y);
                    break;
                }
                if (this.moveDirection != MoveDirection.NONE)
                {
                    return;
                }
                this.moveDirection = (double)parent2.X - (double)parent1.X == 0.0 ? MoveDirection.Y : MoveDirection.X;
            }
            else
            {
                this.Position = pointF;
            }
        }