fix: make nightdrive signage reliable and legible

This commit is contained in:
2026-09-03 02:34:15 +03:00
parent a03d4d8dba
commit cce018d3cb
39 changed files with 4635 additions and 196 deletions

View File

@@ -10,6 +10,23 @@ export interface SceneInstrumentationSnapshot {
routeLabelsDrawn: string[];
clearColors: string[];
unhandledRejections: string[];
signFrames: SignFrameInstrumentation[];
}
export interface SignFrameInstrumentation {
now: number;
visible: boolean;
targetId: string;
phase: string;
progress: number;
opacity: number;
activeSectionId: string;
direction: number;
corridor: string;
viewportProfile: string;
bounds: { left: number; top: number; right: number; bottom: number; width: number; height: number };
texture: { width: number; height: number; anisotropy: number; fontReadyWhenDrawn: boolean };
rendererPixelRatio: number;
}
type InstrumentedWindow = Window & {
@@ -34,6 +51,7 @@ export async function installSceneInstrumentation(page: Page): Promise<void> {
routeLabelsDrawn: [],
clearColors: [],
unhandledRejections: [],
signFrames: [],
animationFrameIds: new Set<number>(),
audioContexts: [],
};
@@ -135,6 +153,11 @@ export async function installSceneInstrumentation(page: Page): Promise<void> {
const reason = event.reason;
state.unhandledRejections.push(reason instanceof Error ? reason.message : String(reason));
});
window.addEventListener('portfolio-sign-frame', (event) => {
const detail = (event as CustomEvent<SignFrameInstrumentation>).detail;
if (!detail || state.signFrames.length >= 600) return;
state.signFrames.push(structuredClone(detail));
});
});
}
@@ -150,6 +173,7 @@ export async function readSceneInstrumentation(page: Page): Promise<SceneInstrum
routeLabelsDrawn: [...state.routeLabelsDrawn],
clearColors: [...state.clearColors],
unhandledRejections: [...state.unhandledRejections],
signFrames: state.signFrames.map((frame) => structuredClone(frame)),
};
});
}