Add grid snapping feature with toggle button (default ON) #6
+1,445
−2
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Implements grid snapping functionality for the SVG Path Editor. Points now automatically snap to the grid when placing or moving them, making it easier to create precise, aligned paths. The feature can be toggled on/off via a new toolbar button and is enabled by default.
Changes
Grid Snapping Logic
snapPoint()method that rounds coordinates to the nearest grid intersectiononCreatePathDown)onPointerMove)UI Toggle Button
Technical Details
The snapping algorithm uses
Math.round(coordinate / 10) * 10to snap coordinates:Benefits
Screenshots
New toggle button in toolbar (default active state):

Toggle button inactive (snap OFF):

Point snapped to grid alignment:

Testing
Fixes the requirement: グリッド・サブグリッドにスナップできるようにする。デフォルトON
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.