fix: preserve safe motion and consent failures

This commit is contained in:
Evandro Fonseca Junior committed 2026-09-04 22:02:00 -03:00
1 parent a4e5e5c048
commit bea235d6fd
4 files changed
+61 -14

No files matched your search

@@ -133,7 +133,7 @@ describe("ControlRoomGlobe lifecycle", () => {
expect(state.height).toBe(1040);
});
it("keeps the reduced-motion globe static", async () => {
it("keeps the reduced-motion globe static while tracking dimensions", async () => {
render(<ControlRoomGlobe autoRotate={false} />);
await waitFor(() => expect(createGlobe).toHaveBeenCalled());
setGlobeIntersects(true);
@@ -141,6 +141,6 @@ describe("ControlRoomGlobe lifecycle", () => {
renderCallback()(state);
expect(state).toEqual({ phi: 0, theta: 0, width: 0, height: 0 });
expect(state).toEqual({ phi: 0, theta: 0, width: 800, height: 800 });
});
});
@@ -123,6 +123,9 @@ export function ControlRoomGlobe({
width: initialRenderWidth,
height: initialRenderWidth,
onRender: (state) => {
const renderWidth = widthRef.current * dpr;
state.width = renderWidth;
state.height = renderWidth;
if (!autoRotate || !intersectsRef.current || document.hidden)
return;
if (!pointerInteracting.current) {
@@ -135,9 +138,6 @@ export function ControlRoomGlobe({
(config.theta ?? TROPIC_OF_CAPRICORN_RAD) +
Math.sin(thetaPhaseRef.current) * 0.35 +
thetaDragRef.current;
const renderWidth = widthRef.current * dpr;
state.width = renderWidth;
state.height = renderWidth;
},
});
}