Tldraw/packages/tldraw/src/test
Mitja Bezenšek 45dffd1af6
RBush again? (#3439)
Adds RBush to handle spatial querying. We use it for:
- Culling. Helps a lot with panning as we don't have to compute the
culled shapes from scratch. Instead we just query rbush again. It makes
culling quite granular: spatial index updates when shapes change
(additions, removals, changes to bounds), visible shapes depends on
that, but also updates when the viewport page bound change, culled
shapes then depend on that but also change with selections changes. The
api stayed the same, which is great since the fuzz tests can stay as
they are.
- Brushing 
- Erasing
- Scribble brushing
- Getting shapes at point (for example, when updating the hover id)

This improves performance of all of those operations. I might have
missed some places where this might also be useful.

### Erasing before (Test on my old ipad)


https://github.com/tldraw/tldraw/assets/2523721/edb9c004-a44a-4779-b2d0-98617b057314

### Erasing after


https://github.com/tldraw/tldraw/assets/2523721/8f8367fd-fa8e-4963-ba13-720c5f0c2da5

### Creating an arrow before


https://github.com/tldraw/tldraw/assets/2523721/4068f8b7-f7b8-4826-83f2-083b1f3783bc

### After (much better, but still bad)


https://github.com/tldraw/tldraw/assets/2523721/11af6be6-01d8-4740-bf15-896e2dd31dd6



### Change Type

<!--  Please select a 'Scope' label ️ -->

- [ ] `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
- [x] `internal` — Does not affect user-facing stuff

<!--  Please select a 'Type' label ️ -->

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

---------

Co-authored-by: Steve Ruiz <steveruizok@gmail.com>
2024-04-15 16:28:18 +00:00
..
__snapshots__ Update the project to Node 20 (#2691) 2024-01-31 16:53:40 +00:00
commands Fix SVG exports in Next.js (#3446) 2024-04-11 14:02:05 +00:00
perf Faster selection / erasing (#3454) 2024-04-13 13:30:30 +00:00
testutils Roundup fixes (#2862) 2024-02-19 14:52:43 +00:00
ui Roundup fixes (#2862) 2024-02-19 14:52:43 +00:00
ClickManager.test.ts
Editor.test.tsx Use canvas bounds for viewport bounds (#2798) 2024-02-12 15:03:25 +00:00
EraserTool.test.ts
HandTool.test.ts
HighlightShape.test.ts
LaserTool.test.ts
SelectTool.test.ts Stickies: release candidate (#3249) 2024-04-14 18:40:02 +00:00
TLSessionStateSnapshot.test.ts Update the project to Node 20 (#2691) 2024-01-31 16:53:40 +00:00
TLUserPreferences.test.ts
TestEditor.test.ts
TestEditor.ts Stickies: release candidate (#3249) 2024-04-14 18:40:02 +00:00
TldrawEditor.test.tsx New migrations again (#3220) 2024-04-15 12:53:42 +00:00
ZoomTool.test.ts
arrowBindingsIndex.test.tsx
arrows-megabus.test.tsx Maintain bindings whilst translating arrows (#2424) 2024-01-13 20:09:05 +00:00
assets.test.ts
bookmark-shapes.test.ts
cleanup.test.ts
cropping.test.ts
customSnapping.test.tsx Add line IDs & fractional indexes (#2890) 2024-02-21 10:06:14 +00:00
drawing.test.ts Revert perf changes (#3217) 2024-03-21 10:05:44 +00:00
duplicate.test.ts Improved duplication (#2480) 2024-01-26 14:54:52 +00:00
flipShapes.test.ts [tech debt] Primitives renaming party / cleanup (#2396) 2024-01-03 12:13:15 +00:00
frames.test.ts Stickies: release candidate (#3249) 2024-04-14 18:40:02 +00:00
getCulledShapes.test.tsx RBush again? (#3439) 2024-04-15 16:28:18 +00:00
getShapeAtPoint.test.ts
getSnapLines.ts Split snap manager into ShapeBoundsSnaps and HandleSnaps (#2747) 2024-02-07 10:40:01 +00:00
groups.test.ts Split snap manager into ShapeBoundsSnaps and HandleSnaps (#2747) 2024-02-07 10:40:01 +00:00
middleMouseButtonPanning.test.ts
modifiers.test.ts
panning.test.ts
parentsToChildrenWithIndexes.test.ts
paste.test.ts
renderingShapes.test.tsx Perf: Incremental culled shapes calculation. (#3411) 2024-04-10 10:29:11 +00:00
resizeBox.test.ts [tech debt] Primitives renaming party / cleanup (#2396) 2024-01-03 12:13:15 +00:00
resizing.test.ts Split snap manager into ShapeBoundsSnaps and HandleSnaps (#2747) 2024-02-07 10:40:01 +00:00
rotating.test.ts [tech debt] Primitives renaming party / cleanup (#2396) 2024-01-03 12:13:15 +00:00
roundedBox.ts [tech debt] Primitives renaming party / cleanup (#2396) 2024-01-03 12:13:15 +00:00
select.test.tsx Stickies: release candidate (#3249) 2024-04-14 18:40:02 +00:00
selection-omnibus.test.ts RBush again? (#3439) 2024-04-15 16:28:18 +00:00
shapeIdsInCurrentPage.test.ts
shapeutils.test.ts
spacebarPanning.test.ts
spatialIndex.test.ts RBush again? (#3439) 2024-04-15 16:28:18 +00:00
styles2.test.tsx
styles3.test.ts
test-jsx.tsx [Snapping 3/5] Custom snapping API (#2793) 2024-02-15 15:10:04 +00:00
text.test.ts
translating.test.ts Stickies: release candidate (#3249) 2024-04-14 18:40:02 +00:00
viewport-following.test.ts