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

Perf: block hit tests while moving camera #3418

Merged
merged 3 commits into from
Apr 9, 2024

Conversation

steveruizok
Copy link
Collaborator

This PR uses an element that prevents hit tests on shapes while the camera is moving.

Kapture.2024-04-09.at.14.32.53.mp4

Change Type

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

Test Plan

  1. Move the camera.
  2. Interact with the canvas.
  3. Zoom in and out.

Release Notes

  • Improves performance of canvas while the camera is moving.

@huppy-bot huppy-bot bot added improvement Product improvement sdk Affects the tldraw sdk labels Apr 9, 2024
Copy link

vercel bot commented Apr 9, 2024

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

Name Status Preview Updated (UTC)
examples ✅ Ready (Inspect) Visit Preview Apr 9, 2024 2:32pm
1 Ignored Deployment
Name Status Preview Updated (UTC)
tldraw-docs ⬜️ Ignored (Inspect) Visit Preview Apr 9, 2024 2:32pm

@steveruizok steveruizok changed the title Block hit tests while moving camera Perf: block hit tests while moving camera Apr 9, 2024
@mimecuvalo
Copy link
Member

so good

@ds300
Copy link
Collaborator

ds300 commented Apr 9, 2024

@steveruizok instead of this could we just put the following line at the top of getShapeAtPoint ?

if (this.getCameraState() !== 'idle') return

@steveruizok
Copy link
Collaborator Author

No this one addresses the browser's own hitTest function, which takes time as number of elements on the screen goes up.

Copy link
Contributor

@MitjaBezensek MitjaBezensek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Not sure if the feature flag changes are leftovers from testing or if you wanted to commit them?

@steveruizok steveruizok added this pull request to the merge queue Apr 9, 2024
Merged via the queue into main with commit dadb57e Apr 9, 2024
10 checks passed
@steveruizok steveruizok deleted the block-hit-tests-while-moving-camera branch April 9, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Product improvement sdk Affects the tldraw sdk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants