MCPcopy
hub / github.com/opentrace/opentrace / rebuildQuadtree

Method rebuildQuadtree

ui/src/components/pixi/PixiRenderer.ts:2134–2145  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2132 // ─── Quadtree ─────────────────────────────────────────────────────
2133
2134 private rebuildQuadtree(): void {
2135 const visibleNodes: PixiNode[] = [];
2136 for (const node of this.nodes.values()) {
2137 if (node.visible) visibleNodes.push(node);
2138 }
2139 // In 3D mode, use the sprite's projected position for hit detection
2140 this._quadtree = quadtree<PixiNode>()
2141 .x((d) => (this.mode3d ? d.sprite.position.x : d.x))
2142 .y((d) => (this.mode3d ? d.sprite.position.y : d.y))
2143 .addAll(visibleNodes);
2144 this.lastQuadtreeRebuild = performance.now();
2145 }
2146
2147 /** Find the nearest node to (worldX, worldY) within maxDistance. */
2148 findNodeAt(

Callers 5

setDataMethod · 0.95
addDataMethod · 0.95
postPositionUpdateMethod · 0.95
findNodeAtMethod · 0.95
set3DModeMethod · 0.95

Calls 1

pushMethod · 0.80

Tested by

no test coverage detected