Skip to content

masks: fix path/brush shape and node drag snapping on release - #21979

Merged
TurboGit merged 1 commit into
darktable-org:masterfrom
masterpiga:fix-mask-drag-double-delta
Aug 24, 2026
Merged

masks: fix path/brush shape and node drag snapping on release#21979
TurboGit merged 1 commit into
darktable-org:masterfrom
masterpiga:fix-mask-drag-double-delta

Conversation

@masterpiga

Copy link
Copy Markdown
Collaborator

Fixes #21964.

_path_events_mouse_moved and _brush_events_mouse_moved already 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_released handlers for gui->form_dragging, gui->source_dragging, and gui->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/gui->dy anchor) 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_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 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_rotating in the same functions.

Co-authored with Claude.

_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.
@masterpiga masterpiga added this to the 5.8 milestone Aug 24, 2026
@masterpiga masterpiga added bugfix pull request fixing a bug priority: medium core features are degraded in a way that is still mostly usable, software stutters difficulty: trivial some changes in a couple of functions scope: UI user interface and interactions scope: image processing correcting pixels labels Aug 24, 2026

@TurboGit TurboGit left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@TurboGit
TurboGit merged commit 56898c2 into darktable-org:master Aug 24, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix pull request fixing a bug difficulty: trivial some changes in a couple of functions priority: medium core features are degraded in a way that is still mostly usable, software stutters scope: image processing correcting pixels scope: UI user interface and interactions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drawn path control points jump to upper left of the image when moved

3 participants