Add pointer-driven camera scripts with Cesium goldens, and count wheel lines as Cesium does

Five new camera conformance scripts move the camera by user input: a
left drag that coasts, thirty pixel-mode and thirty line-mode wheel
notches from 5 km, a middle-drag tilt, and Shift and Ctrl drags held too
long to coast. The runner turns input steps into pointer events for a
driver: a move starts where the pointer last pressed or moved and carries
the held button. The golden recorder now drives Cesium's own screen-space
camera controller on a stand-in canvas, with Date on the virtual clock so
inertia is deterministic. The existing goldens are unchanged.

A harness that answers pointer input sets cameraInput and a pointer hook.
Harnesses without it, such as the stub, skip the input scripts.

The input port reported a line-mode wheel at 33 1/3 pixels a line. It now
counts lines as the reference does, 40 pixels a line and 3 lines a page,
so a pixel or line wheel converts back to the same pixels.
This commit is contained in:
Sameh Khamis committed 2026-11-08 20:08:56 -08:00
1 parent ef616b7905
commit 90499762f5
16 files changed
+1055 -38

No files matched your search

+16 -1
View File
@@ -3,7 +3,11 @@
* view rules the traces cannot show.
*/
import goldens from '../goldens/camera.json' with { type: 'json' };
import { CAMERA_SCRIPTS, SCRIPT_VIEWPORT } from '../cameraScripts.js';
import {
CAMERA_SCRIPTS,
SCRIPT_VIEWPORT,
usesInput,
} from '../cameraScripts.js';
import { contractDriver, runCameraScript } from '../cameraRunner.js';
import { deepEqual, equal, near, nearAngle, nearVec, ok } from '../expect.js';
@@ -136,6 +140,11 @@ export function cameraChecks() {
async run(h) {
const expected = goldens.scripts[script.name];
ok(expected, `no reference trace for ${script.name}`);
const input = usesInput(script);
if (input && h.cameraInput && !h.pointer)
throw new Error('a harness with cameraInput needs pointer');
if (input && !h.cameraInput)
return { skip: 'the harness has no camera that answers pointer input' };
const r = await fresh(h);
try {
if (script.capability && !r.capabilities.has(script.capability))
@@ -144,6 +153,12 @@ export function cameraChecks() {
contractDriver(r, {
frame: () => h.frame(r),
toEcef: lonLatToEcef(h),
...(input
? {
pointer: (type, x, y, extra) =>
h.pointer(r, type, x, y, extra),
}
: {}),
}),
script,
);