diff --git a/changelog.d/1724-stories-near-end-play.md b/changelog.d/1724-stories-near-end-play.md deleted file mode 100644 index a8f2963db..000000000 --- a/changelog.d/1724-stories-near-end-play.md +++ /dev/null @@ -1,3 +0,0 @@ -- Keep a Stories link paused in the last quarter-second on its final shot - when Play is pressed, rather than restarting the scene; completed stories - still replay from the beginning (manjunath22466, kvnloo, #1724). diff --git a/changelog.d/1724-stories.md b/changelog.d/1724-stories.md new file mode 100644 index 000000000..bea160025 --- /dev/null +++ b/changelog.d/1724-stories.md @@ -0,0 +1,8 @@ +- Stories: GEV scenes told as stories on the live globe. A Stories button + opens Explore, a feed of the scenes GEV ships and the person's own (saved + from AUTHORING, or drafts) with a pin each and an idle tour between them; a + story plays with chapters, key moments and its data sources, and Close puts + the person's view, clock and layers back. A story link paused in its last + quarter-second keeps its final shot when Play is pressed. AUTHORING starts + with no scene and gains THUMBNAIL, topic tags and SAVE TO STORIES + (Manjunath, @manjunath22466; Kevin Rajan, @kvnloo; #1724). diff --git a/docs/CURRENT-STATE.md b/docs/CURRENT-STATE.md index 3c6343d5d..9c64c1d16 100644 --- a/docs/CURRENT-STATE.md +++ b/docs/CURRENT-STATE.md @@ -690,8 +690,11 @@ 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 every few seconds, for a minute after the last touch (never with a story -picked or with reduced motion). A picked story's place is framed in the -middle of the view at an angle (−60°). Stories reaches the globe only +picked or with reduced motion). The start view and a picked story's place +(at an angle, −60°) are framed in the middle of the map Explore leaves +visible (`.ex-map`: beside the feed on a wide screen, above the sheet on a +phone), not of the whole canvas; a flight that lands after that area has +moved makes one short correction. Stories reaches the globe only through the renderer's ports (`src/render/rendererOf.js`): its flights, pose and Close's restore go through the camera port, and after each landing a continuous-render hold keeps the globe drawing only until the globe port @@ -746,7 +749,8 @@ Close dismisses the Stories screens and keeps the keyboard and microphone guards until the previous view is back. The director is waited on until idle (`SceneDirector.whenIdle`: no run and no pending LOAD, seek or interaction; at most 15 s). The camera and world clock are put back (a clock -still where it should be is left alone), unless a +nothing moved while Stories was open, with no jump and the same mode and +rate, is left alone), unless a camera owner took over during the wait (a drag on the globe, a layer's focus). History steps back over Stories' entries; once that lands (or after 2 s if it never does), the saved share state is re-applied directly @@ -765,7 +769,9 @@ Inside an inline embed Stories is not offered: the URL and history are the host's. The Stories button sits left of whatever holds GEV's top-right corner: the -ACTIVE STYLE readout, or GEV Hosted's account avatar. The first-visit popup +ACTIVE STYLE readout, or GEV Hosted's account avatar. On GEV's phone layout, +where neither shows, it is icon-only under the corner-actions column +(`#corner-actions`), aligned with its right edge. The first-visit popup is a labelled region that does not take focus. The story page's rail offers Open in GEV and Share only. Share on Explore reopens the list with the same shipped story selected. A story link opens paused at the shared diff --git a/src/maps/globeEngine.js b/src/maps/globeEngine.js index 0f0ec8652..a2088973e 100644 --- a/src/maps/globeEngine.js +++ b/src/maps/globeEngine.js @@ -15,7 +15,8 @@ import { findFrame, findGlobe, rendererOf } from '../render/rendererOf.js'; import { KEYLESS_TERRAIN_URL } from './keylessTerrain.js'; -const ESRI_TILES = +/** Esri World Imagery's tiles; Stories' card images draw from the same. */ +export const ESRI_TILES = 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'; const ESRI_CREDIT = 'Powered by Esri — Source: Esri, Maxar, Earthstar Geographics, and the GIS User Community'; diff --git a/src/stories/controller.js b/src/stories/controller.js index dd54ea4c1..830992063 100644 --- a/src/stories/controller.js +++ b/src/stories/controller.js @@ -1,4 +1,4 @@ -import { markRaw, toRaw } from 'vue'; +import { markRaw, nextTick, toRaw } from 'vue'; import { t } from '../i18n/index.js'; import { governorRequestRender, @@ -275,6 +275,7 @@ export function createStoriesController({ playing: world.playing, rate: world.rate, stepping: world.stepping, + jumps: world.jumps, }, openedAt: Date.now(), // Story history entries have no hash. Capture the live globe state. @@ -306,13 +307,25 @@ export function createStoriesController({ /** * The world clock as the person left it: live stays live, and a playing - * clock carries on as if Stories had never paused it. A clock still where - * it should be is left alone, so its layers see no jump. + * clock carries on as if Stories had never paused it. A clock nothing + * moved while Stories was open (no jump, same mode and rate) is left + * alone, so its layers see no jump. */ function restoreClock(saved) { const was = saved?.clock; if (!was) return; const now = clock.getState(); + // Nothing moved it while Stories was open (no jump, same mode and + // rate): a clock playing at its own pace, held by buffering or stepped + // by a driver, is left as it is. + if ( + Number.isFinite(was.jumps) && + now.jumps === was.jumps && + now.live === was.live && + now.playing === was.playing && + now.rate === was.rate + ) + return; if (was.live) { if (!now.live) clock.goLive(); return; @@ -502,18 +515,68 @@ export function createStoriesController({ holdContinuousRender('stories-tiles'); tilesTimer = setTimeout(stopSettling, 10000); } - function flyTo({ lat, lon, alt }, duration = 1.6) { + /** + * Where the map shows between Explore's own panels (the feed beside it on + * a wide screen, its sheet below it on a phone): how far, in pixels, that + * area's centre is from the canvas's, and the canvas height. + */ + function visibleOffset() { + const map = document + .querySelector('#gev-stories .ex-map') + ?.getBoundingClientRect(); + const view = canvas?.getBoundingClientRect?.(); + if (!map?.width || !map?.height || !view?.height) return null; + return { + right: map.left + map.width / 2 - (view.left + view.width / 2), + up: view.top + view.height / 2 - (map.top + map.height / 2), + height: view.height, + }; + } + /** + * The point to aim at so that (lat, lon) lands in the middle of the visible + * map rather than of the whole canvas, for a camera `distance` metres away + * looking down at `pitch` (radians) with heading north. + */ + function aimFor(lat, lon, distance, pitch, off = visibleOffset()) { + if (!off || (!off.right && !off.up)) return { lat, lon }; + const fovy = camera()?.pose()?.fovy || Math.PI / 3; + const perPx = (2 * distance * Math.tan(fovy / 2)) / off.height; + const metresNorth = (off.up * perPx) / Math.max(0.2, Math.sin(-pitch)); + const metresEast = off.right * perPx; + const cosLat = Math.max(0.05, Math.cos((lat * Math.PI) / 180)); + return { + lat: Math.max(-89, Math.min(89, lat - metresNorth / 111320)), + lon: lon - metresEast / (111320 * cosLat), + }; + } + // The visible map can still be settling while a flight runs (the phone + // sheet takes its height just after Explore opens): a flight that lands + // with the map moved by more than a few pixels makes one short correction. + const moved = (a, b) => + !a !== !b || + (a && (Math.abs(a.up - b.up) > 8 || Math.abs(a.right - b.right) > 8)); + function flyTo(place, duration = 1.6, corrected = false) { + const { lat: lat0, lon: lon0, alt } = place; // The whole globe straight down; a story's place at an angle, framed in - // the middle of the view rather than under the camera. + // the middle of the visible map rather than under the camera. const port = camera(); if (!port) return; - if (alt > 2e6) { + const top = alt > 2e6; + const pitch = top ? -Math.PI / 2 : (-60 * Math.PI) / 180; + const off = visibleOffset(); + const { lat, lon } = aimFor(lat0, lon0, alt, pitch, off); + const onComplete = () => { + if (!corrected && store.mode === 'explore' && moved(off, visibleOffset())) + return flyTo(place, 0.5, true); + settleTiles(); + }; + if (top) { port.flyTo( { lon, lat, height: alt }, { - orientation: { heading: 0, pitch: -Math.PI / 2, roll: 0 }, + orientation: { heading: 0, pitch, roll: 0 }, durationS: duration, - onComplete: settleTiles, + onComplete, }, ); return; @@ -521,9 +584,9 @@ export function createStoriesController({ port.flyToBounds( { center: fromDegrees(lon, lat), radius: 0 }, { - offset: { heading: 0, pitch: (-60 * Math.PI) / 180, range: alt }, + offset: { heading: 0, pitch, range: alt }, durationS: duration, - onComplete: settleTiles, + onComplete, }, ); } @@ -743,7 +806,16 @@ export function createStoriesController({ // is back. drawThumbs(); }; - if (!saved?.ranScene) return frame(); + // The aim centres the story in Explore's visible map, which is measured + // once Explore has rendered. + const root = document.getElementById('gev-stories'); + const whenLaidOut = (run) => + root && !root.querySelector('.ex-map') + ? nextTick(() => { + 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. diff --git a/src/stories/controller.test.mjs b/src/stories/controller.test.mjs index 83b10c676..429f1f4ca 100644 --- a/src/stories/controller.test.mjs +++ b/src/stories/controller.test.mjs @@ -7,6 +7,8 @@ import assert from 'node:assert/strict'; import { createPinia, setActivePinia } from 'pinia'; import { createStateChannel } from '../app/stateChannel.js'; import { bindRenderer } from '../render/rendererOf.js'; +import { getRenderGovernorDiagnostics } from '../renderGovernor.js'; +const holds = () => getRenderGovernorDiagnostics().holds; registerHooks({ load(url, context, next) { @@ -110,16 +112,19 @@ function fakeClock(state = {}) { playing: false, rate: 1, stepping: false, + jumps: 0, ...state, }, getState: () => ({ ...clock.state }), goLive() { calls.push(['goLive']); Object.assign(clock.state, { live: true, playing: false }); + clock.state.jumps += 1; }, seek(ms) { calls.push(['seek', ms]); Object.assign(clock.state, { live: false, timeMs: ms }); + clock.state.jumps += 1; }, pause() { calls.push(['pause']); @@ -1107,13 +1112,20 @@ test('Explore frames country level straight down, a picked story at −60°, and globe.settled = true; frame.draw(); assert.equal(frame.listeners.size, 1, 'settled: only the pins listen'); + assert.ok(!holds().includes('stories-tiles'), 'settled: the hold is let go'); // ...and for 10 s at most. globe.settled = false; picked.onComplete(); assert.equal(frame.listeners.size, 2); + assert.ok(holds().includes('stories-tiles'), 'frames held while settling'); t.mock.timers.tick(10000); assert.equal(frame.listeners.size, 1, 'given up after 10 s'); + assert.ok(!holds().includes('stories-tiles'), 'given up: the hold is let go'); + // Close lets go of a hold still waiting. + picked.onComplete(); + assert.ok(holds().includes('stories-tiles')); controller.destroy(); + assert.ok(!holds().includes('stories-tiles'), 'closed: the hold is let go'); }); test('Close puts back the world clock the person had, and the camera readout follows a story', async () => { @@ -1128,7 +1140,7 @@ test('Close puts back the world clock the person had, and the camera readout fol frame.draw(); assert.deepEqual(store.camera, { lat: 28.65, lon: 11.46, altKm: 2000 }); // A scene moved the world clock. - clock.state = { ...clock.state, live: true }; + clock.state = { ...clock.state, live: true, jumps: clock.state.jumps + 1 }; await controller.close(); assert.equal(camera.views.length, 1); assert.deepEqual(clock.calls, [['pause'], ['seek', Date.UTC(2025, 5, 1)]]); @@ -1139,3 +1151,124 @@ test('Close puts back the world clock the person had, and the camera readout fol assert.deepEqual(clock.calls, []); controller.destroy(); }); + +test('Close puts a live clock back live, and a playing clock plays on from where it would be', async (t) => { + t.mock.timers.enable({ apis: ['setTimeout', 'Date'], now: 1_000_000 }); + // Live: a scene seeked the clock; Close goes live again. + const live = fakeClock({ live: true }); + const a = setup({ clock: live }); + a.controller.open(); + live.seek(Date.UTC(2020, 0, 1)); + live.calls.length = 0; + const closingA = a.controller.close({ fromHistory: true }); + t.mock.timers.tick(100); + await closingA; + assert.deepEqual(live.calls, [['goLive']]); + a.controller.destroy(); + // Playing at 2×: paused by a scene; Close seeks to where it would be + // after the time Stories was open, and plays on at its rate. + const playing = fakeClock({ + live: false, + playing: true, + rate: 2, + timeMs: Date.UTC(2025, 0, 1), + }); + const b = setup({ clock: playing }); + b.controller.open(); + playing.pause(); + playing.seek(Date.UTC(2019, 0, 1)); + playing.calls.length = 0; + t.mock.timers.tick(5000); + const closingB = b.controller.close({ fromHistory: true }); + t.mock.timers.tick(100); + await closingB; + const seek = playing.calls.find(([name]) => name === 'seek'); + assert.ok( + Math.abs(seek[1] - (Date.UTC(2025, 0, 1) + 5100 * 2)) <= 200, + 'extrapolated by the time away at its rate', + ); + assert.deepEqual(playing.calls.at(-1), [ + 'play', + { rate: 2, continuous: true }, + ]); + b.controller.destroy(); +}); + +test('a playing clock nothing moved is left alone on Close, even if it fell behind', async (t) => { + t.mock.timers.enable({ apis: ['setTimeout', 'Date'], now: 1_000_000 }); + const clock = fakeClock({ + live: false, + playing: true, + rate: 1, + timeMs: Date.UTC(2025, 0, 1), + }); + const { controller } = setup({ clock }); + controller.open(); + // Held by buffering: no jump, same mode and rate, but behind the wall. + t.mock.timers.tick(30000); + const closing = controller.close({ fromHistory: true }); + t.mock.timers.tick(100); + await closing; + assert.deepEqual(clock.calls, []); + controller.destroy(); +}); + +test('the clock comes back after the share state on Close, so a shared paused time does not stop a playing clock', async (t) => { + t.mock.timers.enable({ apis: ['setTimeout', 'Date'], now: 1_000_000 }); + const clock = fakeClock({ + live: false, + playing: true, + rate: 1, + timeMs: Date.UTC(2025, 0, 1), + }); + const { controller, director } = setup({ clock }); + // The share state arrives with its world time paused. + director.styleManager.shareLinkManager.restore = () => { + clock.pause(); + clock.seek(Date.UTC(2025, 0, 1)); + return true; + }; + controller.open(); + controller.openStory('gev:bhote-koshi-nepal-scene'); + clock.pause(); + const closing = controller.close({ fromHistory: true }); + t.mock.timers.tick(100); + await closing; + assert.equal(clock.state.playing, true, 'playing again after the share'); + controller.destroy(); +}); + +test('Explore aims a story at the middle of the visible map, not of the canvas', () => { + const { controller, store, camera, canvas } = setup(); + canvas.getBoundingClientRect = () => ({ + left: 0, + top: 0, + width: 400, + height: 800, + }); + // Explore's map is the top half of an 800 px canvas (a phone's sheet + // below it). + const root = document.createElement('div'); + root.id = 'gev-stories'; + const map = document.createElement('div'); + map.className = 'ex-map'; + root.append(map); + document.body.append(root); + map.getBoundingClientRect = () => ({ + left: 0, + top: 0, + width: 400, + height: 400, + }); + controller.open(); + const story = store.stories[0]; + controller.pick(null); + const flight = camera.flights.at(-1); + const { lat } = story.area ?? story.cover; + assert.ok( + flight.destination.lat < lat, + 'aims south, so the story shows above the sheet', + ); + root.remove(); + controller.destroy(); +}); diff --git a/src/stories/format.js b/src/stories/format.js index 8a146fb92..827a3b8f3 100644 --- a/src/stories/format.js +++ b/src/stories/format.js @@ -34,13 +34,26 @@ export function creditPlacement({ map, feed, width, height }) { * Where the Stories button sits: just left of the leftmost visible control * in GEV's top-right corner — the ACTIVE STYLE readout in GEV, the account * avatar (with or beside the readout) in GEV Hosted — top-aligned with it. + * Where none of those shows (GEV's phone layout, whose top row of icon + * buttons spans the corner), it goes icon-only just under the right-hand + * column of corner actions, aligned with its right edge. * @param {Array} corner The corner controls' boxes. * @param {number} width The window's width. - * @returns {{top: number, right: number}} Pixels from the top and right. + * @param {DOMRect|null} [column] The corner-actions column's box. + * @returns {{top: number, right: number, compact?: boolean}} Pixels from + * the top and right; `compact` for the icon-only button. */ -export function entryPlacement(corner, width) { +export function entryPlacement(corner, width, column = null) { const shown = corner.filter((r) => r && r.width > 0 && r.height > 0); - if (!shown.length) return { top: 14, right: 14 }; - const left = shown.reduce((a, b) => (b.left < a.left ? b : a)); - return { top: left.top, right: width - left.left + 10 }; + if (shown.length) { + const left = shown.reduce((a, b) => (b.left < a.left ? b : a)); + return { top: left.top, right: width - left.left + 10 }; + } + if (column && column.width > 0 && column.height > 0) + return { + top: Math.round(column.bottom + 8), + right: Math.round(width - column.right), + compact: true, + }; + return { top: 14, right: 14 }; } diff --git a/src/stories/gevPlayer.test.mjs b/src/stories/gevPlayer.test.mjs index bcbb5ad91..6922e33a2 100644 --- a/src/stories/gevPlayer.test.mjs +++ b/src/stories/gevPlayer.test.mjs @@ -18,7 +18,12 @@ function deferredDirector({ running = false } = {}) { running, calls, listShots: () => [{ id: 'a' }, { id: 'b' }], - subscribeSceneClock: () => () => {}, + // The scene clock's listener, so a test can publish as the director + // does after a seek or at a run's end. + subscribeSceneClock: (fn) => { + director.publish = (snap) => fn({ sceneId: 'scene-1', ...snap }); + return () => {}; + }, stopScene: () => calls.push('stop'), whenIdle() { return new Promise((resolve) => { @@ -114,7 +119,11 @@ test('Play from a paused link in the final quarter-second stays in the final sho player.seek(59800); // 200 ms before the end of a two-shot scene const playing = player.play(); await turns(); - assert.equal(player.state.wallMs, 59800, 'the link is not treated as complete'); + assert.equal( + player.state.wallMs, + 59800, + 'the link is not treated as complete', + ); assert.equal(director.startAfterShotId, 'a', 'resume in the final shot'); director.finishRun(); await playing; @@ -141,3 +150,42 @@ test('Destroy cancels a waiting Play', async () => { await playing; assert.equal(director.calls.includes('start'), false); }); + +test('in the director’s order, a paused link near the end resumes in its final shot', async () => { + const director = deferredDirector(); + const player = createGevPlayer(director, story); + player.seek(59800); + // The director reports a seek as seeking, even once it has settled. + director.publish({ + sceneDurationSec: 60, + sceneElapsedSec: 59.8, + shotIndex: 1, + running: false, + seeking: true, + }); + assert.equal(player.state.wallMs, 59800, 'not rounded to the end'); + const playing = player.play(); + await turns(); + assert.equal(director.startAfterShotId, 'a', 'resume in the final shot'); + director.finishRun(); + await playing; +}); + +test('a run that ends on its own is rounded to the end, and Play then starts over', async () => { + const director = deferredDirector(); + const player = createGevPlayer(director, story); + // The director reports a run's natural end as stopped, not seeking. + director.publish({ + sceneDurationSec: 60, + sceneElapsedSec: 59.9, + shotIndex: 1, + running: false, + }); + assert.equal(player.state.wallMs, 60000, 'rounded to the end'); + const playing = player.play(); + await turns(); + assert.equal(player.state.wallMs, 0); + assert.equal(director.startAfterShotId, null, 'from the first shot'); + director.finishRun(); + await playing; +}); diff --git a/src/stories/thumbs.js b/src/stories/thumbs.js index b20cfa3d9..d300fd0df 100644 --- a/src/stories/thumbs.js +++ b/src/stories/thumbs.js @@ -4,14 +4,15 @@ * the same tiles, from the same host, that GEV's Esri map draws (and credits * on screen); no other host is asked. */ +import { ESRI_TILES } from '../maps/globeEngine.js'; + const WIDTH = 320; const HEIGHT = 180; const TILE_SIZE = 256; const TILE_TRIES = 3; -/** Esri World Imagery's tiles: Web Mercator, as GEV's Esri map draws them. */ -export const ESRI_TILE_URL = - 'https://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}'; +/** Esri World Imagery's tiles: Web Mercator, the ones GEV's Esri map draws. */ +export const ESRI_TILE_URL = ESRI_TILES; const ESRI_MAX_LEVEL = 19; /** A zoom level that frames `range` metres of view, within the imagery's. */ diff --git a/src/ui/storiesCredit.test.mjs b/src/ui/storiesCredit.test.mjs index 4a551170e..177216c7e 100644 --- a/src/ui/storiesCredit.test.mjs +++ b/src/ui/storiesCredit.test.mjs @@ -146,4 +146,15 @@ test('the Stories button sits left of whatever is in the top-right corner', () = ); // Nothing there yet. assert.deepEqual(entryPlacement([null, null], 1960), { top: 14, right: 14 }); + // GEV's phone layout: no readout or avatar; icon-only under the corner + // actions column, aligned with its right edge. + assert.deepEqual( + entryPlacement([box(0, 0, 0, 0), null], 639, box(594, 60, 33, 70)), + { top: 138, right: 12, compact: true }, + ); + // A visible readout still wins over the column. + assert.deepEqual( + entryPlacement([box(400, 24, 200, 40), null], 639, box(594, 60, 33, 70)), + { top: 24, right: 249 }, + ); }); diff --git a/src/ui/styles/stories-entry.css b/src/ui/styles/stories-entry.css index 54c91439d..3de663dd4 100644 --- a/src/ui/styles/stories-entry.css +++ b/src/ui/styles/stories-entry.css @@ -241,3 +241,13 @@ body.ui-clean-view #gev-stories .gs-pop { #gev-stories .gs-hosted-toast { background: rgba(12, 12, 20, 0.95); } + +/* GEV's phone layout: icon-only, the size of the icon buttons beside it. */ +#gev-stories .gs-entry.gs-entry-compact { + width: 36px; + padding: 0; + justify-content: center; +} +#gev-stories .gs-entry.gs-entry-compact span { + display: none; +} diff --git a/src/ui/styles/stories.css b/src/ui/styles/stories.css index 5613ceeb0..c117d5ef3 100644 --- a/src/ui/styles/stories.css +++ b/src/ui/styles/stories.css @@ -379,7 +379,7 @@ padding: 0; justify-content: center; } - #gev-stories .scr-story .s-head .h-right .tbtn span { + #gev-stories .scr-story .s-head .h-right .tbtn span:not(.share-icon) { display: none; } } @@ -3562,7 +3562,12 @@ border-radius: 50%; border-color: var(--glass-border-hover); } - #gev-stories #scrExplore .s-head .h-right .tbtn.hide-m:not(.accent) span { + #gev-stories + #scrExplore + .s-head + .h-right + .tbtn.hide-m:not(.accent) + span:not(.share-icon) { display: none; } #gev-stories #scrExplore .s-head .h-right .tbtn.hide-m:not(.accent) svg { @@ -3805,10 +3810,13 @@ body.stories-mode:not(#gs-a):not(#gs-b) #gev-credits { 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); +/* The application's credit list opens just above its line, wherever that is; + on a phone it keeps the application's full-screen list. */ +@media (min-width: 576px) { + 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. */ diff --git a/src/ui/views/StoriesView.vue b/src/ui/views/StoriesView.vue index 4e3944e64..917fd2383 100644 --- a/src/ui/views/StoriesView.vue +++ b/src/ui/views/StoriesView.vue @@ -39,11 +39,14 @@ const reduceMotion = () => // GEV has its ACTIVE STYLE readout there; GEV Hosted adds the account // avatar, which can come after Stories mounts (sign-in). const CORNER = ['style-indicator', 'account-control']; +// GEV's phone layout shows neither; the button then sits under this column. +const COLUMN = 'corner-actions'; const entry = ref({ top: 14, right: 14 }); function placeEntry() { entry.value = entryPlacement( CORNER.map((id) => document.getElementById(id)?.getBoundingClientRect()), innerWidth, + document.getElementById(COLUMN)?.getBoundingClientRect() ?? null, ); } let entryTries = 0; @@ -63,7 +66,7 @@ function watchCorner() { }); } if (globalThis.ResizeObserver) cornerObserver ??= new ResizeObserver(placeEntry); - for (const id of CORNER) { + for (const id of [...CORNER, COLUMN]) { const el = document.getElementById(id); if (el && cornerObserver && !observed.has(el)) { cornerObserver.observe(el); @@ -71,7 +74,7 @@ function watchCorner() { } } // Keep looking for a while for a control that mounts late. - if (observed.size < CORNER.length && ++entryTries < 20) + if (observed.size < CORNER.length + 1 && ++entryTries < 20) entryTimer = setTimeout(watchCorner, 1000); } @@ -298,7 +301,9 @@ watch([mode, storyId], () => nextTick(watchCredit));