Move the imagery box preview into the recent imagery renderer

The box selection tool no longer builds Cesium entities itself: its fill
and dashed outline live in createImageryBoxPreview in the recent imagery
rendering module, and the tool takes the preview as a dependency. The
cockpit contact card reads the nearest contact's position with the geo
helpers. Both files leave the allow-list.

Tests now inject the preview with the Cesium double, check that a second
destroy returns the same promise, and pin the nose-relative bearing to a
known contact.
This commit is contained in:
Sameh Khamis committed 2026-11-07 03:11:51 -08:00
1 parent 6ee3bb2f7d
commit d928c30337
7 files changed
+153 -87

No files matched your search

+6 -2
View File
@@ -11,6 +11,7 @@ import {
initImageryBoxTool,
} from './imageryBoxTool.js';
import { boxToolFakes } from '../layers/recentImagery/testDoubles.mjs';
import { createImageryBoxPreview } from '../layers/recentImagery/rendering.js';
function fixture(options = {}) {
resetPointerOwnership();
@@ -20,7 +21,8 @@ function fixture(options = {}) {
const actives = [];
const tool = initImageryBoxTool({
viewer: fakes.viewer,
cesium: fakes.cesium,
createPreview: (viewer, dragBox) =>
createImageryBoxPreview(viewer, dragBox, { cesium: fakes.cesium }),
pickWorld: fakes.pickWorld,
documentRef: fakes.documentRef,
onBox: (box) => boxes.push(box),
@@ -150,7 +152,9 @@ test('destroy mid-drag restores the camera, releases the claim and detaches the
f.tool.start();
f.fire('LEFT_DOWN', { position: { x: 250, y: 125 } });
assert.equal(f.viewer.dataSources.sources.length, 1);
await f.tool.destroy();
const destroying = f.tool.destroy();
assert.equal(f.tool.destroy(), destroying);
await destroying;
assert.equal(f.camera.enableInputs, true);
assert.equal(pointerOwner(), null);
assert.equal(f.viewer.dataSources.sources.length, 0);