feat(api): allow custom relative snap points for handles#6987
feat(api): allow custom relative snap points for handles#6987mimecuvalo merged 4 commits intotldraw:mainfrom
Conversation
|
@naaa760 is attempting to deploy a commit to the tldraw Team on Vercel. A member of the Team first needs to authorize it. |
|
naaa760 has signed the Contributor License Agreement. Thanks! |
|
Hi! Thank you for your contribution, I'll take a look at it. In the meantime can you please comment with |
|
/huppy check cla |
|
Thanks for this! ❤️ Would it be possible to implement this as a property on the TLHandle type rather than as a separate shape util method? I think it would be a cleaner API that way, but maybe I'm missing some nuance of the problem. |
685e304 to
b229aae
Compare
|
Hello! @ds300 and @kostyafarber |
|
this looks great now, thanks. Do you mind running |
799a8e1 to
b229aae
Compare
|
done! @ds300 |
|
Hi @naaa760 sorry for the delay! If you could post a comment that says "I have read and agree to the Contributor License Agreement." and then after in a new comment write I forgot to mention that we need that as a comment. Thank you! |
|
I have read and agree to the Contributor License Agreement. |
|
/huppy check cla |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
|
@naaa760 I think the issue wasn't the huppy cla check. The thing that David asked above:
Looks like you had a comment above saying you ran it, but maybe it didn't get commited to the PR. (I'm not seeing it in the changed files). thanks! |
|
Hey! 👋 This PR contains changes to Here's an example: Once you add this section, the check will pass automatically! |
|
almost there :) last check just says a linting issue. run |
no worries, i updated it. |
|
thank you! |
fixes: tldraw#6975 - adds `getAdjacentHandleForShiftSnapping()` method to `ShapeUtil` to allow custom shapes to define which handle should be used as the reference point when dragging handles with shift key for angle snapping. - fixes janky snapping behavior in shapes like bezier curves where control points need to snap relative to specific anchor points instead of the default "next adjacent handle" logic. ### Change type - [x] `feature` - [x] `api` ### Test plan 1. Added unit tests for custom adjacent handle snapping behavior 2. All existing tests pass, ensuring backward compatibility - [x] Unit tests ### API changes - Added `snapReferenceHandleId?: string` property to `TLHandle` interface - Allows handles to specify a custom reference point for shift-modifier angle snapping - No breaking changes - optional property with full backward compatibility

fixes: #6975
adds
getAdjacentHandleForShiftSnapping()method toShapeUtilto allow custom shapes to define which handle should be used as the reference point when dragging handles with shift key for angle snapping.fixes janky snapping behavior in shapes like bezier curves where control points need to snap relative to specific anchor points instead of the default "next adjacent handle" logic.
Change type
featureTest plan
Release notes
getAdjacentHandleForShiftSnappingandsnapReferenceHandleId.