feat(helper-lines): add smart alignment and paint snap opt-out - #860
Conversation
Dense canvases can snap same-kind edges from the pointer's intended position, with paint layers optionally excluded from snapping. Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
… edges Expose the neighbour reach and shared-axis minimum as `smartAlignmentNeighborLimit` / `smartAlignmentSharedAxisMin` instead of hardcoding 3 and 2, snap a shared axis to the real edge closest to the cluster instead of the cluster average, and measure neighbour distances once instead of inside the sort comparator. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Thanks a lot for this PR — really nice work. The problem you describe is real: on a dense canvas the old magnet field gets sticky, and disabling edge snapping entirely was too blunt a fix. Measuring the snap from the pointer's intended position instead of the glued position is the right call, and it's what makes diagonal drags catch both axes without trapping the layer. I reviewed it carefully and confirmed the default path ( I pushed three small follow-ups on top of your branch rather than sending you back and forth:
Plus the CHANGELOG entries and tests for the new fields. Merging now — thanks again! |
13.4.0 is already published, so the smart alignment and paint snap opt-out from #860 belong in a new unreleased section.
Description
Hello, this is a bit of an experimental, AI-Assisted branch that improves snapping with helperLines.
The motivation is to soften the magnetic force field without having to disable edge snapping (as previous PR did) to improve the user experience.
However, Smart Snapping is quite opinionated, and I put it on a way to be optional, but feel free to decide what you think out of it. Tested manually.
This adds opt-in smart alignment so same-kind layers snap matching edges (left↔left, etc.), mixed types stay center↔center, and only nearby / shared-axis neighbors participate. Canvas midlines snap centers only when smart is on. Custom guides stay wildcards.
Snapping is measured from the pointer’s intended position, so both axes can catch and still be left (diagonal L drags don’t get stuck).
Also adds
enablePaintLayerSnapping(defaulttrue). Whenfalse, paint is ignored as a snap target and does not snap while dragging. This is because painting layers are free form weird shaped things, I found it annoying to snap to a drawing layer, I think it goes well together.Defaults keep current behavior:
enableSmartAlignment: false,enablePaintLayerSnapping: true.Related Issue: Closes #
Type of Change