fix(globe): the Navara follow turns and dollies as Cesium's tracked camera

Review of Tasks 6-7: a 240 px drag right turned Navara's follow by -67.5°
where Cesium turns +119.5°, and a right drag did nothing (Cesium dollies,
1.95 Mm → 0.91 Mm). followGestures.js now follows Cesium's
ScreenSpaceCameraController for a tracked camera:
- left drag (rotate3D): heading += 1.77 × dx / width × 2π (clockwise for a
  drag right; 1.77 is Cesium's maximum rotate rate, which a tracked camera
  beyond a few metres always reaches) and the camera rises by
  1.77 × -dy / height × π; each move counts at most a tenth of the canvas
  (maximumMovementRatio);
- right drag (zoom3D): follow.js dollyOffset moves 5 × dy / height of the
  distance above the floor (closing) or of the range (opening), never
  inside it; no context menu while following.

The contract follow check turns the camera with a 240 px drag right and
asserts the heading turn against Cesium's rate (±15 %; the harness holds the
pointer before releasing it so Cesium adds no inertia), and dollies with a
right drag down (range below 80 %, never under 149 m). Cesium 73/73, Navara
79/79.
This commit is contained in:
German Khokhlov committed 2026-10-16 22:14:02 +04:00
1 parent b0cbed081b
commit f0ce1b04c7
5 files changed
+188 -19

No files matched your search

+29
View File
@@ -205,6 +205,28 @@ export function zoomOffset(
return cartesian3.multiplyByScalar(offset, next / range, result);
}
/**
* The ENU offset dollied as Cesium's zoom3D: `ratio` is the drag over the
* canvas height (down closes in), at most a tenth per move; the camera moves
* five times that share of its distance above the floor (closing) or of its
* range (opening), never inside `minRange`.
*/
export function dollyOffset(
offset,
ratio,
minRange,
result = cartesian3.create(),
) {
const range = cartesian3.magnitude(offset);
if (!(range > 0) || !Number.isFinite(ratio))
return cartesian3.clone(offset, result);
const window = Math.min(ratio, 0.1);
const closing = window > 0;
const distance = 5 * (range - (closing ? minRange : 0)) * window;
const next = Math.max(minRange, range - distance);
return cartesian3.multiplyByScalar(offset, next / range, result);
}
const STILL_M = 1e-6;
/**
@@ -257,6 +279,13 @@ export function createFollowController({
handle.moved = true;
requestRender();
},
dolly(ratio) {
const handle = current;
if (!handle?.offset) return;
dollyOffset(handle.offset, ratio, handle.options.minRange, handle.offset);
handle.moved = true;
requestRender();
},
zoom(factor) {
const handle = current;
if (!handle?.offset) return;