d47fd56d82
So we were kinda bending over backwards to capture the use case where we update the arrow's terminal x,y coords when unbinding, copy-pasting, and duplicating. - At first we abused the `onBeforeShapeDelete` callbacks, but that was footgunny. - Then we created a `onBeforeUnbind` callback, which was less footgunny but still subtly footgunny. This PR proposes reverting the `onBeforeUnbind` stuff, taking us back to having `onBeforeShapeDelete` stuff. But at the same time it adds `onBeforeShapeIsolate` callbacks which are triggered at the following times: - When you delete the other shape in a bound shape pair - When you copy/paste or duplicate one shape in a bound shape pair but not the other one - When you opt-in while deleting bindings e.g. `deleteBindings([...], {isolateShapes: true})` This PR also fixes the bound arrow drag interaction. We can probably extract that out to a separate PR if needed. ![Kapture 2024-06-04 at 12 42 40](https://github.com/tldraw/tldraw/assets/1242537/95b51e14-1119-4dad-91e4-8b19fdb5e862) ### Change Type <!-- ❗ Please select a 'Scope' label ❗️ --> - [x] `sdk` — Changes the tldraw SDK - [ ] `dotcom` — Changes the tldraw.com web app - [ ] `docs` — Changes to the documentation, examples, or templates. - [ ] `vs code` — Changes to the vscode plugin - [ ] `internal` — Does not affect user-facing stuff <!-- ❗ Please select a 'Type' label ❗️ --> - [x] `bugfix` — Bug fix - [ ] `feature` — New feature - [x] `improvement` — Improving existing features - [ ] `chore` — Updating dependencies, other boring stuff - [ ] `galaxy brain` — Architectural changes - [ ] `tests` — Changes to any test code - [ ] `tools` — Changes to infrastructure, CI, internal scripts, debugging tools, etc. - [ ] `dunno` — I don't know ### Test Plan 1. Add a step-by-step description of how to test your PR here. 2. - [ ] Unit Tests - [ ] End to end tests ### Release Notes - Add a brief release note for your PR here. |
||
---|---|---|
.. | ||
e2e | ||
public | ||
src | ||
.gitignore | ||
LICENSE.md | ||
package.json | ||
README.md | ||
tsconfig.json | ||
vercel.json | ||
vite.config.ts |
@tldraw/example
Distributions
You can find tldraw on npm here.
Contribution
Please see our contributing guide. Found a bug? Please submit an issue.
License
The tldraw source code and its distributions are provided under the tldraw license. This license does not permit commercial use. To purchase a commercial license or learn more, please fill out this form.
Trademarks
Copyright (c) 2023-present tldraw Inc. The tldraw name and logo are trademarks of tldraw. Please see our trademark guidelines for info on acceptable usage.
Contact
Find us on Twitter/X at @tldraw.
Community
Have questions, comments or feedback? Join our discord or start a discussion. For the latest news and release notes, check out our Substack.