Skip to content

Fixed Box selection with the Select tool and Path tool to follow canv…#3718

Open
krVatsal wants to merge 1 commit intoGraphiteEditor:masterfrom
krVatsal:fix-cooridnate-system-mismatch-during-an-active-box-selection
Open

Fixed Box selection with the Select tool and Path tool to follow canv…#3718
krVatsal wants to merge 1 commit intoGraphiteEditor:masterfrom
krVatsal:fix-cooridnate-system-mismatch-during-an-active-box-selection

Conversation

@krVatsal
Copy link
Contributor

@krVatsal krVatsal commented Feb 4, 2026

Fixes #2391

When performing a box selection with the Select tool, panning (via scroll wheel) would cause the selection rectangle's starting point to move with the viewport instead of staying fixed on the canvas.

Solution
Store the drag start position in document coordinates (drag_start_document) rather than viewport coordinates
Transform this document anchored point back to viewport space when computing the selection box
Remove the viewport shift compensation for the start point during auto panning since the start is now properly anchored to document space

Still confused about the expected outcome for zooming, can you clarify more for what should be the output for it?

Recording.2026-02-04.235848.mp4

@Keavon
Copy link
Member

Keavon commented Feb 4, 2026

Still confused about the expected outcome for zooming, can you clarify more for what should be the output for it?

In all cases, the document-space start point and document-space current pointer position should determine the bounding box shown, as well as the current document tilt. You can always take those three parameters (start point, current point, current tilt) and draw a rectangle matching the document space coordinates of them (but transformed into viewport space for the final drawing of the rectangle, since overlays are in viewport space).

@krVatsal
Copy link
Contributor Author

krVatsal commented Feb 5, 2026

Still confused about the expected outcome for zooming, can you clarify more for what should be the output for it?

In all cases, the document-space start point and document-space current pointer position should determine the bounding box shown, as well as the current document tilt. You can always take those three parameters (start point, current point, current tilt) and draw a rectangle matching the document space coordinates of them (but transformed into viewport space for the final drawing of the rectangle, since overlays are in viewport space).

Thanks for the clarification! I think the current implementation already handles this correctly for both panning and zooming.

@krVatsal krVatsal marked this pull request as ready for review February 5, 2026 09:39
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.

Box/lasso selection should be compatible with PTZ

2 participants