mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
fix(globe): render holds and commanded on Navara
The render governor installs on a non-Cesium globe engine as its backend: owner-counted holds drive engine.render.setContinuous and requests go to engine.render.request, so orbit and every other per-frame owner keep Navara drawing while held and let it idle once the last hold goes. Cesium stays on the viewer path its engine delegates to. A user gesture on Navara now ends a flight without raising camera.commanded (the user is not a new camera owner). Headless Navara QA checks both.
This commit is contained in:
1 parent
c6e1b65c67
commit
d112ecf296
5 files changed
+81
-5
No files matched your search
@@ -389,6 +389,11 @@ export function createCameraModel({
|
||||
camera,
|
||||
sync,
|
||||
afterFrame,
|
||||
/**
|
||||
* Ends a running flight (its `cancel` runs) without camera.commanded:
|
||||
* for the user's own gestures, which are not a new camera owner.
|
||||
*/
|
||||
stopFlight: () => cancelCurrentFlight(),
|
||||
/** The current camera for projections: pose, vertical fov and CSS size. */
|
||||
view,
|
||||
worldToWindow: (position, result) =>
|
||||
|
||||
@@ -120,7 +120,8 @@ export function createNavaraEngine(
|
||||
view.on(name, handler);
|
||||
|
||||
const input = createNavaraInput(view, {
|
||||
onCameraInput: () => model.camera.cancelFlight(),
|
||||
// A gesture is the user, not a new camera owner: no camera.commanded.
|
||||
onCameraInput: () => model.stopFlight(),
|
||||
});
|
||||
const credits = createNavaraCredits(view);
|
||||
const maps = createNavaraMaps(view, fetch ? { fetch } : {});
|
||||
|
||||
@@ -226,3 +226,20 @@ test('pickGlobe meets the terrain along the pick ray, or the ellipsoid', () => {
|
||||
near(math.toDegrees(place.longitude), 0, 1e-6, 'longitude');
|
||||
assert.equal(engine.picker.pickGlobe(cartesian2.create(640, -1e7)), undefined);
|
||||
});
|
||||
|
||||
test('a user gesture cancels a flight without raising camera.commanded', () => {
|
||||
const { engine, view } = setup();
|
||||
const outcome = [];
|
||||
let commanded = 0;
|
||||
engine.camera.flyTo({
|
||||
destination: cartesian3.fromDegrees(10, 10, 1e6),
|
||||
duration: 5,
|
||||
cancel: () => outcome.push('cancel'),
|
||||
});
|
||||
engine.camera.commanded.addEventListener(() => commanded++);
|
||||
view.canvas.dispatchEvent(new Event('pointerdown'));
|
||||
view.canvas.dispatchEvent(new Event('wheel'));
|
||||
assert.deepEqual(outcome, ['cancel']);
|
||||
assert.equal(engine.camera.flightActive(), false);
|
||||
assert.equal(commanded, 0, 'a gesture is the user, not a new camera owner');
|
||||
});
|
||||
Reference in new issue
Block a user