MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / FrameCapDriver

Function FrameCapDriver

graph-ui/src/galaxy/GraphScene.tsx:616–639  ·  view source on GitHub ↗

* Der Deckel: der Canvas laeuft auf `never` und wird von hier getaktet. * * Der Weg ueber `advance()` und nicht ueber ein Ueberspringen in `useFrame`: * ein uebersprungenes `useFrame` spart nichts, denn der Canvas hat das Bild * schon gezeichnet, bevor der Rueckruf laeuft. Erst ein Renderloop, d

({ cap, active }: { cap: number; active: boolean })

Source from the content-addressed store, hash-verified

614 * haben, fuer eine Einstellung, die niemand eingeschaltet hat.
615 */
616function FrameCapDriver({ cap, active }: { cap: number; active: boolean }): null {
617 const advance = useThree((state) => state.advance);
618
619 useEffect(() => {
620 if (!active || cap <= 0 || typeof requestAnimationFrame !== 'function') {
621 return;
622 }
623 const interval = 1000 / cap;
624 let last = 0;
625 let handle = 0;
626 const tick = (time: number): void => {
627 handle = requestAnimationFrame(tick);
628 if (time - last < interval - FRAME_CAP_TOLERANCE_MS) {
629 return;
630 }
631 last = time;
632 advance(time);
633 };
634 handle = requestAnimationFrame(tick);
635 return () => cancelAnimationFrame(handle);
636 }, [advance, active, cap]);
637
638 return null;
639}
640
641/**
642 * Die flache Ansicht: eine orthografische Kamera die z-Achse hinunter.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected