mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-23 11:42:21 +00:00
Merge upstream main into feat/iss-3d-model
Translation files: kept both sides' new keys. public/models/README.md: main's procedural fleet text, with a section for NASA's ISS model, the one model outside the fleet set; DATA_SOURCES.md notes that exception. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
becdbc9412
256 files changed
+10406
-2821
No files matched your search
@@ -96,7 +96,7 @@ export class StyleManager extends ShellFacade {
|
||||
* @param {Cesium.Viewer} viewer - The CesiumJS viewer instance.
|
||||
* @param {object} [options]
|
||||
* @param {boolean} [options.localePicker=true] - false removes the language
|
||||
* picker, for a host that does not initialize Core's locale.
|
||||
* picker, for a host that offers its own language choice.
|
||||
*/
|
||||
constructor(
|
||||
viewer,
|
||||
@@ -764,7 +764,7 @@ export class StyleManager extends ShellFacade {
|
||||
this._lifetime.own(
|
||||
onLocaleChange(() => nextTick(() => this._sizeDisplayLabelColumn())),
|
||||
);
|
||||
// A host that does not initialize Core's locale shows no picker.
|
||||
// A host that offers its own language choice shows no picker.
|
||||
if (this._localePickerEnabled === false) return;
|
||||
this._publishLocalePicker();
|
||||
}
|
||||
|
||||
@@ -10,7 +10,8 @@ const STYLE_KEYS = Object.freeze({
|
||||
/**
|
||||
* Bind the application's existing bubbling keyboard shortcuts.
|
||||
* Capture-phase surfaces keep first refusal. The caller owns each action and
|
||||
* persistence; form controls keep native typing except for Escape.
|
||||
* persistence; form controls keep native typing except for Escape, and a key
|
||||
* held with Cmd, Ctrl or Alt is left to the browser.
|
||||
* @param {object} options
|
||||
* @param {Document} options.documentRef Keyboard event target.
|
||||
* @param {HTMLElement} options.searchInput Additional editing target.
|
||||
@@ -27,6 +28,13 @@ export function bindApplicationShortcuts({
|
||||
event.target?.matches?.('select, input, textarea') ||
|
||||
event.target === searchInput;
|
||||
if (isFormControl && event.key !== 'Escape') return;
|
||||
// Cmd+C, Ctrl+F, Cmd+1 and the like belong to the browser and the system.
|
||||
// Shift is not a chord here: Shift+C is still C.
|
||||
if (
|
||||
(event.metaKey || event.ctrlKey || event.altKey) &&
|
||||
event.key !== 'Escape'
|
||||
)
|
||||
return;
|
||||
|
||||
if (STYLE_KEYS[event.key]) actions.setStyle(STYLE_KEYS[event.key]);
|
||||
if (event.key === 'Escape') actions.dismissSearch();
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import assert from 'node:assert/strict';
|
||||
import { test } from 'node:test';
|
||||
import { CctvControls } from './cctvControls.js';
|
||||
import { CCTV_FRAME_DECODE_WAIT_MS } from './cctvFrames.js';
|
||||
|
||||
function element() {
|
||||
const classes = new Set();
|
||||
@@ -59,6 +60,50 @@ test('a late image completion cannot replace a newer camera preview', (t) => {
|
||||
assert.equal(controls._frame.cameraId, 'b');
|
||||
});
|
||||
|
||||
test('a camera frame settles once decoded, and a stale decode cannot land', async (t) => {
|
||||
const { controls, requests } = fixture(t);
|
||||
const decodes = [];
|
||||
const queue = (src, id) => {
|
||||
controls._queueCctvFrame(src, id, true);
|
||||
const request = requests.at(-1);
|
||||
request.decode = () =>
|
||||
new Promise((resolve) => decodes.push({ src, resolve }));
|
||||
return request;
|
||||
};
|
||||
const first = queue('first.jpg', 'a');
|
||||
first.onload();
|
||||
assert.equal(controls._frame.hasFrame, false);
|
||||
const second = queue('second.jpg', 'b');
|
||||
second.onload();
|
||||
decodes[1].resolve();
|
||||
await Promise.resolve();
|
||||
decodes[0].resolve();
|
||||
await Promise.resolve();
|
||||
assert.equal(controls._frame.src, 'second.jpg');
|
||||
assert.equal(controls._frame.cameraId, 'b');
|
||||
assert.equal(controls._frame.hasFrame, true);
|
||||
});
|
||||
|
||||
test('a loaded frame shows when its decode rejects or never settles', async (t) => {
|
||||
t.mock.timers.enable({ apis: ['setTimeout'] });
|
||||
const { controls, requests } = fixture(t);
|
||||
controls._queueCctvFrame('broken.jpg', 'a', true);
|
||||
requests[0].decode = () => Promise.reject(new Error('EncodingError'));
|
||||
requests[0].onload();
|
||||
await Promise.resolve();
|
||||
await Promise.resolve();
|
||||
assert.equal(controls._frame.src, 'broken.jpg');
|
||||
assert.equal(controls._frame.hasFrame, true);
|
||||
|
||||
controls._queueCctvFrame('hidden.jpg', 'b', true);
|
||||
requests[1].decode = () => new Promise(() => {});
|
||||
requests[1].onload();
|
||||
assert.equal(controls._frame.hasFrame, false);
|
||||
t.mock.timers.tick(CCTV_FRAME_DECODE_WAIT_MS);
|
||||
assert.equal(controls._frame.src, 'hidden.jpg');
|
||||
assert.equal(controls._frame.hasFrame, true);
|
||||
});
|
||||
|
||||
test('failed refresh preserves settled pixels, but changing cameras clears them', (t) => {
|
||||
const { controls, requests } = fixture(t);
|
||||
controls._queueCctvFrame('first.jpg', 'a', true);
|
||||
|
||||
+25
-1
@@ -77,6 +77,9 @@ export function cctvSourceLabelText(label) {
|
||||
return SOURCE_LABELS[text] ? t(SOURCE_LABELS[text]) : text;
|
||||
}
|
||||
|
||||
/** Longest wait for a loaded frame's decode before it is shown anyway. */
|
||||
export const CCTV_FRAME_DECODE_WAIT_MS = 1000;
|
||||
|
||||
/** The preview before any frame: nothing requested, nothing shown. */
|
||||
export const EMPTY_CCTV_FRAME = Object.freeze({
|
||||
cameraId: '',
|
||||
@@ -127,7 +130,28 @@ export function _queueCctvFrame(src, cameraId, cameraChanged) {
|
||||
|
||||
const preloader = new Image();
|
||||
this._cctvFramePreloader = preloader;
|
||||
preloader.onload = () => this._settleCctvFrame(token, src, true);
|
||||
// Settle once the image is decoded, not merely loaded: the panel's <img>
|
||||
// then paints the frame the moment it takes the src, instead of showing
|
||||
// its empty box for the decode.
|
||||
// A decode that rejects after a load still has drawable data, as it was
|
||||
// before decoding was awaited. A decode that never settles (a hidden tab may
|
||||
// hold it until the page draws) shows the loaded frame after
|
||||
// CCTV_FRAME_DECODE_WAIT_MS rather than leaving the preview loading.
|
||||
preloader.onload = () => {
|
||||
if (typeof preloader.decode !== 'function') {
|
||||
this._settleCctvFrame(token, src, true);
|
||||
return;
|
||||
}
|
||||
let settled = false;
|
||||
const settle = () => {
|
||||
if (settled) return;
|
||||
settled = true;
|
||||
clearTimeout(timer);
|
||||
this._settleCctvFrame(token, src, true);
|
||||
};
|
||||
const timer = setTimeout(settle, CCTV_FRAME_DECODE_WAIT_MS);
|
||||
preloader.decode().then(settle, settle);
|
||||
};
|
||||
preloader.onerror = () => this._settleCctvFrame(token, src, false);
|
||||
preloader.src = src;
|
||||
}
|
||||
|
||||
@@ -88,6 +88,9 @@ export class LocationControls {
|
||||
event.target === elements.search
|
||||
)
|
||||
return;
|
||||
// As for the application shortcuts: Cmd+R, Ctrl+W, Alt+E and the like
|
||||
// belong to the browser and the system. Shift is not a chord.
|
||||
if (event.metaKey || event.ctrlKey || event.altKey) return;
|
||||
const index = POI_KEYS.indexOf(event.key.toUpperCase());
|
||||
if (index !== -1 && index < (cities[cityId]?.pois.length || 0))
|
||||
onPoi(cityId, index);
|
||||
|
||||
@@ -191,6 +191,16 @@ test('location and POI keys route once while form controls retain typing', () =>
|
||||
f.controls.reset();
|
||||
assert.deepEqual(f.calls, [['poi', 'a', 1], ['reset']]);
|
||||
});
|
||||
test('POI keys held with Cmd, Ctrl or Alt run no POI; Shift still does', () => {
|
||||
const f = fixture();
|
||||
const target = { matches: () => false };
|
||||
for (const modifier of ['metaKey', 'ctrlKey', 'altKey'])
|
||||
for (const key of ['q', 'w', 'r', 'R'])
|
||||
f.doc.fire('keydown', { key, target, [modifier]: true });
|
||||
assert.deepEqual(f.calls, []);
|
||||
f.doc.fire('keydown', { key: 'W', target, shiftKey: true });
|
||||
assert.deepEqual(f.calls, [['poi', 'a', 1]]);
|
||||
});
|
||||
test('typing clears a failed search error and closing the emptied field drops it too', () => {
|
||||
const f = fixture();
|
||||
f.elements.search.value = 'Pariss';
|
||||
|
||||
@@ -627,7 +627,7 @@ test('Authoring PLAY uses the scene context, not the radio PLAY', async (context
|
||||
const f = fixture();
|
||||
try {
|
||||
await nextTick();
|
||||
assert.equal(f.elements.start.textContent, 'REPROD.');
|
||||
assert.equal(f.elements.start.textContent, 'REPRODUCIR');
|
||||
} finally {
|
||||
f.restore();
|
||||
}
|
||||
|
||||
@@ -250,8 +250,11 @@ html:not([lang='en']) .cctv-controls .scene-btn {
|
||||
height: auto;
|
||||
object-fit: contain;
|
||||
display: block;
|
||||
/* No fade: a camera change hides the old frame at once (never its pixels
|
||||
under the new camera) and shows the new one as soon as it is decoded. A
|
||||
180 ms fade-in after every arriving frame made each camera click linger
|
||||
on black. */
|
||||
opacity: 0;
|
||||
transition: opacity 180ms ease;
|
||||
}
|
||||
|
||||
#cctv-video {
|
||||
|
||||
@@ -117,10 +117,23 @@ test('the supplied search target retains editing even without form markup', () =
|
||||
assert.deepEqual(f.calls, [['dismissSearch']]);
|
||||
});
|
||||
|
||||
test('shortcut extraction does not change repeat or modifier policy', () => {
|
||||
test('a held key still repeats its shortcut, and Shift is not a chord', () => {
|
||||
const f = shortcuts();
|
||||
f.press('h', new Element(), { repeat: true, ctrlKey: true });
|
||||
assert.deepEqual(f.calls, [['toggleHud']]);
|
||||
f.press('h', new Element(), { repeat: true });
|
||||
f.press('C', new Element(), { shiftKey: true });
|
||||
assert.deepEqual(f.calls, [['toggleHud'], ['toggleCctv']]);
|
||||
});
|
||||
|
||||
test('browser and system chords on a shortcut key run no shortcut', () => {
|
||||
const f = shortcuts();
|
||||
for (const modifier of ['metaKey', 'ctrlKey', 'altKey'])
|
||||
for (const key of ['1', '6', 'h', 'o', 'v', 'f', 'd', 'c', 'C'])
|
||||
f.press(key, new Element(), { [modifier]: true });
|
||||
// Copying (Cmd+C, Ctrl+C) used to turn CCTV on and open the nearest camera.
|
||||
assert.deepEqual(f.calls, []);
|
||||
f.press('c');
|
||||
f.press('Escape', new Element(), { ctrlKey: true });
|
||||
assert.deepEqual(f.calls, [['toggleCctv'], ['dismissSearch']]);
|
||||
});
|
||||
|
||||
test('destroy synchronously removes shortcuts and a replacement binds once', () => {
|
||||
|
||||
Reference in new issue
Block a user