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

+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>