Skip to content

frontend: Make CropItem anchor logic stateless#13508

Open
feeqra wants to merge 2 commits into
obsproject:masterfrom
feeqra:refactor/stateless-newpos
Open

frontend: Make CropItem anchor logic stateless#13508
feeqra wants to merge 2 commits into
obsproject:masterfrom
feeqra:refactor/stateless-newpos

Conversation

@feeqra

@feeqra feeqra commented Jun 1, 2026

Copy link
Copy Markdown

Uses an existing helper function to replace the manual stateful calculation of the stretch item's anchor point with a stateless calculation based on the final size of the stretch item. Reduces code complexity and redundancy. Improves readability.

Description

The original logic determines the stretch-item's new anchor point position using the mouse's state. This isn't necessary as this new position can be calculated from the stretch-item's final dimensions.

Motivation and Context

Removes redundant logic that was already handled by the helper function. Improves readability.

How Has This Been Tested?

OS: Ubuntu
Hardware: Local WSL build environment

Manual testing steps:

  • Added an image to the canvas.
  • Held alt and dragged all 4 edges and 4 corners independently.
  • Verified that cropping and anchor point movement behaves as expected.

Types of changes

Code cleanup (non-breaking change which makes code smaller or more readable)

Checklist:

  • I have read the contributing document.
  • My code has been run through clang-format.
  • My code follows the project's style guidelines
  • My code is not on the master branch.
  • My code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

Uses an existing helper function to replace the manual stateful
calculation of the stretch item's anchor point with a stateless
calculation based on the final size of the stretch item. Reduces
code complexity and redundancy. Improves readability.
@WizardCM WizardCM added the kind/cleanup Non-breaking change which makes code smaller or more readable label Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/cleanup Non-breaking change which makes code smaller or more readable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants