Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Faster selection / erasing #3454

Merged
merged 9 commits into from
Apr 13, 2024
Merged

Faster selection / erasing #3454

merged 9 commits into from
Apr 13, 2024

Conversation

steveruizok
Copy link
Collaborator

This PR makes a small improvement to the way we measure distances. (Often we measure distances multiple times per frame per shape on the screen). In many cases, we compare a minimum distance. This makes those checks faster by avoiding a square root.

Change Type

  • sdk — Changes the tldraw SDK
  • improvement — Improving existing features

Release Notes

  • Improve performance of minimum distance checks.

Copy link

vercel bot commented Apr 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
examples ✅ Ready (Inspect) Visit Preview Apr 13, 2024 0:49am
1 Ignored Deployment
Name Status Preview Updated (UTC)
tldraw-docs ⬜️ Ignored (Inspect) Visit Preview Apr 13, 2024 0:49am

@steveruizok
Copy link
Collaborator Author

steveruizok commented Apr 13, 2024

I've also made some improvements to the speed of erasing and made margins work for hit segment hit testing, which were previously not working. This makes erasing perform as intended (with a "margin" around the eraser) rather than requiring the eraser to intersect a shape's geometry.

@steveruizok steveruizok changed the title Faster dist / fix erasing margin Faster selection / erasing Apr 13, 2024
@steveruizok
Copy link
Collaborator Author

Turns out with lots of shapes on the screen, showing and hiding indicators becomes slow; we can speed things up by leaving the indicators in the DOM and switching their display properties instead.

@steveruizok steveruizok added this pull request to the merge queue Apr 13, 2024
Merged via the queue into main with commit 3ceebc8 Apr 13, 2024
10 checks passed
@steveruizok steveruizok deleted the faster-dist branch April 13, 2024 13:36
github-merge-queue bot pushed a commit that referenced this pull request Apr 17, 2024
A little regression from #3454. We
still need the exact distance here.

### 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
- [ ] `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

### Release Notes

- Fix arrow label positioning
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improves existing features sdk Affects the tldraw sdk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant