perf(snap): keep snap/hover responsive on block-heavy drawings

Snap and hover hit-testing scanned the whole model wire set every cursor move; a heavily block-instanced drawing explodes to millions of wires, so this stalled for over a second per move. Add a cached spatial grid (wire_grid) keyed on the geometry epoch and query only the cursor neighbourhood via Scene::hit_test_wires_near. Gate the O(in-range segments squared) intersection passes on the in-range POINT count, not the wire count — a handful of curved wires, each hundreds of tessellated points, blew the quadratic up while the wire count looked modest. Give zero-size entities away from the origin (POINTs) a real cullable AABB, and fall back to a block sub-wire's own world points when its entity bounding box is degenerate.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-09 01:00:51 +03:00
1 parent f91e45a62a
commit e1c19d8af3
6 files changed
+313 -15

No files matched your search

+1
View File
@@ -2,4 +2,5 @@ pub mod hit_test;
pub mod selection_state;
pub mod grip;
pub mod quadtree;
pub mod wire_grid;
pub mod xclip;