Orbit, move, look and zoom through the camera port

The Cesium camera port gains move, look, rotateAround and zoom, and the
browser conformance run now checks them, the lookAt-frame commands, the
changed thresholds and moveEnd (timed by the clock, not a frame count).
Orbit, the Bhote Koshi focus and cinematic, the launch zoom anchor and
replay chase, the camera verbs' motion tick and roll levelling, and
voice zoom write through the port.
This commit is contained in:
Sameh Khamis committed 2026-11-06 10:21:04 -08:00
1 parent c722593791
commit 21d23034ec
19 files changed
+174 -112

No files matched your search

+3 -2
View File
@@ -1,3 +1,4 @@
import { bindFakeCesiumCamera } from '../testSupport/fakeCameraPort.mjs';
import test from 'node:test';
import assert from 'node:assert/strict';
import {
@@ -47,7 +48,7 @@ const outputs = (ws) =>
function fixture({ holdFirst = false } = {}) {
const state = { height: 1000, renders: 0, providerWrites: [], panels: [] };
const position = { x: 6379137, y: 0, z: 0 };
const viewer = {
const viewer = bindFakeCesiumCamera({
clock: { onTick: { addEventListener: () => () => {} } },
camera: {
positionWC: position,
@@ -76,7 +77,7 @@ function fixture({ holdFirst = false } = {}) {
state.renders++;
},
},
};
});
const runner = createGevActionRunner({
viewer,
dataManager: { layers: new Map() },
+9 -9
View File
@@ -2927,9 +2927,10 @@ function adjustCameraZoom(viewer, args) {
}[amount];
if (!fraction) throw new Error(`Unknown zoom amount: ${args.amount}`);
const camera = viewer.camera;
const beforePosition = Cesium.Cartesian3.clone(camera.positionWC);
const beforeHeightM = camera.positionCartographic.height;
const camera = cameraOf(viewer);
const before = camera.pose();
const beforePosition = before.position;
const beforeHeightM = before.height;
const target = getViewTargetCartesian(viewer);
const targetDistanceM = target
? chordM(beforePosition, target)
@@ -2939,7 +2940,7 @@ function adjustCameraZoom(viewer, args) {
camera.cancelFlight();
if (direction === 'out') {
camera.zoomOut(movementM);
camera.zoom(-movementM);
} else {
const safeMovementM = Math.min(
movementM,
@@ -2954,13 +2955,12 @@ function adjustCameraZoom(viewer, args) {
error: 'Camera is already at the minimum target distance',
};
}
camera.zoomIn(safeMovementM);
camera.zoom(safeMovementM);
}
viewer.scene.requestRender();
const afterPosition = camera.positionWC;
const movedM = chordM(beforePosition, afterPosition);
const afterHeightM = camera.positionCartographic.height;
const after = camera.pose();
const movedM = chordM(beforePosition, after.position);
const afterHeightM = after.height;
const moved = movedM >= 0.5;
return {
ok: moved,
+3 -2
View File
@@ -1,4 +1,5 @@
// Imports intentionally target the candidate, never the immutable reference.
import { bindFakeCesiumCamera } from '../testSupport/fakeCameraPort.mjs';
import test from 'node:test';
import assert from 'node:assert/strict';
import {
@@ -176,7 +177,7 @@ function compositionFixture(
const canvas = new EventTarget();
Object.assign(canvas, { clientWidth: 800, clientHeight: 600 });
const position = { x: 6379137, y: 0, z: 0 };
const viewer = {
const viewer = bindFakeCesiumCamera({
clock: { onTick: { addEventListener: () => () => {} } },
camera: {
positionWC: position,
@@ -202,7 +203,7 @@ function compositionFixture(
state.renders++;
},
},
};
});
const dataManager = { layers: new Map() };
pointer = createPointerTracker({ element: null, now: () => 1000 });
const referents = createReferentRegistry();