Skip to content

fix: prevent selected strokes from disappearing when moved - #424

Closed
devmobasa wants to merge 1 commit into
mainfrom
fix/422-selection-move
Closed

devmobasa wants to merge 1 commit into
mainfrom
fix/422-selection-move

Conversation

@devmobasa

Copy link
Copy Markdown
Owner

Selection movement used screen bounds to clamp canvas coordinates, which could send strokes off-screen after panning or zooming.

Use the visible canvas bounds for dragging, nudging, and edge shortcuts.

Fixes #422

devmobasa added a commit to gsmith-alvarez/wayscriber that referenced this pull request Oct 25, 2026
Keep the press as the drag anchor until the pointer leaves the click
radius, so the first drag motion is not lost. After that the anchor
follows the pointer on every motion, including blocked ones, so
reversing at an edge moves the selection at once.

Apply coordinate limits on every board. Pannable boards still move
freely, but each translated coordinate and the painted bounds now stay
in the i32 range. Before, a nudge near i32::MAX wrapped in release
builds: the line jumped to span the whole coordinate range and was
saved that way. Debug builds panicked instead.

On a fixed canvas (the transparent overlay, or a board with panning
disabled), a selection that already crosses an edge, or lies outside
the canvas, can no longer move further out, and it is never pulled
back. Before, any nudge snapped it inside, up to thousands of pixels.

Align the move-to-edge actions with the visible canvas, including pan
and zoom, instead of the screen origin. A target further away than
i32::MAX is reached in several steps that record one undo entry.

Combine selection bounds in i64. Shape bounds are clamped to the i32
range, so a shape at the coordinate limit is measured on a copy moved
toward the origin; the limits and edge actions then see its full
stroke padding. A selection whose painted bounds end past i32::MAX
gets no selection Rect, because handle hit-testing and other selection
code compute x + width in i32. Its chrome then marks full damage, so
the halos of its other members are still repainted. The Properties
panel uses the same bounds, the text resize handle is omitted when it
would end past i32::MAX, and handle hit-testing compares pointer
distances in i64.

Test changes:
- nudge_selection_clamps_right_and_bottom_edges starts at (87, 87).
  At (90, 90) the stroke padding already crossed the canvas edge, and
  the test passed only because the old clamp pulled the shape back.
- moving_a_selection_on_transparent_board_clamps_to_screen checks the
  exact landing edge. It also passed when nothing moved.

The coordinate guard and the view-relative edge targets are adapted
from devmobasa#424.
@devmobasa devmobasa closed this Oct 25, 2026
@devmobasa

Copy link
Copy Markdown
Owner Author

Closing in favor of #425

@devmobasa
devmobasa deleted the fix/422-selection-move branch October 26, 2026 07:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Selection + Move: Stokes disappears

1 participant