Path tool box selection creates small square upon mousedown when animation is playing#3814
Path tool box selection creates small square upon mousedown when animation is playing#3814Annonnymmousss wants to merge 1 commit intoGraphiteEditor:masterfrom
Conversation
…n animation is playing
Summary of ChangesHello @Annonnymmousss, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request addresses a bug in the path tool where an unintended small selection box would be created if the mouse was clicked and held without any movement. The fix ensures that a selection operation is only initiated if the mouse has moved a detectable distance from the initial drag start position, preventing the creation of these unwanted tiny selections. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request fixes an issue where a small selection square would appear on mousedown when an animation is playing. The change correctly prevents the drawing of the selection overlay if the mouse has not moved from its starting position. The logic is sound and directly addresses the reported bug. I have one minor suggestion to improve code clarity by replacing a magic number with a named constant.
| } | ||
| Self::Drawing { selection_shape } => { | ||
| let previous_mouse = document.metadata().document_to_viewport.transform_point2(tool_data.previous_mouse_position); | ||
| if tool_data.drag_start_pos.distance(previous_mouse) < 1e-8 { |
There was a problem hiding this comment.
The magic number 1e-8 is used for checking if the drag distance is effectively zero. It would be better to define this as a named constant to improve readability and maintainability, for example ZERO_DRAG_DISTANCE_EPSILON. This would also allow for consistent usage, as a similar check exists elsewhere in this file.
There was a problem hiding this comment.
Not required.
closes #2595
Screen.Recording.2026-02-23.at.11.08.04.PM.mov