tldraw/packages
alex 89881397b5
[Snapping 4/5] Add handle-point snapping (#2841)
Currently, when dragging line handles they'll snap to the outlines of
other shapes, but not to their vertices. This can make it hard to snap
precisely to certain key places, like the handles of other lines, or the
corners of `geo` shapes.

This diff adds a new snap type for handles - snapping to points:

![Kapture 2024-02-14 at 16 30
41](https://github.com/tldraw/tldraw/assets/1489520/046109d3-2961-463f-bf71-9350ea1204bc)

This adds to the new snapping API so the snapping points can very easily
be customised on a shape-by-shape basis. Closes TLD-2198

This PR is part of a series - please don't merge it until the things
before it have landed!
1. #2827 
2. #2831
3. #2793 
4. #2841 (you are here)
5. #2845

### Change Type

- [x] `minor` — New feature

### Test Plan

1. create a line shape
2. drag its handles whilst holding command
3. it should snap to the outlines of other shapes, vertices of other
line shapes, and the bounding box corners/center of most 'boxy' shapes
(geo, embed, etc)

- [x] Unit Tests

### Release Notes

- Line handles
2024-02-15 15:22:48 +00:00
..
assets Lokalise: Translations update (#2830) 2024-02-14 08:59:41 +00:00
editor [Snapping 4/5] Add handle-point snapping (#2841) 2024-02-15 15:22:48 +00:00
state dev: swap yarn test and test-dev for better dx (#2773) 2024-02-14 16:05:59 +00:00
store dev: swap yarn test and test-dev for better dx (#2773) 2024-02-14 16:05:59 +00:00
tldraw [Snapping 4/5] Add handle-point snapping (#2841) 2024-02-15 15:22:48 +00:00
tlschema [Snapping 2/5] Fix line-handle mid-point snapping (#2831) 2024-02-15 10:27:55 +00:00
tlsync [Snapping 1/5] Validation & strict types for fractional indexes (#2827) 2024-02-14 17:53:30 +00:00
utils [Snapping 1/5] Validation & strict types for fractional indexes (#2827) 2024-02-14 17:53:30 +00:00
validate Composable custom UI (#2796) 2024-02-15 12:10:09 +00:00