Skip to content

fix(input): clamp selection translation against visible canvas rect (#422) - #423

Merged
devmobasa merged 1 commit into
devmobasa:mainfrom
gsmith-alvarez:fix/issue-422-selection-move
Oct 25, 2026
Merged

devmobasa merged 1 commit into
devmobasa:mainfrom
gsmith-alvarez:fix/issue-422-selection-move

Conversation

@gsmith-alvarez

@gsmith-alvarez gsmith-alvarez commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Clamping selection translation against screen dimensions on panned or zoomed boards causes selections to jump offscreen on the first drag motion or arrow-key nudge (canvas coordinates were being clamped against screen pixel limits).

This clamps the selection bounds against visible_canvas_rect instead, keeping shape translation constrained to the visible canvas area across board pans and zoom levels.

Validation:

  • Added focused regression tests in src/input/state/tests/transform.rs:
    • moving_a_selection_on_a_panned_board_follows_the_pointer
    • moving_a_selection_at_zoom_keeps_it_inside_the_visible_canvas
  • Verified unit tests: cargo test --lib moving_a_selection (2 passed, 0 failed).
  • Code formatting: cargo fmt --check clean.
  • Whitespace check: git diff --check clean.
  • Manual verification on Niri: verified interactive pointer drag and arrow-key nudging on a panned solid board.

Closes #422.

(Note: The root-cause diagnosis and patch implementation were generated with AI assistance.)

…n panned boards

Issue devmobasa#422: Clamping against screen dimensions on panned or zoomed boards
uses mismatched units (canvas bounds vs screen dimensions), causing selections
to jump offscreen on the first drag motion or arrow-key nudge. Clamp against
the visible canvas rect instead.
@gsmith-alvarez

Copy link
Copy Markdown
Contributor Author

Tested live on my local machine.

@devmobasa
devmobasa merged commit f1bf484 into devmobasa:main Oct 25, 2026
@devmobasa

Copy link
Copy Markdown
Owner

Thanks @gsmith-alvarez

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

2 participants