コード例 #1
0
ファイル: AreaManager.cs プロジェクト: scfunknown/ShareX
        public void Update()
        {
            if (IsMoving)
            {
                Rectangle rect = CurrentArea;
                rect.X     += InputManager.MouseVelocity.X;
                rect.Y     += InputManager.MouseVelocity.Y;
                CurrentArea = rect;
            }

            if (IsCreating && !CurrentArea.IsEmpty)
            {
                CurrentPosition = InputManager.MousePosition0Based;

                Point newPosition = CurrentPosition;

                if (IsProportionalResizing)
                {
                    newPosition = CaptureHelpers.ProportionalPosition(PositionOnClick, CurrentPosition);
                }

                if (IsSnapResizing)
                {
                    newPosition = SnapPosition(PositionOnClick, newPosition);
                }

                CurrentArea = CaptureHelpers.CreateRectangle(PositionOnClick, newPosition);
            }

            CheckHover();

            ResizeManager.Update();
        }
コード例 #2
0
ファイル: ShapeManager.cs プロジェクト: dasilva94/ShareX
        public void Update()
        {
            BaseShape shape = CurrentShape;

            if (shape != null)
            {
                if (IsMoving)
                {
                    ResizeManager.MoveCurrentArea(InputManager.MouseVelocity.X, InputManager.MouseVelocity.Y);
                }
                else if (IsCreating && !CurrentRectangle.IsEmpty)
                {
                    CurrentPosition = InputManager.MousePosition0Based;

                    Point newPosition = CurrentPosition;

                    if (IsProportionalResizing)
                    {
                        newPosition = CaptureHelpers.ProportionalPosition(PositionOnClick, CurrentPosition);
                    }

                    if (IsSnapResizing)
                    {
                        newPosition = SnapPosition(PositionOnClick, newPosition);
                    }

                    shape.EndPosition = newPosition;
                }
            }

            CheckHover();

            ResizeManager.Update();
        }