Stories: reach the globe through the renderer's ports

Main now keeps Cesium behind the renderer contract, so Stories stops
reaching Cesium and the viewer directly.

- Camera: flights, the -60 degree story framing, cancel, the pose saved
  on open and put back on Close go through the camera port; a follow is
  released with stopFollowing.
- Pins: placed in the frame port's postRender from the query port's
  projection and horizon test, still written straight to each pin's
  transform on every drawn frame.
- Tile settling: a continuous-render hold until the globe port reports
  the base settled, for at most 10 s.
- Clock: Close and Back to Explore put back the page's world clock (live,
  or the time it showed, playing on), and leave a clock that is still
  where it should be alone.
- Card images: drawn from Esri World Imagery's own Web Mercator tiles
  while the Esri map stack is active, read as images; no Cesium imagery
  provider is touched.
- THUMBNAIL: the director hands captureStoryThumb the frame port and the
  renderer's canvas, so the scene document's module stays renderer-free.
- Credits: Stories places and keeps visible the application's credit
  line (#gev-credits) and its list as well as the renderer's own display.
- Tests fake the ports instead of a Cesium viewer, and cover pins per
  frame, the flights, the settling bound and the clock restore; the
  share link tests Stories added build their manager over a camera port.
This commit is contained in:
Manjunath committed 2026-11-16 20:43:53 +05:30
1 parent 9e9ce1db22
commit b8e622aac8
15 files changed
+695 -376

No files matched your search

+24 -14
View File
@@ -3,7 +3,6 @@ import '../testSupport/registerDom.mjs';
import { registerHooks } from 'node:module';
import test from 'node:test';
import assert from 'node:assert/strict';
import * as Cesium from 'cesium';
import { createPinia, setActivePinia } from 'pinia';
// Every module Node loads, to see when the Stories chunk arrives.
@@ -38,24 +37,35 @@ globalThis.cancelAnimationFrame = () => {};
const { bootStories } = await import('./boot.js');
const { useStoriesStore } = await import('../ui/stores/stories.js');
const viewer = {
scene: {
canvas: document.createElement('canvas'),
postRender: { addEventListener: () => () => {} },
},
const { bindRenderer } = await import('../render/rendererOf.js');
// The scene object, bound to a renderer double with the ports Stories uses.
const viewer = { isDestroyed: () => false };
bindRenderer(viewer, {
canvas: document.createElement('canvas'),
camera: {
positionWC: new Cesium.Cartesian3(1, 2, 3),
positionCartographic: { latitude: 0, longitude: 0, height: 2e6 },
heading: 0,
pitch: -1,
roll: 0,
pose: () => ({
position: { x: 1, y: 2, z: 3 },
heading: 0,
pitch: -1,
roll: 0,
lon: 0,
lat: 0,
height: 2e6,
}),
setView() {},
flyTo() {},
flyToBoundingSphere() {},
flyToBounds() {},
cancelFlight() {},
},
clock: { currentTime: Cesium.JulianDate.now(), shouldAnimate: false },
};
frame: {
on: () => () => {},
requestRender() {},
holdContinuous: () => () => {},
},
query: { project: () => null, isOccluded: () => true },
globe: { isSettled: () => true },
});
const director = {
running: false,
stopScene() {},