Skip to content

Comments

Add snapping to endpoints and stops in the Gradient tool#3732

Merged
Keavon merged 5 commits intoGraphiteEditor:masterfrom
jsjgdh:Gizmo
Feb 24, 2026
Merged

Add snapping to endpoints and stops in the Gradient tool#3732
Keavon merged 5 commits intoGraphiteEditor:masterfrom
jsjgdh:Gizmo

Conversation

@jsjgdh
Copy link
Contributor

@jsjgdh jsjgdh commented Feb 7, 2026

Closes #3261

@jsjgdh jsjgdh marked this pull request as ready for review February 9, 2026 18:51
@Keavon Keavon changed the title Gizmo Add snapping to ends of the gradient line Feb 13, 2026
@Keavon
Copy link
Member

Keavon commented Feb 13, 2026

This kind of snapping doesn't actually snap:

capture_10_.mp4

It would need to calculate the color stop position where the gradient line intersects the snapping target line and snap it to that position when the snap is active, since the whole point of a snap is to take the precise mouse movements surrounding a target and jump them all to the exact value.

This also occurs when dragging an endpoint when Shift is held to snap to a 15° angle increment. Note that the Line tool's implementation of this same behavior does work as expected when you're dragging a line's endpoint and holding Shift or Ctrl to lock the angle:

capture_11_.mp4

The snapping tolerance for this scenario is more sane in the Line tool (smaller tolerance area) than it is for the Gradient tool (too large of a tolerance area, should match Line tool's behavior).

This is something I'm willing to wait on for a followup PR, if you prefer.

@Keavon Keavon marked this pull request as draft February 13, 2026 00:58
@Keavon Keavon mentioned this pull request Feb 13, 2026
@Keavon Keavon marked this pull request as ready for review February 22, 2026 08:27
@Keavon
Copy link
Member

Keavon commented Feb 22, 2026

!build (Run ID 22273628463)

@github-actions
Copy link

📦 Build Complete for 8e63209
https://0d16aae6.graphite.pages.dev

@Keavon
Copy link
Member

Keavon commented Feb 24, 2026

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds snapping functionality to the gradient tool, allowing gradient handles and color stops to snap to various points and paths. The changes introduce new snap sources for gradients and integrate snapping logic into the gradient tool's state machine. My review focuses on code duplication and opportunities for minor refactoring to improve readability and maintainability.

@Keavon
Copy link
Member

Keavon commented Feb 24, 2026

I fixed the bugs since I want to get this merged.

@Keavon Keavon changed the title Add snapping to ends of the gradient line Add snapping to endpoints and stops in the Gradient tool Feb 24, 2026
@Keavon Keavon enabled auto-merge February 24, 2026 04:38
@Keavon Keavon added this pull request to the merge queue Feb 24, 2026
Merged via the queue into GraphiteEditor:master with commit 3b91d02 Feb 24, 2026
4 checks passed
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.

Snapping for Gradient gizmo

3 participants