mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
Wait for the holds check's flight by the clock, not a frame count
A page's frames come at the display's rate: at 240 Hz the 20 frames the check allowed pass inside the 100 ms flight, and it failed on 'the flight ended'. It now waits up to a second by the harness clock, still capped at 600 frames, as the moveEnd check does.
This commit is contained in:
1 parent
1d2b853576
commit
3d320035b6
1 file changed
+9
-1
@@ -222,7 +222,15 @@ export function cameraChecks() {
|
||||
const release = r.input.suspendCameraControls('drag');
|
||||
ok(!r.camera.controls.enabled, 'a hold disables input');
|
||||
r.camera.flyTo({ lon: 0, lat: 0, height: 1e6 }, { durationS: 0.1 });
|
||||
for (let i = 0; i < 20 && r.camera.flying; i++) await h.frame(r);
|
||||
// By the clock, not a frame count: a page's frames come at the
|
||||
// display's rate, so 20 of them can pass inside the 100 ms flight.
|
||||
const flownAt = h.now(r);
|
||||
for (
|
||||
let i = 0;
|
||||
i < 600 && r.camera.flying && h.now(r) - flownAt < 1000;
|
||||
i++
|
||||
)
|
||||
await h.frame(r);
|
||||
ok(!r.camera.flying, 'the flight ended');
|
||||
ok(!r.camera.controls.enabled, 'the drag hold survives the flight end');
|
||||
const second = r.camera.controls.suspend('cockpit');
|
||||
|
||||
Reference in new issue
Block a user