Merge branch 'main' into fix/bikeshare-coverage

This commit is contained in:
Sameh Khamis authored and GitHub committed 2026-11-17 20:40:53 -08:00
commit 3fa3756ca4
26 files changed
+195 -32

No files matched your search

+8
View File
@@ -8,6 +8,9 @@ import { useDisplayStore } from '../ui/stores/display.js';
import { applicationPinia } from '../ui/vueRuntime.js';
import { t } from '../i18n/index.js';
/** Where the camera starts unless a host gives a `startView`. */
export { START_VIEW };
/**
* Construct the existing controls and camera presentation. `initialShareCode`
* opens a share code (the `<code>` of `/share/<code>`) at start-up, for a host
@@ -15,6 +18,9 @@ import { t } from '../i18n/index.js';
* picker, for a host that offers its own language choice (`switchLocale` from
* the `./i18n` entry). `startView` is where the camera starts (the whole
* planet by default; a host may pass a city); a shared view flies from there.
* `homeView` is where the title's logo goes back to (with the clock live): the
* start view unless given, for a host whose `startView` only carries a view
* across a rebuild.
* `services.cockpitSubjects` adds the application's own first-person subjects
* to the Cockpit (src/cockpitSubjectProviders.js).
*/
@@ -29,6 +35,7 @@ export function createApplicationControls({
initialShareCode = null,
localePicker = true,
startView = START_VIEW,
homeView = startView,
}) {
// Every boot starts from the same view, before share restoration flies on.
applyStartView(viewer, startView);
@@ -51,6 +58,7 @@ export function createApplicationControls({
// A share code to open at start-up instead of the page's address.
initialShareCode,
localePicker,
homeView,
});
defer(() => styleManager.orbitController.stop());
defer(() => styleManager.hud.destroy());
+2 -1
View File
@@ -4547,5 +4547,6 @@
"KT": "عقدة",
"Course to {code}: {course}": "المسار إلى {code}: {course}",
"Over {place}": "فوق {place}",
"Below": "في الأسفل"
"Below": "في الأسفل",
"Back to live at the starting view": "العودة إلى البث المباشر في العرض الأولي"
}
+2 -1
View File
@@ -4135,5 +4135,6 @@
"KT": "KT",
"Course to {code}: {course}": "Kurs nach {code}: {course}",
"Over {place}": "Über {place}",
"Below": "Darunter"
"Below": "Darunter",
"Back to live at the starting view": "Zurück zu Live in der Startansicht"
}
+2 -1
View File
@@ -4238,5 +4238,6 @@
"KT": "KT",
"Course to {code}: {course}": "Rumbo a {code}: {course}",
"Over {place}": "Sobre {place}",
"Below": "Debajo"
"Below": "Debajo",
"Back to live at the starting view": "Volver al directo en la vista inicial"
}
+2 -1
View File
@@ -4238,5 +4238,6 @@
"KT": "KT",
"Course to {code}: {course}": "Cap vers {code} : {course}",
"Over {place}": "Au-dessus de {place}",
"Below": "En dessous"
"Below": "En dessous",
"Back to live at the starting view": "Revenir au direct dans la vue de départ"
}
+2 -1
View File
@@ -4238,5 +4238,6 @@
"KT": "KT",
"Course to {code}: {course}": "כיוון אל {code}: {course}",
"Over {place}": "מעל {place}",
"Below": "מתחת"
"Below": "מתחת",
"Back to live at the starting view": "חזרה לשידור החי בתצוגת הפתיחה"
}
+2 -1
View File
@@ -4238,5 +4238,6 @@
"KT": "KT",
"Course to {code}: {course}": "Rotta verso {code}: {course}",
"Over {place}": "Sopra {place}",
"Below": "Sotto"
"Below": "Sotto",
"Back to live at the starting view": "Torna alla diretta nella vista iniziale"
}
+2 -1
View File
@@ -4032,5 +4032,6 @@
"KT": "KT",
"Course to {code}: {course}": "{code}への針路: {course}",
"Over {place}": "{place}上空",
"Below": "直下"
"Below": "直下",
"Back to live at the starting view": "ライブに戻り、最初の表示へ"
}
+2 -1
View File
@@ -4238,5 +4238,6 @@
"KT": "KT",
"Course to {code}: {course}": "Rumo para {code}: {course}",
"Over {place}": "Sobre {place}",
"Below": "Abaixo"
"Below": "Abaixo",
"Back to live at the starting view": "Voltar ao vivo na vista inicial"
}
+2 -1
View File
@@ -4341,5 +4341,6 @@
"KT": "УЗ",
"Course to {code}: {course}": "Курс на {code}: {course}",
"Over {place}": "Над: {place}",
"Below": "Под спутником"
"Below": "Под спутником",
"Back to live at the starting view": "Вернуться в прямой эфир в начальном виде"
}
+2 -1
View File
@@ -4135,5 +4135,6 @@
"KT": "KT",
"Course to {code}: {course}": "Kurs mot {code}: {course}",
"Over {place}": "Över {place}",
"Below": "Nedanför"
"Below": "Nedanför",
"Back to live at the starting view": "Tillbaka till live i startvyn"
}
+2 -1
View File
@@ -4341,5 +4341,6 @@
"KT": "ВУЗ",
"Course to {code}: {course}": "Курс на {code}: {course}",
"Over {place}": "Над: {place}",
"Below": "Під супутником"
"Below": "Під супутником",
"Back to live at the starting view": "Повернутися до прямого ефіру в початковому вигляді"
}
+2 -1
View File
@@ -4032,5 +4032,6 @@
"KT": "kt",
"Course to {code}: {course}": "前往 {code} 的航向:{course}",
"Over {place}": "{place}上空",
"Below": "下方"
"Below": "下方",
"Back to live at the starting view": "回到实时并返回初始视图"
}
+2 -1
View File
@@ -4032,5 +4032,6 @@
"KT": "kt",
"Course to {code}: {course}": "前往 {code} 的航向:{course}",
"Over {place}": "{place}上空",
"Below": "下方"
"Below": "下方",
"Back to live at the starting view": "回到實時並返回初始視圖"
}
+1 -1
View File
@@ -73,7 +73,7 @@ test('any other camera destination clears the search label too', () => {
assert.match(shellMethod('_stampNavigation').toString(), /if \(clearSearchedLocation\) this\.clearLocation\(\);/);
// The shared funnel is what the reset and voice seams actually reach.
for (const seam of ['resetToGlobeView() {', 'beginLocationNavigation() {', '_runExplicitNavigation(']) {
for (const seam of ['resetToGlobeView({ view = null } = {}) {', 'beginLocationNavigation() {', '_runExplicitNavigation(']) {
const at = ui.indexOf(seam);
assert.ok(at > 0, `missing navigation seam "${seam}"`);
assert.match(shellMethod(seam.match(/^(\w+)/)[1]).toString(), /_stampNavigation\(/, `"${seam}" must stamp navigation`);
+17 -7
View File
@@ -32,21 +32,31 @@ export const GLOBE_VIEW = Object.freeze({
/**
* Fly straight out to the full-earth globe view, keeping the current sub-camera
* point centered so the user's continent stays in front of them.
* point centered so the user's continent stays in front of them. With `view`
* (`{ lon, lat, height, heading?, pitch? }`, angles in degrees, as the start
* view is given), fly to that view instead.
* @param {object} viewer
* @param {{duration?: number, onComplete?: Function, onCancel?: Function}} options
* @param {{duration?: number, onComplete?: Function, onCancel?: Function,
* view?: {lon: number, lat: number, height: number, heading?: number,
* pitch?: number}}} options
* @returns {{latitude: number, longitude: number, heightM: number}}
*/
export function flyToGlobeView(viewer, options = {}) {
const camera = cameraOf(viewer);
const { lon: longitude, lat: latitude } = camera.pose();
const here = camera.pose();
const view = options.view ?? {
lon: here.lon,
lat: here.lat,
height: GLOBE_VIEW.heightM,
};
const { lon: longitude, lat: latitude, height: heightM } = view;
camera.cancelFlight();
camera.flyTo(
{ lon: longitude, lat: latitude, height: GLOBE_VIEW.heightM },
{ lon: longitude, lat: latitude, height: heightM },
{
orientation: {
heading: 0,
pitch: toRadians(GLOBE_VIEW.pitchDeg),
heading: toRadians(view.heading ?? 0),
pitch: toRadians(view.pitch ?? GLOBE_VIEW.pitchDeg),
roll: 0,
},
durationS: finitePositive(options.duration) || GLOBE_VIEW.durationS,
@@ -55,7 +65,7 @@ export function flyToGlobeView(viewer, options = {}) {
onCancel: options.onCancel,
},
);
return { latitude, longitude, heightM: GLOBE_VIEW.heightM };
return { latitude, longitude, heightM };
}
/**
+15
View File
@@ -631,6 +631,21 @@ test('a globe flight without callbacks still flies (both hooks are optional)', (
viewer.flights[0].complete();
});
test('a globe flight to a given view flies there, not out over the current spot', () => {
const viewer = stubViewer();
const target = flyToGlobeView(viewer, {
view: { lon: -82.5, lat: 35, height: 23000000 },
});
assert.deepEqual(target, { latitude: 35, longitude: -82.5, heightM: 23000000 });
const flight = viewer.flights[0];
const end = Cesium.Cartographic.fromCartesian(flight.destination);
assert.ok(Math.abs(Cesium.Math.toDegrees(end.longitude) + 82.5) < 1e-6);
assert.ok(Math.abs(Cesium.Math.toDegrees(end.latitude) - 35) < 1e-6);
assert.ok(Math.abs(end.height - 23000000) < 1);
assert.equal(flight.orientation.heading, 0);
assert.ok(Math.abs(flight.orientation.pitch + Math.PI / 2) < 1e-9);
});
test('geocoded Location branches forward the resolved-navigation ownership hook', () => {
const source = fs.readFileSync(new URL('./locations.js', import.meta.url), 'utf8');
const searchStart = source.indexOf('export async function searchAndFlyTo');
+11 -1
View File
@@ -106,6 +106,9 @@ export class StyleManager extends ShellFacade {
* @param {object} [options]
* @param {boolean} [options.localePicker=true] - false removes the language
* picker, for a host that offers its own language choice.
* @param {{lon: number, lat: number, height: number, heading?: number,
* pitch?: number}|null} [options.homeView] - where the title's logo goes
* back to (degrees): the view the app started from.
*/
constructor(
viewer,
@@ -116,6 +119,7 @@ export class StyleManager extends ShellFacade {
requestServices,
initialShareCode = null,
localePicker = true,
homeView = null,
} = {},
) {
super();
@@ -341,6 +345,7 @@ export class StyleManager extends ShellFacade {
this._locationNavigation = new LocationNavigation({
viewer,
placeSearch,
homeView,
navigation: this._navigation,
readCockpit: () => this.cockpitView,
services: {
@@ -1717,7 +1722,12 @@ export class StyleManager extends ShellFacade {
const store = useGlobeActionsStore(applicationPinia());
if (this._resetToken) store.detach(this._resetToken);
this._resetToken = controls
? store.connect({ reset: () => controls.reset() })
? store.connect({
reset: () => controls.reset(),
home: () => {
if (!this._disposed) void this.returnToStart();
},
})
: null;
// A reset under way as the controls are replaced stays on the buttons.
if (this._resetToken && this._globeResetting != null)
+32
View File
@@ -48,3 +48,35 @@ test('the FPS readout sits in the title bar, hidden until the backquote key', as
await nextTick();
assert.equal(readout(), null);
});
test('the title logo is a button that asks for the way back to live at the start view', async (t) => {
document.body.replaceChildren();
const pinia = createPinia();
const app = createApp(SceneChromeView).use(pinia);
app.mount(document.body.appendChild(document.createElement('div')));
t.after(() => app.unmount());
const { useGlobeActionsStore } = await import('./stores/globeActions.js');
const calls = [];
useGlobeActionsStore(pinia).connect({ home: () => calls.push('home') });
const logo = document.querySelector('#title-bar h1 > button.title-logo');
assert.ok(logo, 'the logo is the title heading’s button');
assert.equal(
logo.getAttribute('aria-label'),
'Back to live at the starting view',
);
assert.ok(logo.hasAttribute('data-logo-gaze'));
logo.click();
assert.deepEqual(calls, ['home']);
});
test('the title heading keeps its own name beside the logo button', async (t) => {
document.body.replaceChildren();
const app = createApp(SceneChromeView).use(createPinia());
app.mount(document.body.appendChild(document.createElement('div')));
t.after(() => app.unmount());
const heading = document.querySelector('#title-bar h1');
const named = document.getElementById(
heading.getAttribute('aria-labelledby'),
);
assert.equal(named.textContent.replace(/\s+/g, ' ').trim(), "GOD'S EYE VIEW");
});
+25 -7
View File
@@ -3,6 +3,7 @@ import { stopFollowing } from '../data/followed.js';
import { t } from '../i18n/index.js';
import { createStateChannel } from '../app/stateChannel.js';
import { LocationControls } from './location.js';
import { worldClock } from '../time/worldClock.js';
/** Own destination selection, lookup, orbit and world-jump lifetime. */
export class LocationNavigation {
@@ -14,10 +15,11 @@ export class LocationNavigation {
navigation,
readCockpit,
operations,
homeView = null,
}) {
Object.assign(
this,
{ viewer, placeSearch, services, navigation, readCockpit },
{ viewer, placeSearch, services, navigation, readCockpit, homeView },
elements,
operations,
);
@@ -315,7 +317,24 @@ export class LocationNavigation {
}
}
resetToGlobeView() {
/**
* Back to live, at the view the app started from (the logo): the world
* clock goes live and the camera flies to the start view as the globe reset
* does, letting go of whatever it follows.
*/
returnToStart() {
if (!this._disposed) worldClock.goLive();
if (!this.homeView) return this.resetToGlobeView();
// A globe reset under way flies elsewhere: this one replaces it.
this._cancelGlobeReset?.();
return this.resetToGlobeView({ view: this.homeView });
}
/**
* Fly out to the full globe over the current spot, or to `view` (the start
* view's shape: `{ lon, lat, height, heading?, pitch? }`, degrees).
*/
resetToGlobeView({ view = null } = {}) {
const {
GLOBE_VIEW,
flyToGlobeView,
@@ -374,6 +393,7 @@ export class LocationNavigation {
camera?.release();
this._beginWorldJumpTransition();
const heightM = view?.height ?? GLOBE_VIEW.heightM;
let resolveReset;
const resetPromise = new Promise((resolve) => {
resolveReset = resolve;
@@ -391,7 +411,7 @@ export class LocationNavigation {
ok: !cancelled,
action: 'zoom_to_globe',
cancelled,
heightKm: Math.round(GLOBE_VIEW.heightM / 1000),
heightKm: Math.round(heightM / 1000),
centeredOn: {
latitude: Number.isFinite(pose?.lat)
? Number(pose.lat.toFixed(2))
@@ -409,15 +429,13 @@ export class LocationNavigation {
this._cancelGlobeReset = () => finish(true);
timer = window.setTimeout(() => {
const height = findCamera(this.viewer)?.pose().height;
finish(
!Number.isFinite(height) ||
Math.abs(height - GLOBE_VIEW.heightM) > 1000,
);
finish(!Number.isFinite(height) || Math.abs(height - heightM) > 1000);
}, 4200);
this._publishGlobeResetting?.(true);
const target = flyToGlobeView(this.viewer, {
onComplete: () => finish(false),
onCancel: () => finish(true),
...(view ? { view } : {}),
});
if (!target) finish(true);
return resetPromise;
+5
View File
@@ -1294,6 +1294,11 @@ export class ShellFacade {
return this._locationNavigation.resetToGlobeView(...args);
}
/** Back to live, at the view the app started from (the title's logo). */
returnToStart() {
return this._locationNavigation.returnToStart();
}
/**
* Displays a temporary toast notification for 2 seconds.
* @param {string} message - Text to show in the toast.
+26 -2
View File
@@ -3,6 +3,7 @@ import test from 'node:test';
import { LocationNavigation } from './locationNavigation.js';
import { LayerBindings } from './layerBindings.js';
import { bindRenderer } from '../render/rendererOf.js';
import { worldClock } from '../time/worldClock.js';
function replaceWindow(t, value) {
const previous = Object.getOwnPropertyDescriptor(globalThis, 'window');
@@ -13,12 +14,13 @@ function replaceWindow(t, value) {
});
}
function location(t) {
function location(t, { homeView = null } = {}) {
t.mock.timers.enable({ apis: ['setTimeout'] });
replaceWindow(t, { setTimeout });
const calls = [];
let hooks;
const owner = new LocationNavigation({
homeView,
viewer: { camera: {
cancelFlight() {}, lookAtTransform() {},
positionCartographic: { latitude: 0, longitude: 0, height: 20000000 },
@@ -26,7 +28,11 @@ function location(t) {
services: {
OrbitController: class { stop() { calls.push('orbit-stop'); } },
GLOBE_VIEW: { heightM: 20000000 },
flyToGlobeView(_viewer, callbacks) { hooks = callbacks; return {}; },
flyToGlobeView(_viewer, callbacks) {
hooks = callbacks;
calls.push(callbacks.view ? `fly ${callbacks.view.lat},${callbacks.view.lon}` : 'fly here');
return {};
},
interruptCameraMotion() {},
militaryAwarenessLayer: {}, satellitesLayer: {}, rocketLaunchesLayer: {},
trafficLayer: {
@@ -60,6 +66,24 @@ test('shell disposal settles a pending globe reset once and revokes its timeout'
assert.equal((await owner.resetToGlobeView()).cancelled, true);
});
test('the logo goes live and flies to the home view, replacing a globe reset under way', async (t) => {
const { owner, calls, readHooks } = location(t, {
homeView: { lon: -82.5, lat: 35, height: 23000000 },
});
worldClock.seek(Date.now() - 3 * 3600 * 1000);
assert.equal(worldClock.isLive(), false);
const reset = owner.resetToGlobeView();
const home = owner.returnToStart();
assert.notEqual(home, reset);
assert.equal((await reset).cancelled, true);
assert.equal(worldClock.isLive(), true);
assert.deepEqual(calls.filter((c) => c.startsWith('fly')), ['fly here', 'fly 35,-82.5']);
readHooks().onComplete();
assert.equal((await home).cancelled, false);
assert.equal((await home).heightKm, 23000);
owner.destroy();
});
test('world jump completion cannot revive navigation after shell disposal', (t) => {
const { owner, calls } = location(t);
let complete;
+17
View File
@@ -632,6 +632,23 @@ body.cockpit-mode #cockpit-cloud-effects.active {
filter: drop-shadow(0 0 12px rgba(0, 246, 255, 0.5));
}
/* The logo is a button: back to live at the start view. */
#title-bar button.title-logo {
padding: 0;
border: 0;
background: none;
color: inherit;
font: inherit;
cursor: pointer;
pointer-events: auto;
}
#title-bar button.title-logo:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 4px;
border-radius: 8px;
}
#title-bar .title-logo::before,
#title-bar .title-logo::after {
--radio-broadcast-opacity: 0.28;
+4 -1
View File
@@ -18,9 +18,12 @@ import ScreenAnnotations from './panels/ScreenAnnotations.vue';
import AwarenessDirection from './panels/AwarenessDirection.vue';
import UiButton from '../kit/UiButton.vue';
import GlobeActions from './panels/GlobeActions.vue';
import { useGlobeActionsStore } from '../stores/globeActions.js';
import RenderFailure from './panels/RenderFailure.vue';
import WorldTimeline from './panels/WorldTimeline.vue';
// The title's logo goes back to live at the start view, as the shell answers it.
const globeActions = useGlobeActionsStore();
// The ACTIVE STYLE corner shows the style VisualSettings publishes.
const { style } = storeToRefs(useDisplayStore());
// The status chips, toast and FPS readout show what ShellFeedback,
@@ -74,7 +77,7 @@ const vToastText = {
<!-- Title -->
<div id="title-bar">
<div class="title-glow"></div>
<h1><span class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" aria-hidden="true"><img src="/logo.svg" alt="" /></span> <span translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<h1 aria-labelledby="title-wordmark"><button type="button" class="title-logo brand-logo" data-logo-gaze data-logo-src="/logo.svg" :aria-label="t('Back to live at the starting view')" :title="t('Back to live at the starting view')" @click="globeActions.act('home')"><img src="/logo.svg" alt="" /></button> <span id="title-wordmark" translate="no">GOD'S EYE <span class="title-accent">VIEW</span></span></h1>
<p class="subtitle scene-text-holdout">{{ t('NO PLACE LEFT BEHIND') }}</p>
<div v-if="fps" class="frame-rate-readout scene-text-holdout" :hidden="!fps.visible" :title="t('Rendered globe frames per second · toggle with `')">{{ fps.text }}</div>
</div>