The title logo goes back to live at the starting view

The logo in the title was only a picture. It is now a button, "Back to
live at the starting view": the world clock goes live and the camera flies
to the view the app started from, letting go of whatever it follows as
Reset Globe does.

The shell's returnToStart() does it. It flies to the `homeView` option of
createApplicationControls, which is the start view unless given: an
application that passes `startView` only to carry a view across a rebuild
can keep the logo on its own first view. START_VIEW is exported from
./application/controls for that.

The title heading keeps "GOD'S EYE VIEW" as its name beside the button.
This commit is contained in:
Sameh Khamis committed 2026-11-17 19:48:46 -08:00
1 parent 4c90c065be
commit f5d3521cda
25 files changed
+191 -32

No files matched your search

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