fix(camera): read zoom input at the ceiling when the scene is idle

The guard reads its input in preRender, which Cesium only fires on frames
that draw. In request-render mode, wheel input at the ceiling doesn't move
the camera, so nothing drew and the input was applied later by an
unrelated frame. The guard now requests a frame through the render
governor whenever it has unread input.
This commit is contained in:
Sameh Khamis committed 2026-11-03 09:10:30 -08:00
1 parent 08ff7f3e9d
commit e4b3933166
2 files changed
+32 -3

No files matched your search

+12 -2
View File
@@ -194,8 +194,18 @@ export function installZoomOutGuard(
}
};
const removePreRender = scene.preRender.addEventListener(guard);
// Fires every frame, after Cesium has applied this frame's input.
const removePostUpdate = scene.postUpdate.addEventListener(followCeiling);
// Fires every frame, after Cesium has applied this frame's input, while
// preRender fires only on frames that draw. Input that didn't move the camera
// (such as wheel at the ceiling) would otherwise wait for an unrelated frame.
const removePostUpdate = scene.postUpdate.addEventListener(() => {
followCeiling();
if (
INPUT_BINDINGS.some(({ type, modifier }) =>
aggregator.isMoving(type, modifier),
)
)
requestRender('zoom-out-guard');
});
const removeCameraHandoff = subscribeCameraHandoff?.(() => {
cancel();
// Discard input queued before an explicit navigation action took ownership.