mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 08:42:21 +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
@@ -110,7 +110,6 @@ export class StyleManager extends ShellScene {
|
||||
ShareLinkManager,
|
||||
CelestialRing,
|
||||
initTrackedReadout,
|
||||
initWorldOverlay,
|
||||
initDetection,
|
||||
setDetectionStyle,
|
||||
trafficLayer,
|
||||
|
||||
@@ -5,8 +5,7 @@ import { t } from '../i18n/index.js';
|
||||
// The camera is the globe engine's, and so is the follow: the followed
|
||||
// entity is engine.camera.following().native (on Cesium also an entity the
|
||||
// app put on viewer.trackedEntity). The viewer, when callers pass one, is
|
||||
// read only for its clock, and for its tracked entity when the engine
|
||||
// reports no follow.
|
||||
// read only for its clock.
|
||||
|
||||
// Cesium's EasingFunction.CUBIC_IN_OUT (tween.js Cubic.InOut).
|
||||
function cubicInOut(amount) {
|
||||
@@ -14,9 +13,9 @@ function cubicInOut(amount) {
|
||||
return 0.5 * ((amount -= 2) * amount * amount + 2);
|
||||
}
|
||||
|
||||
function followedEntity(engine, viewer) {
|
||||
function followedEntity(engine) {
|
||||
const handle = engine?.camera.following?.();
|
||||
return handle ? (handle.native ?? null) : (viewer?.trackedEntity ?? null);
|
||||
return handle?.native ?? null;
|
||||
}
|
||||
|
||||
// An engine's own follow (no tracked entity: Navara): its handle, which
|
||||
@@ -24,7 +23,7 @@ function followedEntity(engine, viewer) {
|
||||
function engineFollow(engine, viewer) {
|
||||
const handle = engine?.camera.following?.();
|
||||
return handle &&
|
||||
!followedEntity(engine, viewer) &&
|
||||
!followedEntity(engine) &&
|
||||
typeof handle.target === 'function' &&
|
||||
typeof handle.retarget === 'function'
|
||||
? handle
|
||||
@@ -90,7 +89,7 @@ export function pickViewTarget(engine) {
|
||||
*/
|
||||
export function readCameraTargetFrame(engine, viewer = null) {
|
||||
if (!engine) return null;
|
||||
const entity = followedEntity(engine, viewer);
|
||||
const entity = followedEntity(engine);
|
||||
const follow = engineFollow(engine, viewer);
|
||||
const center = entity
|
||||
? trackedTarget(entity, viewer)
|
||||
@@ -151,9 +150,7 @@ function setCameraTargetFrame(engine, frame, viewer = null) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
const trackedTransform = followedEntity(engine, viewer)
|
||||
? camera.transform()
|
||||
: null;
|
||||
const trackedTransform = followedEntity(engine) ? camera.transform() : null;
|
||||
camera.lookAt(frame.target, {
|
||||
heading: normalizedHeading(frame.heading),
|
||||
pitch: frame.pitch,
|
||||
@@ -241,14 +238,14 @@ export function createCameraOrientationAnimator(
|
||||
if (!engine) return false;
|
||||
if (duration <= 0)
|
||||
return setCameraTargetFrame(engine, { ...frame, ...destination }, viewer);
|
||||
const entity = followedEntity(engine, viewer);
|
||||
const entity = followedEntity(engine);
|
||||
pending = destination;
|
||||
const start = now();
|
||||
const headingDelta = geo.math.negativePiToPi(
|
||||
destination.heading - frame.heading,
|
||||
);
|
||||
remove = engine.frames.preUpdate.addEventListener(() => {
|
||||
if (engine.isDestroyed() || followedEntity(engine, viewer) !== entity) {
|
||||
if (engine.isDestroyed() || followedEntity(engine) !== entity) {
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
@@ -395,7 +392,6 @@ export function bindCameraOrientationControls({
|
||||
// moveEnd fires when the camera stops, which is where the pick is affordable.
|
||||
subscribe(engine?.camera.moveEnd, refreshTilt);
|
||||
subscribe(engine?.camera.followChanged, animator.cancel);
|
||||
subscribe(viewer?.trackedEntityChanged, animator.cancel);
|
||||
for (const type of ['pointerdown', 'wheel']) {
|
||||
const canvas = engine?.host.canvas;
|
||||
canvas?.addEventListener?.(type, animator.cancel, { passive: true });
|
||||
|
||||
@@ -21,6 +21,7 @@ import { createCesiumEngine } from '../globe/cesium/createCesiumEngine.js';
|
||||
// is. A Viewer's canvas is its scene's.
|
||||
function withEngine(viewer) {
|
||||
viewer.canvas = viewer.scene.canvas;
|
||||
viewer.clock ??= { onTick: new Cesium.Event() };
|
||||
viewer.engine = createCesiumEngine(viewer);
|
||||
return viewer;
|
||||
}
|
||||
|
||||
+3
-10
@@ -1,3 +1,4 @@
|
||||
import { worldOverlayFor } from '../overlays/worldOverlay.js';
|
||||
/** Compose UI controls with the application's existing engines and layer instances. */
|
||||
import { StyleManager as ApplicationShell } from './applicationShell.js';
|
||||
import { LocationSearch } from './location.js';
|
||||
@@ -26,12 +27,7 @@ import {
|
||||
destroyTrackedReadout,
|
||||
initTrackedReadout,
|
||||
} from '../data/trackedReadout.js';
|
||||
import {
|
||||
activateWorldOverlayAction,
|
||||
destroyWorldOverlay,
|
||||
initWorldOverlay,
|
||||
subscribeWorldOverlayActions,
|
||||
} from '../overlays/worldOverlay.js';
|
||||
|
||||
import {
|
||||
destroyDetection,
|
||||
initDetection,
|
||||
@@ -83,10 +79,7 @@ export class StyleManager extends ApplicationShell {
|
||||
setKeyholeFadeTuning,
|
||||
destroyTrackedReadout,
|
||||
initTrackedReadout,
|
||||
destroyWorldOverlay,
|
||||
initWorldOverlay,
|
||||
subscribeWorldOverlayActions,
|
||||
activateWorldOverlayAction,
|
||||
worldOverlayFor,
|
||||
destroyDetection,
|
||||
initDetection,
|
||||
cycleDetectionMode,
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import {
|
||||
@@ -59,7 +60,7 @@ test('real runner and facade use visual settings, preserve visibility and return
|
||||
scene: { canvas: new EventTarget() },
|
||||
};
|
||||
try {
|
||||
const runner = createGevActionRunner({ styleManager: owner, viewer, dataManager: {} });
|
||||
const runner = createGevActionRunner({ engine: createFakeEngine({ visualStyles: { thermal: [], anime: [] }, contactSonar: true }), styleManager: owner, viewer, dataManager: {} });
|
||||
const result = await runner('set_cyber_sonar', { enabled: false, intensityPct: 73, sectorDeg: 9 });
|
||||
assert.equal(result.ok, true);
|
||||
assert.equal(result.sonar.intensityPct, 73);
|
||||
@@ -76,7 +77,7 @@ test('real runner and facade use visual settings, preserve visibility and return
|
||||
const zero = await runner('set_cyber_sonar', { intensityPct: 0 });
|
||||
assert.equal(zero.sonar.intensityPct, 0);
|
||||
assert.equal(zero.sonar.enabled, false);
|
||||
const unavailable = createGevActionRunner({ styleManager: {}, viewer, dataManager: {} });
|
||||
const unavailable = createGevActionRunner({ engine: createFakeEngine({ visualStyles: { thermal: [], anime: [] }, contactSonar: true }), styleManager: {}, viewer, dataManager: {} });
|
||||
assert.equal((await unavailable('set_cyber_sonar', { enabled: true })).ok, false);
|
||||
} finally {
|
||||
globalThis.document = previousDocument;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
|
||||
import { getScopeMaskFeather, isScopeMaskEnabled, setScopeMaskEnabled, setScopeMaskFeather } from '../scopeMask.js';
|
||||
import assert from 'node:assert/strict';
|
||||
import { readFileSync } from 'node:fs';
|
||||
@@ -256,7 +257,7 @@ test('Display and voice HUD routes preserve explicit Cyber entry and exit author
|
||||
clock: { onTick: { addEventListener: () => () => {} } },
|
||||
scene: { canvas: eventSource },
|
||||
};
|
||||
const runVoiceAction = createGevActionRunner({
|
||||
const runVoiceAction = createGevActionRunner({ engine: createFakeEngine({ visualStyles: { thermal: [], anime: [] }, contactSonar: true }),
|
||||
viewer,
|
||||
styleManager: voice.owner,
|
||||
dataManager: {},
|
||||
|
||||
@@ -143,16 +143,9 @@ export class LayerBindings {
|
||||
layer.attachShellServices({
|
||||
runNavigation: (navigate) =>
|
||||
this.runImmediateNavigation(noun, navigate),
|
||||
imageryHost: this.services.imageryHost,
|
||||
});
|
||||
this._weatherShellModules.push(layer);
|
||||
}
|
||||
// Active Fires drapes its far-zoom heatmap on the same imagery host.
|
||||
const fires = this._dataManager?.layers?.get('local-firms')?.module;
|
||||
if (typeof fires?.attachShellServices === 'function') {
|
||||
fires.attachShellServices({ imageryHost: this.services.imageryHost });
|
||||
this._weatherShellModules.push(fires);
|
||||
}
|
||||
}
|
||||
|
||||
_persistAwarenessSelection(event, cleared = false) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { releaseTrackers } from './releaseTrackers.js';
|
||||
import * as geo from '../geo/index.js';
|
||||
import { t } from '../i18n/index.js';
|
||||
import { createStateChannel } from '../app/stateChannel.js';
|
||||
@@ -327,17 +328,7 @@ export class LocationNavigation {
|
||||
}
|
||||
|
||||
resetToGlobeView() {
|
||||
const {
|
||||
GLOBE_VIEW,
|
||||
flyToGlobeView,
|
||||
interruptCameraMotion,
|
||||
flightsLayer,
|
||||
militaryFlightsLayer,
|
||||
satellitesLayer,
|
||||
aisLiveVesselsLayer,
|
||||
militaryAwarenessLayer,
|
||||
rocketLaunchesLayer,
|
||||
} = this.services;
|
||||
const { GLOBE_VIEW, flyToGlobeView, interruptCameraMotion } = this.services;
|
||||
// Between two globe engines there is no camera to reset: nothing moves
|
||||
// and no navigation is stamped.
|
||||
if (this._disposed || !this.engine)
|
||||
@@ -351,39 +342,7 @@ export class LocationNavigation {
|
||||
interruptCameraMotion('reset-globe');
|
||||
this._stopOrbit();
|
||||
this.cockpitView?.exit({ restoreTracking: false });
|
||||
try {
|
||||
// If awareness controls are unavailable, release the trackers directly.
|
||||
if (typeof militaryAwarenessLayer?.releaseCameraOwnership !== 'function')
|
||||
throw new Error('no military awareness controls');
|
||||
militaryAwarenessLayer.releaseCameraOwnership?.({ origin: 'tool' });
|
||||
} catch {
|
||||
// Keep reset available if Context has not initialized completely.
|
||||
try {
|
||||
flightsLayer.stopTracking?.({ origin: 'tool' });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
try {
|
||||
militaryFlightsLayer.stopTracking?.({ origin: 'tool' });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
try {
|
||||
aisLiveVesselsLayer.clearSelection?.();
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
}
|
||||
try {
|
||||
satellitesLayer.stopTracking?.({ origin: 'tool' });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
try {
|
||||
rocketLaunchesLayer.releaseCameraOwnership?.();
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
releaseTrackers(this.services, { origin: 'tool' });
|
||||
this.engine.camera.following()?.stop();
|
||||
this.engine.camera.cancelFlight();
|
||||
this.engine.camera.release();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { releaseTrackers } from './releaseTrackers.js';
|
||||
import { cancelCameraArrival } from '../data/cameraArrival.js';
|
||||
import { createStateChannel } from '../app/stateChannel.js';
|
||||
import {
|
||||
@@ -136,54 +137,10 @@ export class NavigationController {
|
||||
preserveCameraFlight = false,
|
||||
trackingOrigin = 'tool',
|
||||
} = {}) {
|
||||
const {
|
||||
flightsLayer,
|
||||
militaryFlightsLayer,
|
||||
satellitesLayer,
|
||||
aisLiveVesselsLayer,
|
||||
militaryAwarenessLayer,
|
||||
rocketLaunchesLayer,
|
||||
} = this.tracking;
|
||||
let contactSelected = false;
|
||||
try {
|
||||
// If awareness controls are unavailable, release the trackers directly.
|
||||
if (typeof militaryAwarenessLayer?.releaseCameraOwnership !== 'function')
|
||||
throw new Error('no military awareness controls');
|
||||
contactSelected = Boolean(
|
||||
militaryAwarenessLayer.releaseCameraOwnership?.({
|
||||
preserveVesselSelection,
|
||||
origin: trackingOrigin,
|
||||
}),
|
||||
);
|
||||
} catch {
|
||||
try {
|
||||
flightsLayer.stopTracking?.({ origin: trackingOrigin });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
try {
|
||||
militaryFlightsLayer.stopTracking?.({ origin: trackingOrigin });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
if (!preserveVesselSelection) {
|
||||
try {
|
||||
aisLiveVesselsLayer.clearSelection?.();
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
satellitesLayer.stopTracking?.({ origin: trackingOrigin });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
try {
|
||||
rocketLaunchesLayer.releaseCameraOwnership?.();
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
const contactSelected = releaseTrackers(this.tracking, {
|
||||
preserveVesselSelection,
|
||||
origin: trackingOrigin,
|
||||
});
|
||||
this.engine?.camera.following()?.stop();
|
||||
this.interruptCameraMotion('explicit-navigation');
|
||||
this.stopOrbit();
|
||||
|
||||
@@ -296,7 +296,7 @@ export function createRecentImageryPanel({
|
||||
title: t('Use the current view as the box'),
|
||||
onClick: () => {
|
||||
exportError = null;
|
||||
layer.useCurrentView(viewer);
|
||||
layer.useCurrentView();
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
import * as geo from '../geo/index.js';
|
||||
import { createFakeEngine } from '../globe/testing/fakeEngine.js';
|
||||
import { createRecentImageryDisplay } from '../layers/recentImagery/render/display.js';
|
||||
import '../testSupport/registerDom.mjs';
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
@@ -110,7 +113,14 @@ function fakeDocument() {
|
||||
// ---- the real layer, with fakes for everything it injects ------------------
|
||||
function fixture({ fetchImpl, controller = fakeController() } = {}) {
|
||||
const dom = fakeDocument();
|
||||
const renderer = fakeRenderer();
|
||||
const engine = createFakeEngine({ width: 1000, height: 500 });
|
||||
engine.fake.script('viewRectangle', () => undefined);
|
||||
const display = createRecentImageryDisplay(engine);
|
||||
const renderer = {
|
||||
...fakeRenderer(),
|
||||
viewCentre: display.viewCentre,
|
||||
zoomToFit: display.zoomToFit,
|
||||
};
|
||||
const thumbnails = fakeThumbnails();
|
||||
const catalog = fakeCatalog();
|
||||
const timers = manualTimers();
|
||||
@@ -118,7 +128,6 @@ function fixture({ fetchImpl, controller = fakeController() } = {}) {
|
||||
catalog,
|
||||
renderer,
|
||||
thumbnails,
|
||||
host: () => ({ collection: {}, kind: 'globe' }),
|
||||
now: () => new Date('2026-09-21T15:00:00Z'),
|
||||
setTimeoutImpl: timers.setTimeoutImpl,
|
||||
clearTimeoutImpl: timers.clearTimeoutImpl,
|
||||
@@ -128,7 +137,7 @@ function fixture({ fetchImpl, controller = fakeController() } = {}) {
|
||||
camera: {},
|
||||
scene: { canvas: { clientWidth: 1000 }, requestRender() {} },
|
||||
};
|
||||
layer.init(viewer);
|
||||
layer.init(null, { engine });
|
||||
layer.attachMapStackController(controller);
|
||||
let active = false;
|
||||
const tool = {
|
||||
@@ -208,6 +217,7 @@ function fixture({ fetchImpl, controller = fakeController() } = {}) {
|
||||
};
|
||||
return {
|
||||
...dom,
|
||||
engine,
|
||||
layer,
|
||||
viewer,
|
||||
renderer,
|
||||
@@ -800,14 +810,11 @@ test('the notice line shows the refusal, then errors, then CLEAR, then the Esri
|
||||
test('an oversized box offers ZOOM IN in a fixed slot at the end of the notice line; it asks the layer to fit', async () => {
|
||||
const f = fixture();
|
||||
const flights = [];
|
||||
f.viewer.scene.canvas.clientHeight = 500;
|
||||
f.viewer.scene.ellipsoid = {
|
||||
cartographicToCartesian: (c) => ({ ...c }),
|
||||
};
|
||||
Object.assign(f.viewer.camera, {
|
||||
frustum: { fovy: 2 * Math.atan(Math.tan(Math.PI / 6) / 2) },
|
||||
flyTo: (options) => flights.push(options),
|
||||
});
|
||||
f.engine.camera.flyTo = (options) =>
|
||||
flights.push({
|
||||
...options,
|
||||
destination: geo.cartographic.fromCartesian(options.destination),
|
||||
});
|
||||
const notice = f.byId('ri-notice');
|
||||
const zoom = f.byId('ri-zoom-in');
|
||||
assert.equal(zoom.tagName, 'BUTTON');
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
/** Release layer camera owners in their handoff order. */
|
||||
export function releaseTrackers(tracking, options) {
|
||||
const {
|
||||
flightsLayer,
|
||||
militaryFlightsLayer,
|
||||
satellitesLayer,
|
||||
aisLiveVesselsLayer,
|
||||
militaryAwarenessLayer,
|
||||
rocketLaunchesLayer,
|
||||
} = tracking;
|
||||
let contactSelected = false;
|
||||
try {
|
||||
// If awareness controls are unavailable, release the trackers directly.
|
||||
if (typeof militaryAwarenessLayer?.releaseCameraOwnership !== 'function')
|
||||
throw new Error('no military awareness controls');
|
||||
contactSelected = Boolean(
|
||||
militaryAwarenessLayer.releaseCameraOwnership?.({
|
||||
...options,
|
||||
}),
|
||||
);
|
||||
} catch {
|
||||
try {
|
||||
flightsLayer.stopTracking?.({ origin: options.origin });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
try {
|
||||
militaryFlightsLayer.stopTracking?.({ origin: options.origin });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
if (!options.preserveVesselSelection) {
|
||||
try {
|
||||
aisLiveVesselsLayer.clearSelection?.();
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
}
|
||||
}
|
||||
try {
|
||||
satellitesLayer.stopTracking?.({ origin: options.origin });
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
try {
|
||||
rocketLaunchesLayer.releaseCameraOwnership?.();
|
||||
} catch {
|
||||
/* best-effort release */
|
||||
}
|
||||
return contactSelected;
|
||||
}
|
||||
@@ -142,10 +142,8 @@ test('camera-entry listeners are removed before any asynchronous layer cleanup',
|
||||
});
|
||||
|
||||
|
||||
test('weather shell supplies live imagery hosts to wind and observations and releases them', (t) => {
|
||||
test('weather shell supplies navigation to wind and observations and releases it', (t) => {
|
||||
const { owner } = bindings(t);
|
||||
let host = { collection: {}, kind: 'tileset' };
|
||||
owner.services.imageryHost = () => host;
|
||||
const attached = new Map();
|
||||
const ids = ['wind', 'weather-radar', 'weather-satellite', 'weather-lightning'];
|
||||
owner.attachDataManager({
|
||||
@@ -154,9 +152,7 @@ test('weather shell supplies live imagery hosts to wind and observations and rel
|
||||
} }])),
|
||||
subscribe: () => () => {},
|
||||
});
|
||||
for (const id of ids) assert.equal(attached.get(id).imageryHost(), host);
|
||||
host = { collection: null, kind: 'none' };
|
||||
for (const id of ids) assert.equal(attached.get(id).imageryHost(), host);
|
||||
for (const id of ids) assert.equal(typeof attached.get(id).runNavigation, 'function');
|
||||
owner.disconnect();
|
||||
for (const id of ids) assert.equal(attached.get(id), null);
|
||||
});
|
||||
|
||||
+8
-15
@@ -2,7 +2,6 @@ import { createSceneHost } from '../app/sceneHost.js';
|
||||
import { useWorldOverlayActionsStore } from './stores/worldOverlayActions.js';
|
||||
import { renderGovernorFor } from '../renderGovernor.js';
|
||||
import { retainsLayerSession } from '../app/layerSession.js';
|
||||
import { resolveImageryHost } from '../layers/weather/imageryHost.js';
|
||||
import { LayerBindings } from './layerBindings.js';
|
||||
import { VisualSettings } from './visualSettings.js';
|
||||
import { ShareRestoration } from './shareRestoration.js';
|
||||
@@ -108,11 +107,6 @@ export class ShellScene extends ShellFacade {
|
||||
viewer,
|
||||
engine,
|
||||
services: {
|
||||
imageryHost: () =>
|
||||
resolveImageryHost({
|
||||
viewer,
|
||||
tileset: mapStackController?.getImageryHostTileset?.(),
|
||||
}),
|
||||
cachedGroundFloor: services.cachedGroundFloor,
|
||||
warmGroundFloor: services.warmGroundFloor,
|
||||
cctvLayer: services.cctvLayer,
|
||||
@@ -237,7 +231,7 @@ export class ShellScene extends ShellFacade {
|
||||
_initSceneOverlays() {
|
||||
const { engine } = this._scene;
|
||||
const {
|
||||
initWorldOverlay,
|
||||
worldOverlayFor,
|
||||
initDetection,
|
||||
initTrackedReadout,
|
||||
setDetectionStyle,
|
||||
@@ -254,17 +248,16 @@ export class ShellScene extends ShellFacade {
|
||||
// The shared world-overlay host must own its one postRender lane before
|
||||
// detection and tracked-readout initialize. It stays transparent until a
|
||||
// production source explicitly registers entries.
|
||||
initWorldOverlay(engine);
|
||||
worldOverlayFor(engine).init();
|
||||
const overlayActionsStore = useWorldOverlayActionsStore(applicationPinia());
|
||||
this._overlayActionsUnsubscribe?.();
|
||||
overlayActionsStore.connect({
|
||||
activate: (...args) =>
|
||||
this.services.activateWorldOverlayAction(engine, ...args),
|
||||
this.services.worldOverlayFor(engine).activateAction(...args),
|
||||
});
|
||||
this._overlayActionsUnsubscribe =
|
||||
this.services.subscribeWorldOverlayActions?.(engine, (view) =>
|
||||
overlayActionsStore.publish(view),
|
||||
);
|
||||
this._overlayActionsUnsubscribe = this.services
|
||||
.worldOverlayFor(engine)
|
||||
.subscribeActions((view) => overlayActionsStore.publish(view));
|
||||
// Initialize detection overlay BEFORE style stages so the composite
|
||||
// stage is first in the post-process pipeline. Both run on the engine,
|
||||
// Navara's too.
|
||||
@@ -401,7 +394,7 @@ export class ShellScene extends ShellFacade {
|
||||
handoff = retainsLayerSession(this._layerSession),
|
||||
} = {}) {
|
||||
if (!this._scene.engine && !this._scene.viewer) return;
|
||||
const { destroyTrackedReadout, destroyWorldOverlay, destroyDetection } =
|
||||
const { destroyTrackedReadout, worldOverlayFor, destroyDetection } =
|
||||
this.services;
|
||||
this._shareRestoration.destroy();
|
||||
this._navigation.setScene({}, { retainScene: handoff });
|
||||
@@ -423,7 +416,7 @@ export class ShellScene extends ShellFacade {
|
||||
this._layerBindings.disconnect();
|
||||
destroyTrackedReadout(this._scene.engine);
|
||||
destroyDetection();
|
||||
destroyWorldOverlay(this._scene.engine);
|
||||
worldOverlayFor(this._scene.engine).destroy();
|
||||
this._overlayActionsUnsubscribe?.();
|
||||
this._overlayActionsUnsubscribe = null;
|
||||
this.celestialRing?.destroy();
|
||||
|
||||
@@ -42,7 +42,7 @@ function fakeShell() {
|
||||
_layerSession: null,
|
||||
services: {
|
||||
destroyTrackedReadout: record('destroyTrackedReadout'),
|
||||
destroyWorldOverlay: record('destroyWorldOverlay'),
|
||||
worldOverlayFor: () => ({ destroy: record('destroyWorldOverlay') }),
|
||||
destroyDetection: record('destroyDetection'),
|
||||
cctvLayer: 'cctv',
|
||||
},
|
||||
@@ -314,7 +314,7 @@ test('a hosted shell uses the enclosing transition while direct calls wait outsi
|
||||
shell._sceneHost = host;
|
||||
const first = { engine: shell.engine };
|
||||
await host.attach(first);
|
||||
const catalog = { get: () => ({}), unavailableMetadata: [] };
|
||||
const catalog = { get: () => ({}) };
|
||||
await host.register(shellScenePart(shell, { builtOn: first, catalog }));
|
||||
let release;
|
||||
let entered;
|
||||
|
||||
Reference in new issue
Block a user