mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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:
1 parent
08ff7f3e9d
commit
e4b3933166
2 files changed
+32
-3
No files matched your search
+12
-2
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user