refactor(overlays): hand the shell's overlay host the engine, not the viewer

The controls pass the scene engine to the shell, which initializes the
world overlay on it; initWorldOverlay takes only a globe engine (a viewer
or null is refused), so the shell no longer needs a viewer for its
overlay. engineFromViewer only returns the engine registered for a viewer
(the scene engine until teardown) and never builds one, so no engine can
outlive its viewer without a destroy path. Overlay and detection tests
and the allocation worker build a Cesium engine on their mock viewers and
destroy it with them; frame allocation is unchanged.
This commit is contained in:
German Khokhlov committed 2026-10-15 18:53:57 +04:00
1 parent 3e3aa0bd9f
commit 12c9651a67
10 files changed
+145 -105

No files matched your search

+10 -3
View File
@@ -61,11 +61,18 @@ import { runCctvLayerEnableTransition } from '../cctvFocusPolicy.js';
export class StyleManager extends ShellFacade {
/**
* @param {Cesium.Viewer} viewer - The CesiumJS viewer instance.
* @param {object} [options]
* @param {object} [options] `engine`: the page's globe engine (the world
* overlay host runs on it).
*/
constructor(
viewer,
{ mapStackController = null, placeSearch, services, requestServices } = {},
{
engine = null,
mapStackController = null,
placeSearch,
services,
requestServices,
} = {},
) {
super();
const {
@@ -460,7 +467,7 @@ export class StyleManager 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(viewer);
initWorldOverlay(engine);
// Initialize detection overlay BEFORE style stages so the composite
// stage is first in the post-process pipeline