Find the nearest node to (worldX, worldY) within maxDistance.
(
worldX: number,
worldY: number,
maxDistance = 20,
)
| 2146 | |
| 2147 | /** Find the nearest node to (worldX, worldY) within maxDistance. */ |
| 2148 | findNodeAt( |
| 2149 | worldX: number, |
| 2150 | worldY: number, |
| 2151 | maxDistance = 20, |
| 2152 | ): PixiNode | null { |
| 2153 | if (!this._quadtree) return null; |
| 2154 | // In 3D mode, rebuild quadtree every hit test since projected positions |
| 2155 | // change every frame from rotation. This is O(n log n) but only runs |
| 2156 | // on click/hover (~20fps), not every render frame. |
| 2157 | if (this.mode3d) this.rebuildQuadtree(); |
| 2158 | return this._quadtree.find(worldX, worldY, maxDistance) ?? null; |
| 2159 | } |
| 2160 | |
| 2161 | /** |
| 2162 | * Find the nearest edge to (worldX, worldY) within maxDistance. |
no test coverage detected