Exclude viewport zoom from influencing the Transform node set by the drawing tools#4260
Exclude viewport zoom from influencing the Transform node set by the drawing tools#4260Keavon wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors shape and drawing tools (such as Arc, Circle, Ellipse, Grid, Polygon, Rectangle, Spiral, Star, Freehand, Pen, Spline, and Text) to use centralized transformation helper functions (viewport_zoom, window_aligned_transform, window_aligned_transform_set, and translation_transform_set) defined in resize.rs. This ensures consistent handling of viewport zoom, tilt, and flip across all tools. The review feedback focuses on optimizing these new helper functions and their usages by simplifying the underlying matrix mathematics, which avoids redundant matrix inversions, point transformations, and multiplications to improve performance and numerical stability.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
4 issues found across 14 files
Confidence score: 3/5
- In
editor/src/messages/tool/tool_messages/spline_tool.rs(DragStop), translation is still computed in viewport space whilePointerMovewas switched to document-space, so ending a drag can apply a different delta and cause visible jump/drift at mouse-up—updateDragStopto use the samedocument_to_viewport.inverse().transform_vector2(...)path before merging. - In
editor/src/messages/tool/common_functionality/resize.rs, there are a few algebraically redundant inverse/transform steps (duplicate.inverse(), inverse-then-multiply round-trip, and a simplifiable composed transform) that add avoidable matrix work and make the math harder to audit—fold these into the simplified forms and reuse cached inverses to reduce risk of future coordinate bugs.
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
No description provided.