masks: fix path/brush shape and node drag snapping on release - #21979
Merged
TurboGit merged 1 commit intoAug 24, 2026
Conversation
_path_events_mouse_moved and _brush_events_mouse_moved already move the dragged shape/source/node to its correct absolute position on every tick, recomputing the delta from the *current* position each time. The matching _*_events_button_released handlers for gui->form_dragging, source_dragging, and point_dragging then redundantly recomputed a target position from the release event's own pzx/pzy (for form/source, combined with the stale press-time gui->dx/dy anchor) and applied it as a second, independent delta on top of the already-correct position. Whenever the release event's coordinates diverge even slightly from the last mouse_moved tick's -- e.g. a short/stale release event carrying a leftover (0, 0) -- this silently moved the shape or node a second time, observed live as it snapping to the image's top-left corner right on mouse-up. Fix: on release, just finalise (history item + form recreation) without recomputing/reapplying a delta, mirroring the pattern already used by form_rotating/source_rotating in the same functions.
1 task
lefth
approved these changes
Aug 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #21964.
_path_events_mouse_movedand_brush_events_mouse_movedalready move the dragged shape, clone/heal source, or individual node to its correct absolute position on every tick, recomputing the delta from the current position each time. The matching_*_events_button_releasedhandlers forgui->form_dragging,gui->source_dragging, andgui->point_draggingthen redundantly recomputed a target position from the release event's ownpzx/pzy(for form/source, combined with the stale press-timegui->dx/gui->dyanchor) and applied it as a second, independent delta on top of the already-correct position.Whenever the release event's coordinates diverged even slightly from the last
mouse_movedtick's — e.g. a short/stale release event carrying a leftover(0, 0)— this silently moved the shape or node a second time, observed as it snapping to the image's top-left corner right on mouse-up.Fix: on release, just finalize (history item + form recreation) without recomputing/reapplying a delta — mirroring the pattern already used by
form_rotating/source_rotatingin the same functions.Co-authored with Claude.