mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
Remove always-true layer availability and leftover viewer paths
Every layer draws on both engines, so the per-engine availability machinery always answered yes. The renderer manifest is now the id to display map plus the wind flow backend; the catalog filter, the voice and QA-probe refusals and the engine-kind checks go with it. The Navara notice lists the same layers in the same words. Paths that read the Cesium viewer behind an engine that is always there are gone: the Recent Imagery viewer fallbacks, the shell's imagery-host service (one shared host module remains), the engineless map controller, viewer gates in voice actions, world packets and camera verbs, the orientation controls' tracked-entity fallback, and the Bhote Koshi and FIRMS Cesium-shaped paths. setCameraInputs, which nothing called, leaves the contract; suspensions remain. Smaller duplicates go too: one tracker-release helper for navigation and location, the no-op frame latch, missing-engine guards, one name for the injected display, flat bikeshare and installations displays, one overlay host and binder, one name per world-overlay method, and stub-viewer guards in the Cesium engine. Layers that still read the viewer keep the shared init(viewer, context) entry. Behaviour is unchanged on both engines. Viewer lines fall from 849 to 750 and engine-name literals from 32 to 27.
This commit is contained in:
1 parent
371d848eec
commit
7f478e3815
279 files changed
+1570
-3104
No files matched your search
@@ -618,13 +618,13 @@ test('the floor does not fight flights or a lookAt target', () => {
|
||||
test('the floor stands aside while the camera inputs are off (the cockpit drives it)', () => {
|
||||
const { engine, view } = setup();
|
||||
view.sampleTerrainHeight = () => 100;
|
||||
engine.input.setCameraInputs(false);
|
||||
const resumeInputs = engine.input.suspendCameraInputs();
|
||||
engine.camera.setView({
|
||||
destination: cartesian3.fromDegrees(2.35, 48.85, 112),
|
||||
});
|
||||
view.emit('preRender', 1);
|
||||
near(heightOf(engine), 112, 1e-6, 'the cockpit eye 12 m up is kept');
|
||||
engine.input.setCameraInputs(true);
|
||||
resumeInputs();
|
||||
view.emit('preRender', 2);
|
||||
near(heightOf(engine), 130, 1e-6, 'lifted once the inputs are back');
|
||||
engine.destroy();
|
||||
|
||||
@@ -44,7 +44,6 @@ export function createNavaraInput(
|
||||
const listeners = new Map(INPUT_TYPES.map((type) => [type, new Set()]));
|
||||
let attached = false;
|
||||
let destroyed = false;
|
||||
let cameraInputs = true;
|
||||
let cameraOptions = {};
|
||||
let downAt = null;
|
||||
let last = null;
|
||||
@@ -123,7 +122,7 @@ export function createNavaraInput(
|
||||
last = position;
|
||||
};
|
||||
const onCameraEvent = (event) => {
|
||||
if (cameraInputs) onCameraInput(event.type);
|
||||
onCameraInput(event.type);
|
||||
};
|
||||
for (const type of CAMERA_EVENTS)
|
||||
canvas.addEventListener(type, onCameraEvent, {
|
||||
@@ -133,7 +132,7 @@ export function createNavaraInput(
|
||||
|
||||
let suspended = 0;
|
||||
const sendCameraInputs = () => {
|
||||
const enabled = cameraInputs && suspended === 0;
|
||||
const enabled = suspended === 0;
|
||||
input.setCameraOptions({
|
||||
enableSpin: enabled,
|
||||
enableZoom: enabled,
|
||||
@@ -166,17 +165,12 @@ export function createNavaraInput(
|
||||
listeners.get(type).delete(entry);
|
||||
};
|
||||
},
|
||||
setCameraInputs(enabled) {
|
||||
cameraInputs = Boolean(enabled);
|
||||
sendCameraInputs();
|
||||
},
|
||||
/** Off under any suspension, else the setCameraInputs choice. */
|
||||
cameraInputsEnabled: () => cameraInputs && suspended === 0,
|
||||
/** Off under any suspension. */
|
||||
cameraInputsEnabled: () => suspended === 0,
|
||||
/**
|
||||
* Navara's spin, zoom and tilt off until the returned release (the
|
||||
* follow camera takes drag and wheel itself, as do the app's camera
|
||||
* owners); the app's setCameraInputs choice comes back after the last
|
||||
* release.
|
||||
* owners). The last release enables the controls.
|
||||
*/
|
||||
suspendCameraInputs() {
|
||||
suspended++;
|
||||
@@ -201,8 +195,6 @@ export function createNavaraInput(
|
||||
};
|
||||
return {
|
||||
input,
|
||||
/** Whether the app leaves the camera to the user (setCameraInputs). */
|
||||
cameraInputs: () => cameraInputs,
|
||||
destroy() {
|
||||
if (destroyed) return;
|
||||
pointer.destroy();
|
||||
|
||||
@@ -119,22 +119,22 @@ test('on validates its arguments and returns an idempotent remover', () => {
|
||||
assert.equal(count, 0);
|
||||
});
|
||||
|
||||
test('setCameraInputs toggles Navara camera control and user input cancels flights only while enabled', () => {
|
||||
test('suspending Navara controls preserves user input notifications', () => {
|
||||
const { canvas, input, cameraOptions, cameraInputs } = setup();
|
||||
canvas.dispatchEvent(pointer('pointerdown', 1, 1));
|
||||
canvas.dispatchEvent(new Event('wheel'));
|
||||
assert.deepEqual(cameraInputs, ['pointerdown', 'wheel']);
|
||||
input.setCameraInputs(false);
|
||||
const resume = input.suspendCameraInputs();
|
||||
canvas.dispatchEvent(pointer('pointerdown', 1, 1));
|
||||
assert.deepEqual(cameraInputs, ['pointerdown', 'wheel']);
|
||||
input.setCameraInputs(true);
|
||||
assert.deepEqual(cameraInputs, ['pointerdown', 'wheel', 'pointerdown']);
|
||||
resume();
|
||||
assert.deepEqual(cameraOptions, [
|
||||
{ enableSpin: false, enableZoom: false, enableTilt: false },
|
||||
{ enableSpin: true, enableZoom: true, enableTilt: true },
|
||||
]);
|
||||
});
|
||||
|
||||
test('suspendCameraInputs counts and keeps the setCameraInputs choice for the last resume', () => {
|
||||
test('suspendCameraInputs counts until the last resume', () => {
|
||||
const { input, cameraOptions } = setup();
|
||||
const on = { enableSpin: true, enableZoom: true, enableTilt: true };
|
||||
const off = { enableSpin: false, enableZoom: false, enableTilt: false };
|
||||
@@ -145,11 +145,7 @@ test('suspendCameraInputs counts and keeps the setCameraInputs choice for the la
|
||||
inner();
|
||||
inner();
|
||||
assert.deepEqual(cameraOptions.at(-1), off);
|
||||
input.setCameraInputs(false);
|
||||
outer();
|
||||
assert.deepEqual(cameraOptions.at(-1), off);
|
||||
assert.equal(input.cameraInputsEnabled(), false);
|
||||
input.setCameraInputs(true);
|
||||
assert.deepEqual(cameraOptions.at(-1), on);
|
||||
assert.equal(input.cameraInputsEnabled(), true);
|
||||
});
|
||||
@@ -165,10 +161,10 @@ test('destroy removes every DOM listener and later subscriptions are inert', ()
|
||||
assert.equal(canvas.listenerCount, 0);
|
||||
});
|
||||
|
||||
test('setCameraInputs merges into the camera options set through the engine', () => {
|
||||
test('suspension merges into the camera options set through the engine', () => {
|
||||
const { input, cameraOptions } = setup();
|
||||
input.setCameraOptions({ minimumZoomDistance: 50, zoomSpeed: 2 });
|
||||
input.setCameraInputs(false);
|
||||
const resume = input.suspendCameraInputs();
|
||||
assert.deepEqual(cameraOptions.at(-1), {
|
||||
minimumZoomDistance: 50,
|
||||
zoomSpeed: 2,
|
||||
|
||||
Reference in new issue
Block a user