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

+25 -12
View File
@@ -12,13 +12,23 @@ const view = readFileSync(
'utf8',
);
/** Every declaration block in stories.css whose selector names the credit line. */
/**
* Every declaration block in stories.css whose selector names the credit
* line: the renderer's own display (`#cesium-credits`) or the application's
* line (`#gev-credits`, src/ui/creditsView.js), with its selectors one each.
*/
function creditBlocks() {
const blocks = [];
const re = /([^{}]+)\{([^{}]*)\}/g;
for (let m; (m = re.exec(css));) {
if (m[1].includes('#cesium-credits'))
blocks.push({ selector: m[1].trim(), body: m[2] });
if (/#(cesium|gev)-credits/.test(m[1]))
blocks.push({
selector: m[1].trim(),
selectors: m[1]
.split(/,(?![^(]*\))/)
.map((part) => part.replace(/\s+/g, ' ').trim()),
body: m[2],
});
}
return blocks;
}
@@ -33,21 +43,24 @@ test('Stories never hides GEV’s required credit line', () => {
selector,
);
}
// The rule that hides GEV's chrome while Stories is open exempts the credit.
assert.match(
css,
/body\.stories-mode\s*>\s*:not\([^)]*\[id='cesium-credits'\]/,
);
// The rule that hides GEV's chrome while Stories is open exempts the
// credit, whichever display shows it, and the application's credit list.
for (const id of ['cesium-credits', 'gev-credits', 'gev-credits-panel'])
assert.match(
css,
new RegExp(`body\\.stories-mode\\s*>\\s*:not\\([^)]*\\[id='${id}'\\]`),
id,
);
});
test('a playing scene’s recording mode cannot move the credit under the timeline', () => {
const placement = creditBlocks().find(
({ selector, body }) =>
/^body\.stories-mode:not\(#gs-a\):not\(#gs-b\)\s+#cesium-credits$/.test(
selector,
({ selectors, body }) =>
['cesium-credits', 'gev-credits'].every((id) =>
selectors.includes(`body.stories-mode:not(#gs-a):not(#gs-b) #${id}`),
) && /bottom\s*:/.test(body),
);
assert.ok(placement, 'Stories pins the credit line');
assert.ok(placement, 'Stories pins the credit line, either display');
// Two ids outrank body.recording-mode #cesium-credits and the phone shell's
// !important rule (one id each), so the measured place holds while playing.
assert.match(
+24 -5
View File
@@ -3726,17 +3726,28 @@
/* ── Bridge: the prototype's layout over GEV's own Cesium globe ── */
/* GEV's own chrome steps aside while Stories is open; the globe and its
credits stay. */
credits stay: the renderer's own credit display, or the application's
credit line and its list (src/ui/creditsView.js) where it has none. */
body.stories-mode
> :not(
#gev-stories-host,
.gev-view,
[id='cesium-credits'],
[id='gev-credits'],
[id='gev-credits-panel'],
script,
style,
link
),
body.stories-mode > :not(#gev-stories-host, .gev-view, [id='cesium-credits']) *,
body.stories-mode
> :not(
#gev-stories-host,
.gev-view,
[id='cesium-credits'],
[id='gev-credits'],
[id='gev-credits-panel']
)
*,
body.stories-mode .gev-view > :not(#cesiumContainer):not(#gev-stories),
body.stories-mode .gev-view > :not(#cesiumContainer):not(#gev-stories) *,
body.stories-mode #cesiumContainer > :not(.cesium-viewer),
@@ -3788,22 +3799,30 @@ body.stories-mode #cesiumContainer > :not(.cesium-viewer) * {
measures it, in every GEV mode: a playing scene's recording mode and the
phone shell both move it, the phone shell with !important. The :not(#…)
parts outrank those rules. */
body.stories-mode:not(#gs-a):not(#gs-b) #cesium-credits {
body.stories-mode:not(#gs-a):not(#gs-b) #cesium-credits,
body.stories-mode:not(#gs-a):not(#gs-b) #gev-credits {
right: auto !important;
bottom: var(--gs-credit-bottom, 36px) !important;
left: var(--gs-credit-left, 36px) !important;
}
/* The application's credit list opens just above its line, wherever that is. */
body.stories-mode:not(#gs-a):not(#gs-b) .gev-credits-panel {
bottom: calc(var(--gs-credit-bottom, 36px) + 24px);
left: var(--gs-credit-left, 36px);
}
/* On a phone the line wraps and shrinks to stay on screen, as the phone
shell does outside recording mode. */
@media (max-width: 700px) {
body.stories-mode:not(#gs-a):not(#gs-b) #cesium-credits {
body.stories-mode:not(#gs-a):not(#gs-b) #cesium-credits,
body.stories-mode:not(#gs-a):not(#gs-b) #gev-credits {
width: calc((100vw - 20px) / 0.8) !important;
max-width: none !important;
white-space: normal;
transform-origin: left bottom;
scale: 0.8;
}
body.stories-mode:not(#gs-a):not(#gs-b) #cesium-credits a {
body.stories-mode:not(#gs-a):not(#gs-b) #cesium-credits a,
body.stories-mode:not(#gs-a):not(#gs-b) #gev-credits a {
white-space: nowrap;
}
}