MCPcopy
hub / github.com/opentrace/opentrace / computeFitTarget

Method computeFitTarget

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

Source from the content-addressed store, hash-verified

2313 }
2314
2315 private computeFitTarget(): Viewport | null {
2316 if (this.nodes.size === 0) return null;
2317 const positions = Array.from(this.nodes.values())
2318 .filter((n) => n.visible)
2319 .map((n) =>
2320 this.mode3d
2321 ? { x: n.sprite.position.x, y: n.sprite.position.y }
2322 : { x: n.x, y: n.y },
2323 );
2324 if (positions.length === 0) return null;
2325 const bounds = computeBounds(positions);
2326 return fitBounds(bounds, this.width, this.height);
2327 }
2328
2329 /** Pause auto-fit (Fix #9). Used during layoutMode transitions to
2330 * hold the camera steady before positions have actually moved.

Callers 1

scheduleAutoFitMethod · 0.95

Calls 2

computeBoundsFunction · 0.90
fitBoundsFunction · 0.90

Tested by

no test coverage detected