From fec84dbf788cd96152036f4ec1d580b38eab49d9 Mon Sep 17 00:00:00 2001 From: Manjunath <301209272+manjunath22466@users.noreply.github.com> Date: Mon, 16 Nov 2026 22:35:07 +0530 Subject: [PATCH] Address Stories review feedback --- docs/CURRENT-STATE.md | 15 +- docs/SCENE-DOCUMENT.md | 18 +- package.json | 1 + scripts/qa-stories.mjs | 126 +++++++++++++ src/app/tools.js | 9 +- src/creditAttribution.test.mjs | 4 +- src/director/camera.test.mjs | 2 +- src/director/document.js | 8 +- src/director/document.test.mjs | 2 +- src/director/packs/packs.test.mjs | 2 +- src/i18n/locales/ar.json | 2 + src/i18n/locales/de.json | 2 + src/i18n/locales/es.json | 2 + src/i18n/locales/fr.json | 2 + src/i18n/locales/he.json | 2 + src/i18n/locales/it.json | 2 + src/i18n/locales/ja.json | 2 + src/i18n/locales/pt.json | 2 + src/i18n/locales/ru.json | 2 + src/i18n/locales/sv.json | 2 + src/i18n/locales/uk.json | 2 + src/i18n/locales/zh-CN.json | 2 + src/i18n/locales/zh-Hant.json | 2 + src/scenes/director.js | 32 +++- src/scenes/director.test.mjs | 44 ++++- src/scenes/storyThumb.js | 27 ++- src/stories/boot.js | 8 + src/stories/boot.test.mjs | 23 ++- src/stories/catalog.js | 31 ++-- src/stories/controller.js | 236 +++++++++++++++++-------- src/stories/controller.test.mjs | 63 +++++++ src/stories/format.js | 2 +- src/stories/thumbs.js | 20 ++- src/ui/sceneControls.js | 1 + src/ui/sceneControls.test.mjs | 28 ++- src/ui/stores/scenes.js | 1 + src/ui/storiesView.test.mjs | 71 ++++++++ src/ui/styles/scenes.css | 5 + src/ui/styles/stories-entry.css | 2 +- src/ui/styles/stories.css | 44 ++--- src/ui/views/LayerPanelsView.vue | 13 ++ src/ui/views/StoriesView.vue | 20 ++- src/ui/views/stories/ExploreScreen.vue | 22 +-- src/ui/views/stories/StoriesHeader.vue | 9 +- src/ui/views/stories/StoryContext.vue | 2 +- src/ui/views/stories/StoryScreen.vue | 6 +- src/ui/views/stories/StoryTimeline.vue | 79 +++------ src/voice/session.test.mjs | 13 ++ 48 files changed, 783 insertions(+), 232 deletions(-) create mode 100644 scripts/qa-stories.mjs create mode 100644 src/ui/storiesView.test.mjs diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 383101097..9b6c65966 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -687,7 +687,8 @@ first (`SceneDirector.storyScenes()`, refreshed on every `stories-changed`), then the person's other scenes with a shot as drafts (`SceneDirector.draftScenes()`, marked DRAFT), then the scenes GEV ships with a camera path while they are in the project -(`SceneDirector.hasScene`). A saved scene brings the card image and topics +(`SceneDirector.hasScene`). Zero-shot drafts can be reopened or deleted +from the scene selector in AUTHORING after a reload. A saved scene brings the card image and topics picked for it in AUTHORING; the topic chips use AUTHORING's tag names and order. Explore opens at country level (2,500 km) over the first story and, while idle, flies on to the next story @@ -710,7 +711,9 @@ story's place (`src/stories/thumbs.js`: the same Web Mercator tiles, from the same host, that GEV's Esri map draws, read as images) unless the scene has its own; with any other map stack than Esri Satellite (`mapStackController.getActiveId()`) the card shows its placeholder, and a -card drawn from Esri earlier is dropped. A shot +card drawn from Esri earlier is dropped. AUTHORING captures thumbnails only +on a ready Esri World Imagery stack and embeds the imagery credit in the +exported image. A shot tied to an anchor rather than a place pins the whole-globe view. A shipped story's context comes from what GEV knows about it @@ -721,7 +724,10 @@ facts and sources (Vantor imagery and the GeoPera reconstruction, CC BY-NC 4.0), and its key moments are the chapters that show them. Topic chips and region choices are the ones the listed stories carry. Closing Stories after a story played puts AUTHORING's own selection back (usually none); -Open in GEV leaves the story's scene selected there. A paused link in the +Open in GEV leaves the story's scene selected there. Entering Stories +cancels in-flight Authoring work before it captures the view it will +restore. Dragging the timeline previews the time, and releasing +it seeks the globe once. A paused link in the final quarter-second retains its final shot on Play instead of restarting at the first shot. A scene that has actually ended still replays from the beginning; SceneDirector resumes from the shot boundary, not a fractional @@ -1630,7 +1636,8 @@ holds; stale tick callbacks cannot publish into a replacement. Registered pack rules own presentation overrides and Nepal map fallback without changing saved shots or content. Scene-document validation and legacy migration now have separate owners. Invalid imports preserve the current project; unreadable saved projects -are protected from fallback writes. Version 6 is the export format, with +are protected from fallback writes. Version 7 adds Scenes' optional Stories +metadata and reads prior project files, including version 6 drafts, with zero pitch, low camera heights, scope and detection edits preserved. See [the document contract](SCENE-DOCUMENT.md); see [Director](DIRECTOR.md) for camera, pack, action and sharing support. diff --git a/docs/SCENE-DOCUMENT.md b/docs/SCENE-DOCUMENT.md index b96896024..dd4ff9b18 100644 --- a/docs/SCENE-DOCUMENT.md +++ b/docs/SCENE-DOCUMENT.md @@ -1,13 +1,14 @@ # Scene document format -Authoring exports a UTF-8 JSON project. Version 5 adds [data packs](DIRECTOR-DATA-PACKS.md) -and is the write format. Versions 1, 2, 3, 4 and unversioned legacy files migrate on -import without converting their existing shots into authored moves. Unknown versions or unsupported fields are rejected with -a field path before the current project, selection or saved bytes change. +Authoring exports a UTF-8 JSON project. Version 7 records Stories metadata. +Versions 1 through 6 and unversioned legacy files migrate on import, including +version 6 projects written by early Stories builds. Existing shots keep their +camera behavior. Unknown versions or unsupported fields are rejected with a +field path before the current project, selection or saved bytes change. ```json { - "version": 5, + "version": 7, "scenes": [{ "id": "my-scene", "title": "My scene", @@ -33,6 +34,9 @@ Each scene requires a `shots` array; optional fields are `id`, `title`, `releaseLayerIds`, `appliedShotPacks` and version-4 `anchors`. A pack marker has `id`, optional numeric `version` and `shotBindings` (original shot title to saved shot ID). These markers retain the editor's existing pack-update and rename behavior. +Scenes may include `stories` (true when saved to Stories), `storyThumb` +(a JPEG or PNG data URL of at most 300,000 characters) and `storyTags` (up to +five supported topic keys). Shots accept `id`, `title`, `durationSec`, `holdSec`, `camera`, `visual`, `layers`, `sourcePackId`, `sourcePackVersion` and version-4 `move`. Scene IDs are unique within the project; @@ -75,8 +79,8 @@ UTF-8 size before JSON decoding; the file importer also checks file size before reading it. Migration/defaults live separately in `src/scenes/project.js`. Limits are 5 MiB, 256 scenes, 10,000 total shots, 10,000 entries per collection, -24 levels of nesting, 200,000 visited values, 65,536 characters per JSON string, -256 characters per field/ID, and 4,096 characters per title. Numeric values must +24 levels of nesting, 200,000 visited values, 65,536 characters per JSON string +(300,000 for a Stories thumbnail), 256 characters per field/ID, and 4,096 characters per title. Numeric values must be finite. Camera limits are latitude ±90, longitude ±180, altitude −12,000 to 1 billion meters, heading/roll ±360 and pitch ±90; durations/holds are at most 86,400 seconds. Post-processing values are bounded and normalized to the existing diff --git a/package.json b/package.json index 1a7f64a6d..e76356a1f 100644 --- a/package.json +++ b/package.json @@ -55,6 +55,7 @@ "test:track": "node scripts/track-regression.mjs", "qa:stub-boot": "node scripts/qa-stub-boot.mjs", "qa:conformance": "node scripts/qa-conformance.mjs", + "qa:stories": "node scripts/qa-stories.mjs", "qa:map-source-tray": "node scripts/qa-map-source-tray.mjs", "qa:street-level": "node scripts/qa-street-level.mjs", "qa:street-level:fixtures": "node scripts/qa-street-level.mjs --fixtures", diff --git a/scripts/qa-stories.mjs b/scripts/qa-stories.mjs new file mode 100644 index 000000000..bc62ea2c1 --- /dev/null +++ b/scripts/qa-stories.mjs @@ -0,0 +1,126 @@ +/** Run against the built app's preview server (QA_BASE_URL, port 4173 by default). */ +import assert from 'node:assert/strict'; +import puppeteer from 'puppeteer'; + +const browser = await puppeteer.launch({ + headless: true, + args: [ + '--no-sandbox', + ...(process.platform === 'darwin' + ? ['--use-angle=metal', '--enable-gpu'] + : ['--use-gl=angle', '--use-angle=swiftshader']), + ], +}); + +try { + const page = await browser.newPage(); + await page.setViewport({ width: 1440, height: 900 }); + await page.emulateMediaFeatures([ + { name: 'prefers-reduced-motion', value: 'reduce' }, + ]); + const url = new URL(process.env.QA_BASE_URL || 'http://localhost:4173/'); + url.searchParams.set('welcome', '0'); + url.searchParams.set('story', 'gev:flights-radar'); + url.searchParams.set('storyTime', '1250'); + url.hash = + 'v=2&lat=20&lon=10&alt=2500000&heading=0&pitch=-90&roll=0&style=normal&map=esri-imagery'; + await page.goto(url.href, { waitUntil: 'domcontentloaded' }); + + async function waitForPausedStory() { + await page.waitForSelector('#tlTrack', { visible: true, timeout: 60000 }); + await page.waitForFunction( + () => window.__godsEyeView?.styleManager.activeStyle === 'retro', + { timeout: 30000 }, + ); + const timing = await page.evaluate(async () => { + const director = window.__godsEyeView.sceneDirector; + await director.whenIdle(); + return { + elapsed: director.getPlaybackTimingState().snapshot.sceneElapsedSec, + running: director.running, + }; + }); + assert.equal(timing.running, false); + assert.ok(Math.abs(timing.elapsed - 1.25) < 0.001); + } + + await waitForPausedStory(); + await page.evaluate(() => history.back()); + await page.waitForSelector('#scrExplore', { visible: true }); + await page.waitForFunction( + () => window.__godsEyeView.styleManager.activeStyle === 'normal', + ); + await page.evaluate(() => history.forward()); + await waitForPausedStory(); + await page.waitForFunction(() => + document.activeElement.matches( + '#scrStory .s-back, #scrStory .s-trail button', + ), + ); + console.log('Back and Forward restore the style, paused time and focus'); + + const track = await page.$('#tlTrack'); + const box = await track.boundingBox(); + assert.ok(box.width > 0); + await page.evaluate(() => { + const director = window.__godsEyeView.sceneDirector; + const seek = director.seekScene.bind(director); + window.qaSeekProgress = []; + director.seekScene = (...args) => { + window.qaSeekProgress.push(args[1]); + return seek(...args); + }; + }); + const y = box.y + box.height / 2; + const at = (fraction) => box.x + box.width * fraction; + await page.mouse.move(at(0.25), y); + await page.mouse.down(); + await page.mouse.move(at(0.65), y, { steps: 12 }); + await page.waitForFunction( + () => + Number(document.querySelector('#tlTrack').getAttribute('aria-valuenow')) > + 25, + ); + assert.deepEqual(await page.evaluate(() => window.qaSeekProgress), []); + await page.mouse.up(); + await page.waitForFunction(() => window.qaSeekProgress.length === 1); + await page.evaluate(() => window.__godsEyeView.sceneDirector.whenIdle()); + assert.equal(await page.evaluate(() => window.qaSeekProgress.length), 1); + console.log('A timeline drag updates the preview before one released seek'); + + const pose = () => + page.evaluate(() => window.__godsEyeView.styleManager.getCameraState()); + const before = await pose(); + await page.click('#railGev'); + await page.waitForFunction( + () => + !document.body.classList.contains('stories-mode') && + document + .querySelector('#scene-name') + ?.textContent.includes('Global Flights Radar'), + ); + const after = await pose(); + assert.ok(Math.abs(after.lat - before.lat) < 0.01); + assert.ok(Math.abs(after.lon - before.lon) < 0.01); + assert.ok(Math.abs(after.alt - before.alt) < 100); + await page.waitForFunction(() => document.activeElement.id === 'hStories'); + console.log('Open in GEV selects the scene without moving its camera'); + await page.click('#scene-thumb-btn'); + await page.waitForFunction(() => + document + .querySelector('#scene-thumb-preview') + ?.src.startsWith('data:image/jpeg;'), + ); + console.log('Authoring captures an Esri thumbnail through the real renderer'); + + // This width is within GEV's phone layout and used to miss Stories' layout. + await page.setViewport({ width: 710, height: 844 }); + await page.goto(url.href, { waitUntil: 'domcontentloaded' }); + await waitForPausedStory(); + await page.waitForFunction(() => + document.activeElement.matches('#scrStory .s-back'), + ); + console.log('The phone layout uses the same breakpoint as GEV'); +} finally { + await browser.close(); +} diff --git a/src/app/tools.js b/src/app/tools.js index e35d861cf..7709a3f85 100644 --- a/src/app/tools.js +++ b/src/app/tools.js @@ -1,5 +1,5 @@ import { onFollowChanged } from '../data/followed.js'; -import { bootStories } from '../stories/boot.js'; +import { bootStories, stopVoiceForStories } from '../stories/boot.js'; import { t } from '../i18n/index.js'; import { useStoriesStore } from '../ui/stores/stories.js'; import { SceneDirector } from '../scenes/director.js'; @@ -91,12 +91,7 @@ export function createApplicationTools({ director: sceneDirector, store: storiesStore, onEnter: () => { - const session = voiceCommands?.session; - // A typed command can finish its reply without keeping a microphone on. - if (!session || session.adapter.getStartOptions?.().textOnly) return; - const wasActive = session.isActive(); - session.stop(); - if (wasActive) + if (stopVoiceForStories(voiceCommands?.session)) storiesStore.flashToast(t('Voice is disabled in Stories.'), 4000); }, onLoadFailed: () => diff --git a/src/creditAttribution.test.mjs b/src/creditAttribution.test.mjs index 5478be3ec..5dafd1ec8 100644 --- a/src/creditAttribution.test.mjs +++ b/src/creditAttribution.test.mjs @@ -267,7 +267,9 @@ function ownBoxEntries() { if (part.startsWith('body.mobile-shell')) continue; // So is Stories, with GEV's chrome stepped aside; storiesCredit.test.mjs // pins its attribution placement. - if (part.startsWith('body.stories-mode')) continue; + if ( + /^body\.stories-mode:not\(#gs-a\):not\(#gs-b\) #(cesium|gev)-credits$/.test(part) + ) continue; entries.push({ rule, part }); } } diff --git a/src/director/camera.test.mjs b/src/director/camera.test.mjs index cf7c43bb0..365a98509 100644 --- a/src/director/camera.test.mjs +++ b/src/director/camera.test.mjs @@ -73,7 +73,7 @@ test('v3 unversioned bloom already uses scale 2 and is not migrated again in lat }), ), ); - assert.equal(project.version, 6); + assert.equal(project.version, 7); assert.equal(project.scenes[0].shots[0].visual.bloom.intensity, 50); }); test('move endpoints, easing, shortest arcs and hold agree with scene seeking', () => { diff --git a/src/director/document.js b/src/director/document.js index 3ce344bfc..b871dd08b 100644 --- a/src/director/document.js +++ b/src/director/document.js @@ -18,7 +18,7 @@ export { SCENE_DOCUMENT_LIMITS, SceneDocumentError } from './documentFields.js'; import { validateSceneInteractions } from './interactions/document.js'; import { STORY_TAG_LIMIT, isStoryTagList } from '../scenes/storyTags.js'; import { STORY_THUMB_MAX_LENGTH, isStoryThumb } from '../scenes/storyThumb.js'; -export const SCENE_DOCUMENT_VERSION = 6; +export const SCENE_DOCUMENT_VERSION = 7; function visual(value, path, legacy) { fields(value, path, [ @@ -74,7 +74,11 @@ export function validateSceneDocument(project) { 'scenes', ]); const version = Object.hasOwn(project, 'version') ? project.version : 1; - if (![1, 2, 3, 4, 5, 6].includes(version)) + if ( + !Number.isInteger(version) || + version < 1 || + version > SCENE_DOCUMENT_VERSION + ) fail('$.version', 'unsupported scene project version'); const legacy = version < 3; for (const key of ['createdAt', 'updatedAt']) diff --git a/src/director/document.test.mjs b/src/director/document.test.mjs index 9294abb7b..0a73f98ed 100644 --- a/src/director/document.test.mjs +++ b/src/director/document.test.mjs @@ -59,7 +59,7 @@ test('v1/v2 bloom migrates once; IDs, edits, pack bindings and zero holds surviv const migrated = normalizeProject( parseSceneDocument(JSON.stringify(project)), ); - assert.equal(migrated.version, 6); + assert.equal(migrated.version, 7); assert.equal(migrated.scenes[0].shots[0].visual.bloom.intensity, 150); assert.equal(migrated.scenes[0].shots[0].id, 'shot'); assert.deepEqual( diff --git a/src/director/packs/packs.test.mjs b/src/director/packs/packs.test.mjs index ed5d42500..76545219e 100644 --- a/src/director/packs/packs.test.mjs +++ b/src/director/packs/packs.test.mjs @@ -51,7 +51,7 @@ test('v5 packs and shot references round trip through project migration without JSON.stringify({ version, scenes: [{ id: 'old', shots: [] }] }), ), ); - assert.equal(old.version, 6); + assert.equal(old.version, 7); assert.equal(old.scenes[0].dataPacks, undefined); } }); diff --git a/src/i18n/locales/ar.json b/src/i18n/locales/ar.json index c31e12f58..5c205a2d5 100644 --- a/src/i18n/locales/ar.json +++ b/src/i18n/locales/ar.json @@ -4104,6 +4104,7 @@ "Stories could not load. Check the connection and try again.": "تعذّر تحميل القصص. تحقّق من الاتصال ثم حاول مرة أخرى.", "Shot {n} of {total}": "لقطة {n} من {total}", "GEV scene": "مشهد GEV", + "Empty drafts": "المسودات الفارغة", "No scene yet": "لا يوجد مشهد بعد", "SAVE TO STORIES": "حفظ في STORIES", "REMOVE FROM STORIES": "إزالة من STORIES", @@ -4120,6 +4121,7 @@ "Space": "الفضاء", "Conflict": "نزاعات", "Climate": "المناخ", + "Switch to Esri World Imagery to capture a thumbnail": "انتقل إلى صور Esri World Imagery لالتقاط صورة مصغّرة", "Thumbnail could not be captured": "تعذّر التقاط الصورة المصغّرة", "Thumbnail captured": "تم التقاط الصورة المصغّرة", "Stories tags": "وسوم القصص", diff --git a/src/i18n/locales/de.json b/src/i18n/locales/de.json index 3f5ef6fe0..9494cf7a5 100644 --- a/src/i18n/locales/de.json +++ b/src/i18n/locales/de.json @@ -3744,6 +3744,7 @@ "Stories could not load. Check the connection and try again.": "Storys konnten nicht geladen werden. Prüfen Sie die Verbindung und versuchen Sie es erneut.", "Shot {n} of {total}": "Aufnahme {n} von {total}", "GEV scene": "GEV-Szene", + "Empty drafts": "Leere Entwürfe", "No scene yet": "Noch keine Szene", "SAVE TO STORIES": "IN STORIES SPEICHERN", "REMOVE FROM STORIES": "AUS STORIES ENTFERNEN", @@ -3760,6 +3761,7 @@ "Space": "Weltraum", "Conflict": "Konflikte", "Climate": "Klima", + "Switch to Esri World Imagery to capture a thumbnail": "Zum Erfassen eines Vorschaubilds zu Esri World Imagery wechseln", "Thumbnail could not be captured": "Vorschaubild konnte nicht aufgenommen werden", "Thumbnail captured": "Vorschaubild aufgenommen", "Stories tags": "Stories-Schlagwörter", diff --git a/src/i18n/locales/es.json b/src/i18n/locales/es.json index c837a8d9d..50fca21fd 100644 --- a/src/i18n/locales/es.json +++ b/src/i18n/locales/es.json @@ -3834,6 +3834,7 @@ "Stories could not load. Check the connection and try again.": "No se pudieron cargar las Historias. Comprueba la conexión e inténtalo de nuevo.", "Shot {n} of {total}": "Plano {n} de {total}", "GEV scene": "Escena de GEV", + "Empty drafts": "Borradores vacíos", "No scene yet": "Aún no hay escena", "SAVE TO STORIES": "GUARDAR EN STORIES", "REMOVE FROM STORIES": "QUITAR DE STORIES", @@ -3850,6 +3851,7 @@ "Space": "Espacio", "Conflict": "Conflictos", "Climate": "Clima", + "Switch to Esri World Imagery to capture a thumbnail": "Cambia a Esri World Imagery para capturar una miniatura", "Thumbnail could not be captured": "No se pudo capturar la miniatura", "Thumbnail captured": "Miniatura capturada", "Stories tags": "Etiquetas de Stories", diff --git a/src/i18n/locales/fr.json b/src/i18n/locales/fr.json index ca2dfae59..e40948f40 100644 --- a/src/i18n/locales/fr.json +++ b/src/i18n/locales/fr.json @@ -3834,6 +3834,7 @@ "Stories could not load. Check the connection and try again.": "Impossible de charger les Récits. Vérifiez la connexion et réessayez.", "Shot {n} of {total}": "Plan {n} sur {total}", "GEV scene": "Scène GEV", + "Empty drafts": "Brouillons vides", "No scene yet": "Aucune scène pour l'instant", "SAVE TO STORIES": "ENREGISTRER DANS STORIES", "REMOVE FROM STORIES": "RETIRER DE STORIES", @@ -3850,6 +3851,7 @@ "Space": "Espace", "Conflict": "Conflits", "Climate": "Climat", + "Switch to Esri World Imagery to capture a thumbnail": "Passez à Esri World Imagery pour capturer une miniature", "Thumbnail could not be captured": "Impossible de capturer la miniature", "Thumbnail captured": "Miniature capturée", "Stories tags": "Tags Stories", diff --git a/src/i18n/locales/he.json b/src/i18n/locales/he.json index 838200552..d8e338e82 100644 --- a/src/i18n/locales/he.json +++ b/src/i18n/locales/he.json @@ -3834,6 +3834,7 @@ "Stories could not load. Check the connection and try again.": "לא ניתן לטעון את הסיפורים. בדוק את החיבור ונסה שוב.", "Shot {n} of {total}": "שוט {n} מתוך {total}", "GEV scene": "סצנת GEV", + "Empty drafts": "טיוטות ריקות", "No scene yet": "עדיין אין סצנה", "SAVE TO STORIES": "שמירה ב-STORIES", "REMOVE FROM STORIES": "הסרה מ-STORIES", @@ -3850,6 +3851,7 @@ "Space": "חלל", "Conflict": "סכסוכים", "Climate": "אקלים", + "Switch to Esri World Imagery to capture a thumbnail": "כדי לצלם תמונה ממוזערת, עברו אל Esri World Imagery", "Thumbnail could not be captured": "לא ניתן היה ללכוד את התמונה הממוזערת", "Thumbnail captured": "התמונה הממוזערת נלכדה", "Stories tags": "תגיות סיפורים", diff --git a/src/i18n/locales/it.json b/src/i18n/locales/it.json index b0e3df729..53030602a 100644 --- a/src/i18n/locales/it.json +++ b/src/i18n/locales/it.json @@ -3834,6 +3834,7 @@ "Stories could not load. Check the connection and try again.": "Impossibile caricare le Storie. Controlla la connessione e riprova.", "Shot {n} of {total}": "Scatto {n} di {total}", "GEV scene": "Scena GEV", + "Empty drafts": "Bozze vuote", "No scene yet": "Ancora nessuna scena", "SAVE TO STORIES": "SALVA IN STORIES", "REMOVE FROM STORIES": "RIMUOVI DA STORIES", @@ -3850,6 +3851,7 @@ "Space": "Spazio", "Conflict": "Conflitti", "Climate": "Clima", + "Switch to Esri World Imagery to capture a thumbnail": "Passa a Esri World Imagery per acquisire una miniatura", "Thumbnail could not be captured": "Impossibile acquisire la miniatura", "Thumbnail captured": "Miniatura acquisita", "Stories tags": "Tag delle Stories", diff --git a/src/i18n/locales/ja.json b/src/i18n/locales/ja.json index c89fc74f6..6b3f24206 100644 --- a/src/i18n/locales/ja.json +++ b/src/i18n/locales/ja.json @@ -3654,6 +3654,7 @@ "Stories could not load. Check the connection and try again.": "ストーリーを読み込めませんでした。接続を確認して、もう一度お試しください。", "Shot {n} of {total}": "ショット {n}/{total}", "GEV scene": "GEVシーン", + "Empty drafts": "空の下書き", "No scene yet": "シーンはまだありません", "SAVE TO STORIES": "STORIESに保存", "REMOVE FROM STORIES": "STORIESから外す", @@ -3670,6 +3671,7 @@ "Space": "宇宙", "Conflict": "紛争", "Climate": "気候", + "Switch to Esri World Imagery to capture a thumbnail": "サムネイルを取得するには Esri World Imagery に切り替えてください", "Thumbnail could not be captured": "サムネイルを取得できませんでした", "Thumbnail captured": "サムネイルを取得しました", "Stories tags": "ストーリーのタグ", diff --git a/src/i18n/locales/pt.json b/src/i18n/locales/pt.json index 93fa6f71e..b155e7699 100644 --- a/src/i18n/locales/pt.json +++ b/src/i18n/locales/pt.json @@ -3834,6 +3834,7 @@ "Stories could not load. Check the connection and try again.": "Não foi possível carregar as Histórias. Verifique a conexão e tente novamente.", "Shot {n} of {total}": "Plano {n} de {total}", "GEV scene": "Cena do GEV", + "Empty drafts": "Rascunhos vazios", "No scene yet": "Nenhuma cena ainda", "SAVE TO STORIES": "SALVAR EM STORIES", "REMOVE FROM STORIES": "REMOVER DE STORIES", @@ -3850,6 +3851,7 @@ "Space": "Espaço", "Conflict": "Conflitos", "Climate": "Clima", + "Switch to Esri World Imagery to capture a thumbnail": "Mude para o Esri World Imagery para capturar uma miniatura", "Thumbnail could not be captured": "Não foi possível capturar a miniatura", "Thumbnail captured": "Miniatura capturada", "Stories tags": "Tags do Stories", diff --git a/src/i18n/locales/ru.json b/src/i18n/locales/ru.json index d87a19226..2f699dfb7 100644 --- a/src/i18n/locales/ru.json +++ b/src/i18n/locales/ru.json @@ -3924,6 +3924,7 @@ "Stories could not load. Check the connection and try again.": "Не удалось загрузить Истории. Проверьте подключение и повторите попытку.", "Shot {n} of {total}": "Кадр {n} из {total}", "GEV scene": "Сцена GEV", + "Empty drafts": "Пустые черновики", "No scene yet": "Сцены пока нет", "SAVE TO STORIES": "СОХРАНИТЬ В STORIES", "REMOVE FROM STORIES": "УБРАТЬ ИЗ STORIES", @@ -3940,6 +3941,7 @@ "Space": "Космос", "Conflict": "Конфликты", "Climate": "Климат", + "Switch to Esri World Imagery to capture a thumbnail": "Переключитесь на Esri World Imagery, чтобы создать миниатюру", "Thumbnail could not be captured": "Не удалось снять миниатюру", "Thumbnail captured": "Миниатюра снята", "Stories tags": "Теги Stories", diff --git a/src/i18n/locales/sv.json b/src/i18n/locales/sv.json index e1976a8a5..e15bc2cc1 100644 --- a/src/i18n/locales/sv.json +++ b/src/i18n/locales/sv.json @@ -3744,6 +3744,7 @@ "Stories could not load. Check the connection and try again.": "Berättelser kunde inte läsas in. Kontrollera anslutningen och försök igen.", "Shot {n} of {total}": "Tagning {n} av {total}", "GEV scene": "GEV-scen", + "Empty drafts": "Tomma utkast", "No scene yet": "Ingen scen ännu", "SAVE TO STORIES": "SPARA I STORIES", "REMOVE FROM STORIES": "TA BORT FRÅN STORIES", @@ -3760,6 +3761,7 @@ "Space": "Rymden", "Conflict": "Konflikter", "Climate": "Klimat", + "Switch to Esri World Imagery to capture a thumbnail": "Byt till Esri World Imagery för att ta en miniatyrbild", "Thumbnail could not be captured": "Miniatyrbilden kunde inte tas", "Thumbnail captured": "Miniatyrbild tagen", "Stories tags": "Taggar för Stories", diff --git a/src/i18n/locales/uk.json b/src/i18n/locales/uk.json index 14d32aec3..1047e7a84 100644 --- a/src/i18n/locales/uk.json +++ b/src/i18n/locales/uk.json @@ -3924,6 +3924,7 @@ "Stories could not load. Check the connection and try again.": "Не вдалося завантажити Історії. Перевірте з’єднання та спробуйте ще раз.", "Shot {n} of {total}": "Кадр {n} з {total}", "GEV scene": "Сцена GEV", + "Empty drafts": "Порожні чернетки", "No scene yet": "Сцени ще немає", "SAVE TO STORIES": "ЗБЕРЕГТИ В STORIES", "REMOVE FROM STORIES": "ПРИБРАТИ ЗІ STORIES", @@ -3940,6 +3941,7 @@ "Space": "Космос", "Conflict": "Конфлікти", "Climate": "Клімат", + "Switch to Esri World Imagery to capture a thumbnail": "Перемкніться на Esri World Imagery, щоб створити мініатюру", "Thumbnail could not be captured": "Не вдалося зняти мініатюру", "Thumbnail captured": "Мініатюру знято", "Stories tags": "Теги Stories", diff --git a/src/i18n/locales/zh-CN.json b/src/i18n/locales/zh-CN.json index 08926db8b..2697e08fd 100644 --- a/src/i18n/locales/zh-CN.json +++ b/src/i18n/locales/zh-CN.json @@ -3654,6 +3654,7 @@ "Stories could not load. Check the connection and try again.": "无法加载故事。请检查网络连接后重试。", "Shot {n} of {total}": "镜头 {n}/{total}", "GEV scene": "GEV 场景", + "Empty drafts": "空草稿", "No scene yet": "尚无场景", "SAVE TO STORIES": "保存到 STORIES", "REMOVE FROM STORIES": "从 STORIES 移除", @@ -3670,6 +3671,7 @@ "Space": "太空", "Conflict": "冲突", "Climate": "气候", + "Switch to Esri World Imagery to capture a thumbnail": "请切换至 Esri World Imagery 以截取缩略图", "Thumbnail could not be captured": "无法截取缩略图", "Thumbnail captured": "已截取缩略图", "Stories tags": "故事标签", diff --git a/src/i18n/locales/zh-Hant.json b/src/i18n/locales/zh-Hant.json index eea3781dc..333f3a2be 100644 --- a/src/i18n/locales/zh-Hant.json +++ b/src/i18n/locales/zh-Hant.json @@ -3654,6 +3654,7 @@ "Stories could not load. Check the connection and try again.": "無法載入故事。請檢查網路連線後重試。", "Shot {n} of {total}": "鏡頭 {n}/{total}", "GEV scene": "GEV 場景", + "Empty drafts": "空白草稿", "No scene yet": "尚無場景", "SAVE TO STORIES": "儲存到 STORIES", "REMOVE FROM STORIES": "從 STORIES 移除", @@ -3670,6 +3671,7 @@ "Space": "太空", "Conflict": "衝突", "Climate": "氣候", + "Switch to Esri World Imagery to capture a thumbnail": "請切換至 Esri World Imagery 以擷取縮圖", "Thumbnail could not be captured": "無法擷取縮圖", "Thumbnail captured": "已擷取縮圖", "Stories tags": "故事標籤", diff --git a/src/scenes/director.js b/src/scenes/director.js index 9401c8cc3..18695fea1 100644 --- a/src/scenes/director.js +++ b/src/scenes/director.js @@ -26,6 +26,7 @@ import { cameraOf, canvasOf, findCamera, + findCredits, findFrame, } from '../render/rendererOf.js'; import { @@ -455,6 +456,7 @@ export class SceneDirector { hasRun: !!this._lastRunJson, }), actions: { + selectScene: (id) => this.selectShot(id), selectShot: (id) => { this._selectedShotId = id; this._publish({ type: 'selection-changed' }); @@ -637,11 +639,29 @@ export class SceneDirector { async captureSceneThumb() { const scene = this._getSelectedScene(); if (!scene || this._destroyed) return false; + const canCapture = () => { + const map = this.styleManager.mapStackController?.getState(); + return map?.activeId === 'esri-imagery' && map.status === 'ready'; + }; + if (!canCapture()) { + this._updateStatus(() => + t('Switch to Esri World Imagery to capture a thumbnail'), + ); + return false; + } let thumb; try { thumb = await captureStoryThumb( { frame: findFrame(this.viewer), canvas: canvasOf(this.viewer) }, - { createCanvas: () => document.createElement('canvas') }, + { + createCanvas: () => document.createElement('canvas'), + creditForFrame: () => + canCapture() + ? findCredits(this.viewer) + ?.list() + .find(({ text }) => text.startsWith('Powered by Esri'))?.text + : null, + }, ); } catch (error) { console.warn('[Scenes] Could not capture the thumbnail:', error); @@ -649,6 +669,11 @@ export class SceneDirector { this._updateStatus(() => t('Thumbnail could not be captured')); return false; } + if (!thumb) { + if (!this._destroyed) + this._updateStatus(() => t('Thumbnail could not be captured')); + return false; + } // The scene may have gone while the frame was drawn. if (this._destroyed || !this._project.scenes.includes(scene)) return false; return this.setSceneStoryThumb(scene.id, thumb); @@ -2121,6 +2146,11 @@ export class SceneDirector { return this._running; } + /** Whether an existing run, LOAD, seek or interaction still owns work. */ + get busy() { + return this.running || Boolean(this._pendingWork?.size); + } + /** * Start a full scene run beginning at the given scene. * diff --git a/src/scenes/director.test.mjs b/src/scenes/director.test.mjs index e98582db2..15dcb0ec8 100644 --- a/src/scenes/director.test.mjs +++ b/src/scenes/director.test.mjs @@ -1905,7 +1905,7 @@ test('unsupported stored documents cannot be overwritten by fallback edits', asy assert.equal(localStorage.getItem('godsEyeView.sceneProject.v2'), saved); await director.importProjectFile({ name: 'valid.json', text: async () => JSON.stringify(PROJECT_FIXTURE) }); assert.equal(director._storageReadError, null); - assert.equal(JSON.parse(localStorage.getItem('godsEyeView.sceneProject.v2')).version, 6); + assert.equal(JSON.parse(localStorage.getItem('godsEyeView.sceneProject.v2')).version, 7); } finally { restore(); } }); @@ -2499,7 +2499,8 @@ test('story thumbnail and tags survive a reload and an export/import round trip' try { first.director.setSceneStoryThumb('scene-1', THUMB); first.director.setSceneStoryTags('scene-1', ['Storms']); - saved = localStorage.getItem('godsEyeView.sceneProject.v2'); + // Draft builds wrote the same optional Stories fields in version 6. + saved = JSON.stringify({ ...savedProject(), version: 6 }); } finally { first.restore(); } @@ -2511,6 +2512,7 @@ test('story thumbnail and tags survive a reload and an export/import round trip' assert.equal(scene.storyThumb, THUMB); assert.deepEqual(scene.storyTags, ['Storms']); const exported = stringifySceneDocument(director._project); + assert.equal(JSON.parse(exported).version, 7); director.setSceneStoryTags('scene-1', []); director.setSceneStoryThumb('scene-1', 'data:image/png;base64,AAAA'); assert.equal( @@ -2565,8 +2567,8 @@ test('imports with a malformed thumbnail or tags are refused', async () => { } }); -test('THUMBNAIL stores the frame read in postRender on the selected scene', async () => { - const { director, viewer, restore } = makeDirector(); +test('THUMBNAIL stores only a credited Esri frame on the selected scene', async () => { + const { director, viewer, styleManager, restore } = makeDirector(); const createElement = document.createElement; try { assert.equal( @@ -2575,26 +2577,54 @@ test('THUMBNAIL stores the frame read in postRender on the selected scene', asyn 'no scene, no capture', ); director.selectShot('scene-1'); + let activeId = 'photoreal'; + styleManager.mapStackController = { + getState: () => ({ activeId, status: 'ready' }), + }; // The renderer's frame port: postRender runs on the frame it is asked for. const listeners = new Set(); const renderer = rendererOf(viewer); viewer.canvas = { width: 640, height: 360 }; + renderer.credits = { + list: () => [{ text: 'Powered by Esri — Source: Esri and Maxar' }], + }; renderer.frame = { on(phase, listener) { assert.equal(phase, 'postRender'); listeners.add(listener); return () => listeners.delete(listener); }, - requestRender: () => [...listeners].forEach((listener) => listener({})), + requestRender() {}, }; + const frame = () => [...listeners].forEach((listener) => listener()); + const credit = []; document.createElement = () => ({ - getContext: () => ({ drawImage() {} }), + getContext: () => ({ + drawImage() {}, + fillRect() {}, + fillText: (line) => credit.push(line), + }), toDataURL: () => THUMB, }); - assert.equal(await director.captureSceneThumb(), true); + assert.equal(await director.captureSceneThumb(), false); + assert.equal(listeners.size, 0); + activeId = 'esri-imagery'; + const capturing = director.captureSceneThumb(); + frame(); + assert.equal(await capturing, true); + assert.ok(credit.some((line) => /Esri/.test(line))); assert.equal(director._project.scenes[0].storyThumb, THUMB); assert.equal(director._presentation.status, 'Thumbnail captured'); + const switching = director.captureSceneThumb(); + activeId = 'photoreal'; + credit.length = 0; + frame(); + assert.equal(await switching, false); + assert.deepEqual(credit, []); + assert.equal(director._project.scenes[0].storyThumb, THUMB); + + activeId = 'esri-imagery'; delete renderer.frame; assert.equal(await director.captureSceneThumb(), false); assert.equal( diff --git a/src/scenes/storyThumb.js b/src/scenes/storyThumb.js index a7aa37114..6330b1938 100644 --- a/src/scenes/storyThumb.js +++ b/src/scenes/storyThumb.js @@ -54,9 +54,10 @@ export function centreCrop( * URL, halving in steps so a large canvas downscales smoothly. * @param {HTMLCanvasElement} source * @param {() => HTMLCanvasElement} createCanvas Makes an empty canvas. + * @param {string} [credit] Attribution to include in an exported thumbnail. * @returns {string} */ -export function encodeStoryThumb(source, createCanvas) { +export function encodeStoryThumb(source, createCanvas, credit = '') { const crop = centreCrop(source.width, source.height); if (!crop.width || !crop.height) throw new Error('Nothing to capture'); let image = source; @@ -98,6 +99,19 @@ export function encodeStoryThumb(source, createCanvas) { STORY_THUMB_WIDTH, STORY_THUMB_HEIGHT, ); + if (credit) { + const lines = credit.split(' — '); + const height = lines.length * 11 + 6; + const top = STORY_THUMB_HEIGHT - height; + context.fillStyle = 'rgba(0, 0, 0, 0.8)'; + context.fillRect(0, top, STORY_THUMB_WIDTH, height); + context.fillStyle = '#fff'; + context.font = '9px sans-serif'; + context.textBaseline = 'top'; + lines.forEach((line, i) => + context.fillText(line, 5, top + 3 + i * 11, STORY_THUMB_WIDTH - 10), + ); + } // A very busy view can exceed the limit; lower the quality until it fits. for (const quality of [STORY_THUMB_QUALITY, 0.7, 0.55, 0.4]) { const url = out.toDataURL('image/jpeg', quality); @@ -116,12 +130,14 @@ export function encodeStoryThumb(source, createCanvas) { * the canvas it draws in, as the caller found them for its scene. * @param {object} options * @param {() => HTMLCanvasElement} options.createCanvas Makes an empty canvas. + * @param {() => string | null | undefined} [options.creditForFrame] If supplied, + * the frame must have this attribution before the thumbnail can be copied. * @param {number} [options.timeoutMs] Give up when no frame is drawn. * @returns {Promise} JPEG data URL. */ export function captureStoryThumb( { frame, canvas } = {}, - { createCanvas, timeoutMs = 3000 }, + { createCanvas, creditForFrame, timeoutMs = 3000 }, ) { if (!frame || !canvas) return Promise.reject(new Error('Globe not ready')); return new Promise((resolve, reject) => { @@ -130,7 +146,12 @@ export function captureStoryThumb( remove(); clearTimeout(timer); try { - resolve(encodeStoryThumb(canvas, createCanvas)); + const credit = creditForFrame?.(); + resolve( + creditForFrame && !credit + ? '' + : encodeStoryThumb(canvas, createCanvas, credit), + ); } catch (error) { reject(error); } diff --git a/src/stories/boot.js b/src/stories/boot.js index 2f4a3b206..eb2a533b2 100644 --- a/src/stories/boot.js +++ b/src/stories/boot.js @@ -4,6 +4,14 @@ const wantsStories = () => { return STORIES_PARAMS.some((p) => params.has(p)); }; +/** Stop microphone use on entry while letting an active typed turn finish. */ +export function stopVoiceForStories(session) { + if (!session || session.adapter.getStartOptions?.()?.textOnly) return false; + const wasActive = session.isActive(); + session.stop(); + return wasActive; +} + /** * Stories, loaded on first use. The controller, the story catalog, the * screens and their styles are separate chunks, fetched when the person diff --git a/src/stories/boot.test.mjs b/src/stories/boot.test.mjs index d164e5fda..5a3c1b7dc 100644 --- a/src/stories/boot.test.mjs +++ b/src/stories/boot.test.mjs @@ -34,7 +34,7 @@ globalThis.HTMLCanvasElement.prototype.getContext = (kind) => globalThis.requestAnimationFrame = () => 0; globalThis.cancelAnimationFrame = () => {}; -const { bootStories } = await import('./boot.js'); +const { bootStories, stopVoiceForStories } = await import('./boot.js'); const { useStoriesStore } = await import('../ui/stores/stories.js'); const { bindRenderer } = await import('../render/rendererOf.js'); @@ -76,6 +76,27 @@ const director = { styleManager: { runImmediateNavigation: () => true }, }; +test('entering Stories stops microphone sessions and preserves typed chat', () => { + let textOnly = false; + let active = true; + let stops = 0; + const session = { + adapter: { getStartOptions: () => ({ textOnly }) }, + isActive: () => active, + stop: () => { + stops += 1; + }, + }; + assert.equal(stopVoiceForStories(session), true); + active = false; + assert.equal(stopVoiceForStories(session), false); + assert.equal(stops, 2); + textOnly = true; + active = true; + assert.equal(stopVoiceForStories(session), false); + assert.equal(stops, 2); +}); + test('the shell loads the controller on first open, then steps aside', async () => { setActivePinia(createPinia()); history.replaceState(null, '', '/'); diff --git a/src/stories/catalog.js b/src/stories/catalog.js index bf93e97a6..53a7ee129 100644 --- a/src/stories/catalog.js +++ b/src/stories/catalog.js @@ -318,20 +318,23 @@ export function listStories() { const shippedIds = new Set(shipped.map((s) => s.sceneId)); // One object per saved scene, kept across calls: the controller fills its // chapters in place when it opens, and the screens read the same object. - const own = (savedScenes() ?? []) - .filter((entry) => !shippedIds.has(entry.id)) - .map((entry) => { - const story = saved.get(entry.id) ?? savedStory(entry); - story.title = entry.title; - story.draft = !!entry.draft; - story.description = describe(entry); - story.cover = coverOf(entry.camera); - story.topics = [...(entry.tags ?? [])]; - story.tags = [...(entry.tags ?? [])]; - story.thumb = entry.thumb ?? ''; - saved.set(entry.id, story); - return story; - }); + const entries = (savedScenes() ?? []).filter( + (entry) => !shippedIds.has(entry.id), + ); + const ids = new Set(entries.map(({ id }) => id)); + for (const id of saved.keys()) if (!ids.has(id)) saved.delete(id); + const own = entries.map((entry) => { + const story = saved.get(entry.id) ?? savedStory(entry); + story.title = entry.title; + story.draft = !!entry.draft; + story.description = describe(entry); + story.cover = coverOf(entry.camera); + story.topics = [...(entry.tags ?? [])]; + story.tags = [...(entry.tags ?? [])]; + story.thumb = entry.thumb ?? ''; + saved.set(entry.id, story); + return story; + }); return [...own, ...shipped.filter((s) => installed(s.sceneId))]; } diff --git a/src/stories/controller.js b/src/stories/controller.js index 9a95e6d7e..900a3bf76 100644 --- a/src/stories/controller.js +++ b/src/stories/controller.js @@ -73,6 +73,7 @@ export function createStoriesController({ }) { let player = null; let saved = null; + let entryReady = null; // The view a Close is about to restore, once a stopping scene has settled. let pendingView = null; // Reopening reuses the saved view, but supersedes the old close request. @@ -242,6 +243,7 @@ export function createStoriesController({ } }; function handlePopState() { + const returningToExplore = steppingBack; clearTimeout(backTimer); backTimer = 0; steppingBack = false; @@ -264,7 +266,7 @@ export function createStoriesController({ else if (params.has(PARAM_STORIES)) store.mode === 'closed' ? controller.open({ fromHistory: true }) - : controller.backToExplore({ fromHistory: true }); + : controller.backToExplore({ fromHistory: true, returningToExplore }); else if (store.mode !== 'closed') controller.close({ fromHistory: true }); else if (pendingView) { // Another browser navigation landed while the scene was stopping. @@ -367,7 +369,7 @@ export function createStoriesController({ // handing the share state saved on open to GEV's own restore, the path a // pasted share link takes. function restoreShareState(saved) { - if (!saved?.ranScene || !saved.hash) return; + if ((!saved?.ranScene && !saved?.restoreOnExit) || !saved?.hash) return; // Directly, not by a hashchange: the share link skips a hash it already // restored as Back landed, while the scene was still tearing down. const share = director.styleManager?.shareLinkManager; @@ -383,6 +385,9 @@ export function createStoriesController({ const areaOf = (s) => s.area ?? { lat: s.cover.lat, lon: s.cover.lon, alt: s.cover.range }; let removePins = null; + let pinLayer = null; + let pinObserver = null; + let pinOffset = null; let places = []; // Pins follow the camera on every frame it draws. A change in which pins // show goes through the store (Vue renders them); a move alone is written @@ -390,14 +395,30 @@ export function createStoriesController({ function placePins() { const query = findQuery(viewer); if (!query) return; - const rect = canvas.getBoundingClientRect(); + if (!pinLayer) { + pinLayer = document.getElementById('pins'); + if (pinLayer) pinOffset = null; + if (pinLayer && globalThis.ResizeObserver) { + pinObserver = new ResizeObserver(refreshPinLayout); + pinObserver.observe(pinLayer); + pinObserver.observe(canvas); + } + } + if (!pinOffset) { + const rect = canvas.getBoundingClientRect(); + const origin = pinLayer?.getBoundingClientRect(); + pinOffset = { + x: rect.left - (origin?.left ?? 0), + y: rect.top - (origin?.top ?? 0), + }; + } const pins = places.map(({ id, at }) => { const win = query.project(at); const visible = !!win && !query.isOccluded(at); return { id, - x: rect.left + (win?.x ?? -9999), - y: rect.top + (win?.y ?? -9999), + x: pinOffset.x + (win?.x ?? -9999), + y: pinOffset.y + (win?.y ?? -9999), visible, }; }); @@ -411,18 +432,19 @@ export function createStoriesController({ store.pins = pins; return; } - const layer = document.getElementById('pins'); - const origin = layer?.getBoundingClientRect(); - if (!origin) return; - for (const el of layer.querySelectorAll('.pin[data-id]')) { + for (const el of pinLayer?.querySelectorAll('.pin[data-id]') ?? []) { const n = pins.find((pin) => pin.id === el.dataset.id); if (!n) continue; - el.style.transform = `translate(${n.x - origin.left}px, ${n.y - origin.top}px) translate(-50%, -100%)`; + el.style.transform = `translate(${n.x}px, ${n.y}px) translate(-50%, -100%)`; } // Kept in step for the next render, without telling Vue. for (let k = 0; k < pins.length; k++) Object.assign(toRaw(before[k]), pins[k]); } + function refreshPinLayout() { + pinOffset = null; + if (removePins) governorRequestRender('stories-layout'); + } function startPins() { stopPins(); places = listStories().map((s) => { @@ -430,6 +452,7 @@ export function createStoriesController({ return { id: s.id, at: fromDegrees(lon, lat) }; }); removePins = frame()?.on('postRender', placePins) ?? (() => {}); + addEventListener('resize', refreshPinLayout); governorRequestRender('stories-pins'); } // ── Explore's idle tour: the globe turns from one story to the next ── @@ -497,6 +520,9 @@ export function createStoriesController({ stopSettling(); removePins?.(); removePins = null; + removeEventListener('resize', refreshPinLayout); + pinObserver?.disconnect(); + pinLayer = pinObserver = pinOffset = null; store.pins = []; } /** @@ -699,7 +725,7 @@ export function createStoriesController({ let downAt = null; const onDown = (e) => { downAt = [e.clientX, e.clientY]; - if (store.mode === 'story' && innerWidth <= 700 && store.sheet !== 'peek') + if (store.mode === 'story' && innerWidth <= 720 && store.sheet !== 'peek') store.sheet = 'peek'; }; const onUp = (e) => { @@ -728,7 +754,8 @@ export function createStoriesController({ const nav = director.styleManager; if (nav?.runImmediateNavigation?.('stories', () => true) === false) return false; - if (director.running) director.stopScene(); + const settling = director.busy || director.running; + director.stopScene(); stopFollowing(viewer); // Reopened while a scene from the last visit is still tearing down: the // person's view from before that visit is still the one to come back to. @@ -744,10 +771,23 @@ export function createStoriesController({ location.pathname + location.search, ); if (pendingView) { - saved = pendingView; + saved = pendingView.view; pendingView = null; - } else saveView(); - closeGeneration += 1; + } else if (!settling) saveView(); + const generation = ++closeGeneration; + // A temporarily unavailable card may be retried on the next visit. + for (const id of thumbKeys.keys()) + if (!store.thumbs?.[id]) thumbKeys.delete(id); + if (settling) { + entryReady = directorSettled(director).then(() => { + if (destroyed || generation !== closeGeneration) return; + if (!saved) { + saveView(); + saved.restoreOnExit = true; + } + entryReady = null; + }); + } document.body.classList.add('stories-mode'); onEnter?.(); return true; @@ -755,6 +795,8 @@ export function createStoriesController({ // ── Card images: drawn once per story place from the base imagery ── const ESRI_STACK = 'esri-imagery'; + const isEsri = () => + director.styleManager?.mapStackController?.getActiveId?.() === ESRI_STACK; const thumbKeys = new Map(); let drawingThumbs = false; let thumbsAgain = false; @@ -764,15 +806,21 @@ export function createStoriesController({ drawingThumbs = true; thumbsAgain = false; try { - for (const story of listStories()) { + const stories = listStories(); + const currentIds = new Set(stories.map(({ id }) => id)); + for (const id of thumbKeys.keys()) + if (!currentIds.has(id)) thumbKeys.delete(id); + const kept = Object.entries(store.thumbs ?? {}).filter(([id]) => + currentIds.has(id), + ); + if (kept.length !== Object.keys(store.thumbs ?? {}).length) + store.thumbs = Object.fromEntries(kept); + for (const story of stories) { if (destroyed || store.mode === 'closed') break; // Drawn only from the keyless Esri World Imagery, whose terms allow // showing it with its credit; any other imagery leaves the // placeholder unless the scene has its own image. - const esri = - director.styleManager?.mapStackController?.getActiveId?.() === - ESRI_STACK; - if (!esri && !story.thumb) { + if (!isEsri() && !story.thumb) { // A card drawn from Esri earlier goes: its credit is not on // screen under another imagery. if (store.thumbs?.[story.id]) { @@ -785,16 +833,19 @@ export function createStoriesController({ // The place Explore frames for it, as its pin shows. const a = areaOf(story); const c = { lat: a.lat, lon: a.lon, range: a.alt }; - const key = story.thumb - ? story.thumb.slice(-32) - : `${c.lat},${c.lon},${c.range}`; - if (thumbKeys.get(story.id) === key && store.thumbs?.[story.id]) - continue; + const key = story.thumb || `${c.lat},${c.lon},${c.range}`; + if (thumbKeys.get(story.id) === key) continue; // A card image the person captured in AUTHORING wins. const url = story.thumb || (await drawThumb(c)); - if (!url || destroyed) continue; + if (destroyed || store.mode === 'closed' || !storyById(story.id)) + continue; + if (!story.thumb && !isEsri()) continue; thumbKeys.set(story.id, key); - store.thumbs = { ...store.thumbs, [story.id]: url }; + if (url) store.thumbs = { ...store.thumbs, [story.id]: url }; + else if (store.thumbs?.[story.id]) { + const { [story.id]: _gone, ...rest } = store.thumbs; + store.thumbs = rest; + } } } finally { drawingThumbs = false; @@ -833,21 +884,43 @@ export function createStoriesController({ if (entry === exploreEntry && store.mode === 'explore') run(); }) : run(); - if (!saved?.ranScene) return whenLaidOut(frame); // Back from a scene: once it has torn down, the person's own layers, // style and clock come back before Explore frames the globe, as on // Close. The address keeps naming only Stories' place. - directorSettled(director).then(() => { + const settled = () => { if (entry !== exploreEntry || store.mode !== 'explore' || destroyed) return; if (viewer.isDestroyed?.()) return; - const query = location.pathname + location.search; - restoreShareState(saved); - if (location.hash) history.replaceState(history.state, '', query); - restoreClock(saved); - saved.ranScene = false; - frame(); + if (saved?.ranScene) { + const query = location.pathname + location.search; + restoreShareState(saved); + if (location.hash) history.replaceState(history.state, '', query); + restoreClock(saved); + saved.ranScene = false; + } + whenLaidOut(frame); + }; + if (entryReady) return entryReady.then(settled); + if (saved?.ranScene) return directorSettled(director).then(settled); + return whenLaidOut(frame); + } + + async function openInAuthoring(story, shotId, atMs) { + const closing = controller.close({ keepCamera: true }); + if (!closing) return; + const generation = closeGeneration; + await closing; + if (destroyed || generation !== closeGeneration) return; + director.selectShot?.(story.sceneId, shotId); + director.styleManager?.setPanelCollapsed?.('scene-panel', false, { + explicit: true, }); + store.hostedToast = { + id: story.id, + title: story.title, + atMs, + when: anchorStamp(story, atMs, null), + }; } const controller = { @@ -875,6 +948,7 @@ export function createStoriesController({ return; } const generation = ++closeGeneration; + entryReady = null; dropPlayer(); stopPins(); camera()?.cancelFlight(); @@ -888,7 +962,8 @@ export function createStoriesController({ store.toast = ''; const was = saved; saved = null; - pendingView = was; + const pending = { view: was }; + pendingView = pending; // A camera owner that takes over during the wait (the person dragging // the globe, a layer's focus) keeps the camera: no snap back. let navigated = false; @@ -909,7 +984,7 @@ export function createStoriesController({ // Reopened meanwhile (the reopen took `was` over), or torn down. if ( generation !== closeGeneration || - pendingView !== was || + pendingView !== pending || destroyed || viewer.isDestroyed?.() ) @@ -918,7 +993,7 @@ export function createStoriesController({ if (!navigated) restoreView(was, { keepCamera }); // AUTHORING shows what it showed before, unless the person opened // the story there. - if (!keepCamera && was.playedScene && was.authoring) + if (!keepCamera && was?.playedScene && was.authoring) director.selectShot?.(was.authoring.sceneId, was.authoring.shotId); const afterLanding = () => { // Open in GEV keeps this place and look: the live view is written @@ -941,6 +1016,7 @@ export function createStoriesController({ if (store.picked === id) return; const s = id ? storyById(id) : null; store.picked = s ? id : null; + if (entryReady) return; flyTo(s ? pickView(s) : startView(), s ? 1.6 : 1.4); if (s) stopTour(); else armTour(1400 + TOUR_DWELL_MS); @@ -981,18 +1057,29 @@ export function createStoriesController({ exploring: false, chapterIndex: 0, }; - // A GEV scene plays on the person's own globe and layers. - if (saved) saved.ranScene = saved.playedScene = true; - // The scene's own labels, videos and cards stay visible. - document.body.classList.add('stories-scene'); - player = createGevPlayer(director, story, { onTick }); - // Related stories show their card images too, after a link. - drawThumbs(); - startCameraReadout(); - // Explore may have restored a different look while the director still - // has this shot selected. Reopening restores the authored look too. - if (atMs || !autoplay) player.seek(atMs, { reloadShot: true }); - if (autoplay) player.play(); + const start = () => { + // A GEV scene plays on the person's own globe and layers. + if (saved) saved.ranScene = saved.playedScene = true; + document.body.classList.add('stories-scene'); + player = createGevPlayer(director, story, { onTick }); + drawThumbs(); + startCameraReadout(); + // Explore may have restored a different look while this shot + // remained selected. Reopening restores the authored look too. + if (atMs || !autoplay) player.seek(atMs, { reloadShot: true }); + if (autoplay) player.play(); + }; + if (entryReady) { + const opening = store.playback; + entryReady.then(() => { + if ( + !destroyed && + store.mode === 'story' && + store.playback === opening + ) + start(); + }); + } else start(); if (!fromHistory) navigate( atMs @@ -1005,10 +1092,10 @@ export function createStoriesController({ store.flashHint(t('Drag the map to explore · Resume any time'), 4200); } }, - backToExplore({ fromHistory = false } = {}) { + backToExplore({ fromHistory = false, returningToExplore = false } = {}) { if (destroyed) return; cancelInitialLink(); - // A second Back keeps the traversal, but cancels a story queued since. + // A second Back keeps the traversal and clears the queued action. if (!fromHistory && traversing()) { if (steppingBack) afterTraversal = null; return; @@ -1039,8 +1126,17 @@ export function createStoriesController({ navigate({ [PARAM_STORIES]: 'explore' }, true); } else { const params = new URLSearchParams(location.search); - if (params.has(PARAM_SELECTED_STORY)) + if (returningToExplore && params.has(PARAM_SELECTED_STORY)) { + const story = store.picked && storyById(store.picked); + navigate( + story && !story.mine + ? { [PARAM_STORIES]: 'explore', [PARAM_SELECTED_STORY]: story.id } + : { [PARAM_STORIES]: 'explore' }, + false, + ); + } else if (params.has(PARAM_SELECTED_STORY)) { store.picked = exploreSelection(params); + } } showExplore(); }, @@ -1053,36 +1149,27 @@ export function createStoriesController({ return player ? 'gev' : null; }, /** Layout changed (panel width, sheet, feed size): place the pins again. */ - reframe() { - if (removePins) governorRequestRender('stories-layout'); - }, + reframe: refreshPinLayout, /** * A GEV scene leaves Stories for GEV's own Scenes panel: the globe stays * where the story was, and the scene and its current shot are selected * there for authoring. */ async openInGev() { - const s = player?.story; + const s = store.storyId && storyById(store.storyId); if (!s) return; const atMs = store.playback.wallMs; const shotId = s.chapters[store.playback.chapterIndex]?.id ?? null; - player.pause(); - // After Close has settled: the scene's teardown restores GEV's look - // and panels, which would fold the Scenes panel again. - const closing = controller.close({ keepCamera: true }); - const generation = closeGeneration; - await closing; - if (destroyed || generation !== closeGeneration) return; - director.selectShot?.(s.sceneId, shotId); - director.styleManager?.setPanelCollapsed?.('scene-panel', false, { - explicit: true, - }); - store.hostedToast = { - id: s.id, - title: s.title, - atMs, - when: anchorStamp(s, atMs, null), - }; + if (steppingBack) { + afterTraversal = () => openInAuthoring(s, shotId, atMs); + return; + } + if (entryReady) { + await entryReady; + if (destroyed || player?.story !== s) return; + } + player?.pause(); + return openInAuthoring(s, shotId, atMs); }, /** The Stories place only: not the sender's camera, layers or style. */ shareLink() { @@ -1105,6 +1192,7 @@ export function createStoriesController({ destroy() { if (destroyed) return; destroyed = true; + entryReady = null; cancelInitialLink(); clearTimeout(backTimer); clearTimeout(landingTimer); diff --git a/src/stories/controller.test.mjs b/src/stories/controller.test.mjs index b1c40414c..a62811497 100644 --- a/src/stories/controller.test.mjs +++ b/src/stories/controller.test.mjs @@ -357,6 +357,69 @@ test('Back to Explore after a related story steps past both stories', (t) => { controller.destroy(); }); +test('Back to Explore keeps the returned story and finishes a queued Open in GEV', async (t) => { + const { controller, director, store } = setup(); + t.after(() => controller.destroy()); + const steps = recordGo(t); + const explore = '/?stories=explore&selectedStory=gev%3Aorbital-watch'; + const entry = { gevStories: { stories: 'explore', depth: 1, explore: 1 } }; + history.replaceState(entry, '', explore); + controller.open({ fromHistory: true }); + controller.openStory('gev:flights-radar'); + controller.backToExplore(); + history.replaceState(entry, '', explore); + dispatchEvent(new PopStateEvent('popstate')); + assert.equal(store.picked, 'gev:flights-radar'); + assert.equal( + new URL(location.href).searchParams.get('selectedStory'), + 'gev:flights-radar', + ); + + controller.openStory('gev:flights-radar'); + controller.backToExplore(); + await controller.openInGev(); + assert.deepEqual(director.selected, []); + history.replaceState(entry, '', explore); + dispatchEvent(new PopStateEvent('popstate')); + await tick(); + assert.equal(store.mode, 'closed'); + assert.deepEqual(steps, [-1, -1, -1]); + assert.equal(director.selected.at(-1)?.[0], 'flights-radar'); +}); + +test('Stories waits for a stopped Authoring load before framing and saving the view', async (t) => { + const { controller, director, camera } = setup(); + t.after(() => controller.destroy()); + recordGo(t); + let resolveIdle; + director.busy = true; + director.whenIdle = () => + new Promise((resolve) => { + resolveIdle = resolve; + }); + const share = director.styleManager.shareLinkManager; + const snapshots = []; + share.snapshotHash = () => { + snapshots.push(director.busy); + return 'v=2&lat=25'; + }; + assert.equal(controller.open(), true); + assert.equal(director.stops, 1); + assert.deepEqual(snapshots, []); + assert.equal(camera.flights.length, 0); + await Promise.resolve(); + director.busy = false; + resolveIdle(); + await tick(); + assert.deepEqual(snapshots, [false]); + assert.equal(camera.flights.length, 1); + + director.whenIdle = async () => {}; + await controller.close(); + land(); + assert.deepEqual(share.restored, ['v=2&lat=25']); +}); + test('a second Close after a quick reopen still waits for the scene to tear down', async () => { const { controller, director, camera } = setup(); controller.open(); diff --git a/src/stories/format.js b/src/stories/format.js index 827a3b8f3..16af0f1e4 100644 --- a/src/stories/format.js +++ b/src/stories/format.js @@ -23,7 +23,7 @@ export function creditPlacement({ map, feed, width, height }) { feed.right < map.right && feed.top < map.bottom - 1 && feed.bottom >= map.bottom - 1; - const gap = width <= 700 ? 10 : 24; + const gap = width <= 720 ? 10 : 24; return { bottom: Math.max(0, height - map.bottom) + 6, left: besideFeed ? feed.right + 14 : map.left + gap, diff --git a/src/stories/thumbs.js b/src/stories/thumbs.js index d300fd0df..a024c4989 100644 --- a/src/stories/thumbs.js +++ b/src/stories/thumbs.js @@ -106,14 +106,18 @@ export async function drawThumb(cover, { loadTile = loadImage } = {}) { const x = (((x0 + dx) % n) + n) % n; const image = await tile(loadTile, x, y, level); if (!image) return; - ctx.drawImage( - image, - ox + dx * TILE_SIZE, - oy + dy * TILE_SIZE, - TILE_SIZE + 1, - TILE_SIZE + 1, - ); - drawn += 1; + try { + ctx.drawImage( + image, + ox + dx * TILE_SIZE, + oy + dy * TILE_SIZE, + TILE_SIZE + 1, + TILE_SIZE + 1, + ); + drawn += 1; + } finally { + image.close?.(); + } }), ), ); diff --git a/src/ui/sceneControls.js b/src/ui/sceneControls.js index dcb5b4c79..2bde14a45 100644 --- a/src/ui/sceneControls.js +++ b/src/ui/sceneControls.js @@ -37,6 +37,7 @@ export class SceneControls { // The SceneShotList view renders the rows and the panel its buttons; // their actions come back here. this.storeToken = store.attach({ + selectScene: (id) => this.run('selectScene', id), select: (id) => { this.run('selectShot', id); if (this.destroyed) return; diff --git a/src/ui/sceneControls.test.mjs b/src/ui/sceneControls.test.mjs index 9d2fc7943..a3e3f2057 100644 --- a/src/ui/sceneControls.test.mjs +++ b/src/ui/sceneControls.test.mjs @@ -862,7 +862,7 @@ test('Stories tag chips and THUMBNAIL follow the current scene', async () => { } }); -test('the real director captures into a new scene from an empty panel', async () => { +test('authoring can reopen a saved empty draft and capture from an empty panel', async () => { const f = fixture(); const previousStorage = globalThis.localStorage; let saved = null; @@ -873,7 +873,14 @@ test('the real director captures into a new scene from an empty panel', async () configurable: true, writable: true, value: { - getItem: () => JSON.stringify({ version: 3, scenes: f.state.scenes }), + getItem: () => + JSON.stringify({ + version: 3, + scenes: [ + ...f.state.scenes, + { id: 'empty-draft', title: 'Empty draft', shots: [] }, + ], + }), setItem: (_key, value) => { saved = JSON.parse(value); }, @@ -896,6 +903,23 @@ test('the real director captures into a new scene from an empty panel', async () ); await nextTick(); assert.equal(f.elements.name.textContent, 'No scene yet'); + const drafts = document.getElementById('empty-scene-select'); + assert.ok(drafts); + drafts.value = 'empty-draft'; + drafts.dispatchEvent(new Event('change')); + await nextTick(); + assert.equal(f.elements.name.textContent, 'Empty draft'); + assert.equal( + director.draftScenes().some(({ id }) => id === 'empty-draft'), + false, + ); + window.confirm = () => true; + f.elements.delete.click(); + await nextTick(); + assert.equal( + saved.scenes.some(({ id }) => id === 'empty-draft'), + false, + ); window.prompt = () => 'Harbour'; f.elements.capture.click(); await nextTick(); diff --git a/src/ui/stores/scenes.js b/src/ui/stores/scenes.js index 04c4b1a22..5630c5fd0 100644 --- a/src/ui/stores/scenes.js +++ b/src/ui/stores/scenes.js @@ -3,6 +3,7 @@ import { computed, markRaw, shallowRef } from 'vue'; /** * @typedef {object} SceneRowHandlers + * @property {(sceneId: string) => void} selectScene * @property {(shotId: string) => void} select * @property {(sceneId: string, shotId: string, title: string) => void} rename * @property {(sceneId: string, shotId: string) => void} load diff --git a/src/ui/storiesView.test.mjs b/src/ui/storiesView.test.mjs new file mode 100644 index 000000000..e200cbab6 --- /dev/null +++ b/src/ui/storiesView.test.mjs @@ -0,0 +1,71 @@ +import '../testSupport/registerDom.mjs'; +import assert from 'node:assert/strict'; +import test from 'node:test'; +import { createApp, nextTick } from 'vue'; +import { createPinia } from 'pinia'; +import { useStoriesStore } from './stores/stories.js'; +import { storyById } from '../stories/catalog.js'; +import StoryScreen from './views/stories/StoryScreen.vue'; + +test('the story screen previews a drag and seeks once on release', async (t) => { + const host = document.body.appendChild(document.createElement('div')); + const pinia = createPinia(); + const store = useStoriesStore(pinia); + const builtIn = storyById('gev:flights-radar'); + const first = builtIn.chapters[0]; + const story = { + ...builtIn, + durationMs: 24000, + chapters: [first, { ...first, id: 'second', wallMs: 12000 }], + }; + const seeks = []; + store.connect( + { + seek(ms) { + seeks.push(ms); + store.playback.wallMs = ms; + }, + }, + [story], + ); + const app = createApp(StoryScreen, { story }).use(pinia); + app.mount(host); + t.after(() => { + app.unmount(); + host.remove(); + }); + + const track = host.querySelector('#tlTrack'); + track.getBoundingClientRect = () => ({ left: 0, width: 400 }); + const pointer = (type, clientX) => + track.dispatchEvent(new PointerEvent(type, { pointerId: 1, clientX })); + const progress = () => Number(track.getAttribute('aria-valuenow')); + const before = progress(); + pointer('pointerdown', 45); + pointer('pointermove', 60); + pointer('pointermove', 80); + await nextTick(); + const preview = progress(); + assert.ok(preview > before); + assert.deepEqual(seeks, []); + pointer('pointerup', 80); + await nextTick(); + assert.equal(seeks.length, 1); + assert.equal(progress(), preview); + assert.equal(progress(), Math.round((seeks[0] / story.durationMs) * 100)); + + pointer('pointerdown', 300); + await nextTick(); + assert.notEqual(progress(), preview); + pointer('pointercancel', 300); + await nextTick(); + assert.equal(progress(), preview); + assert.equal(seeks.length, 1); + track.dispatchEvent(new KeyboardEvent('keydown', { key: 'End' })); + await nextTick(); + assert.equal(track.querySelector('.tl-seg.now')?.dataset.k, '1'); + track.dispatchEvent(new KeyboardEvent('keydown', { key: '[' })); + await nextTick(); + assert.equal(track.querySelector('.tl-seg.now')?.dataset.k, '0'); + assert.deepEqual(seeks.slice(1), [23990, first.wallMs + 1]); +}); diff --git a/src/ui/styles/scenes.css b/src/ui/styles/scenes.css index b48d793fb..d86456265 100644 --- a/src/ui/styles/scenes.css +++ b/src/ui/styles/scenes.css @@ -177,6 +177,11 @@ color: var(--scene-quiet); } +#empty-scene-select { + flex: 1 1 100%; + min-width: 0; +} + /* A translated action longer than its button wraps inside the button instead of running past it. English keeps its one-line buttons. */ html:not([lang='en']) #scene-panel .scene-controls .scene-btn { diff --git a/src/ui/styles/stories-entry.css b/src/ui/styles/stories-entry.css index 3de663dd4..f141d55c4 100644 --- a/src/ui/styles/stories-entry.css +++ b/src/ui/styles/stories-entry.css @@ -207,7 +207,7 @@ body.ui-clean-view #gev-stories .gs-pop { z-index: 1201; bottom: 110px; } -@media (max-width: 700px) { +@media (max-width: 720px) { #gev-stories .gs-pop { left: 12px; right: 12px !important; diff --git a/src/ui/styles/stories.css b/src/ui/styles/stories.css index c117d5ef3..a2415c1e8 100644 --- a/src/ui/styles/stories.css +++ b/src/ui/styles/stories.css @@ -360,7 +360,7 @@ bottom: 1px; } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .st-map .ov-clock { padding: 3px 24px 3px 4px; } @@ -389,7 +389,7 @@ bottom: 92px; } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .h-top { padding: 16px 12px 0 18px; align-items: center; @@ -549,7 +549,7 @@ top: calc(var(--hh) + 64px); } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .scr-explore, #gev-stories .scr-story { --hh: 62px; @@ -936,7 +936,7 @@ color: var(--text-secondary); white-space: nowrap; } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .ex-body, #gev-stories .ex-body[data-side='right'] { grid-template-columns: minmax(0, 1fr); @@ -1330,7 +1330,7 @@ height: 18px; filter: drop-shadow(0 0 6px rgba(0, 246, 255, 0.45)); } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .h-toast { bottom: 76px; flex-wrap: wrap; @@ -2115,7 +2115,7 @@ display: none; } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .timeline { padding-top: 20px; } @@ -2473,7 +2473,7 @@ display: block; } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .st-body, #gev-stories .scr-story[data-chapters='timeline'] .st-body, #gev-stories .scr-story.expanded .st-body { @@ -3140,7 +3140,7 @@ #gev-stories .m-only-search { display: none; } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .ex-msearch { display: none; } @@ -3173,7 +3173,7 @@ border-radius: var(--panel-radius) 0 0 var(--panel-radius); } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .ex-body .ex-feed, #gev-stories .ex-body[data-side='right'] .ex-feed { border-radius: 18px 18px 0 0; @@ -3273,7 +3273,7 @@ #gev-stories .thumb-play:hover { border-color: #fff; } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .thumb-play { opacity: 1; transform: none; @@ -3301,7 +3301,7 @@ box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4) !important; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.5)); } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .thumb-play { border-radius: 9px !important; } @@ -3318,7 +3318,7 @@ #gev-stories .thumb-play { z-index: 1; } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .pin[aria-pressed='true'] .pin-thumb { display: block; width: 42px; @@ -3422,7 +3422,7 @@ .pin-thumb::after { opacity: 0 !important; } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .scr-explore .pins .pin[aria-pressed='true'] .pin-thumb { width: auto; height: 38px; @@ -3456,7 +3456,7 @@ opacity: 1; } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .scr-explore .pins .pin[aria-pressed='true'] .pin-thumb { padding: 0 16px !important; justify-content: center; @@ -3470,7 +3470,7 @@ margin: 0 !important; } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .card .c-layers, #gev-stories .card[aria-pressed='true'] .c-layers { display: none !important; @@ -3493,7 +3493,7 @@ 0 0 0 0 rgba(0, 212, 255, 0); } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .scr-explore .pins .pin[aria-pressed='true'] .pin-lbl, #gev-stories .scr-explore .pins .pin[aria-pressed='true'] .pin-dot { visibility: hidden; @@ -3529,7 +3529,7 @@ animation: none !important; } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .card .thumb { grid-row: 1 / 3 !important; } @@ -3552,7 +3552,7 @@ #gev-stories #scrExplore .s-head .s-msearch { display: none !important; } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories #scrExplore .s-head .h-right .tbtn.hide-m:not(.accent) { display: grid !important; place-items: center; @@ -3653,12 +3653,12 @@ #gev-stories .ex-tools .fh-search:focus-within kbd { display: none; } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories .ex-tools .fh-search kbd { display: none; } } -@container app (max-width: 700px) { +@container app (max-width: 720px) { #gev-stories #tlHead { display: none !important; } @@ -3820,7 +3820,7 @@ body.stories-mode:not(#gs-a):not(#gs-b) #gev-credits { } /* On a phone the line wraps and shrinks to stay on screen, as the phone shell does outside recording mode. */ -@media (max-width: 700px) { +@media (max-width: 720px) { 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; @@ -3839,7 +3839,7 @@ body.stories-mode:not(#gs-a):not(#gs-b) #gev-credits { #gev-stories .scr-story .ov-legend { bottom: 68px !important; } -@media (max-width: 700px) { +@media (max-width: 720px) { #gev-stories .scr-story .st-map .ov-clock { margin-bottom: 26px; } diff --git a/src/ui/views/LayerPanelsView.vue b/src/ui/views/LayerPanelsView.vue index b26cf571b..6ab3c358b 100644 --- a/src/ui/views/LayerPanelsView.vue +++ b/src/ui/views/LayerPanelsView.vue @@ -1,4 +1,5 @@ @@ -410,8 +388,9 @@ defineExpose({ goChapter }); :aria-valuetext="`${clock.big}, ${t('chapter')} ${k + 1}: ${chTitle(chapters[k])}`" @pointerdown="onDown" @pointermove="onMove" - @pointerup="onUp" - @pointercancel="onUp" + @pointerup="finishScrub" + @pointercancel="finishScrub" + @lostpointercapture="finishScrub" @pointerleave="onLeave" @keydown="onKey" > diff --git a/src/voice/session.test.mjs b/src/voice/session.test.mjs index 8788661e7..bec5ed4a2 100644 --- a/src/voice/session.test.mjs +++ b/src/voice/session.test.mjs @@ -516,6 +516,19 @@ test('Stop and explicit reentrant successor start acquire only for the successor f.session.destroy(); }); +test('ordinary start forwards caller settings once and remains stoppable', async () => { + const f = startReentrancyFixture(); + const settings = { pushToTalk: true }; + await f.session.start(settings); + assert.equal(f.settings.length, 1); + assert.equal(f.settings[0], settings); + assert.equal(f.starts(), 1); + assert.equal(f.session.state, 'listening'); + f.session.stop(); + assert.equal(f.session.state, 'idle'); + f.session.destroy(); +}); + test('start admission rejects microphone use before connecting and allows typed chat', async () => { const f = startReentrancyFixture((options) => options?.textOnly === true); const states = [];