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

+4 -9
View File
@@ -1,5 +1,5 @@
/** Contact readouts and nearby-signal presentation for the Cockpit controller. */
import * as Cesium from 'cesium';
import { toLonLatH } from '../geo/index.js';
import { formatNumber, t, tn } from '../i18n/index.js';
import { unitLabel } from './unitLabels.js';
import {
@@ -151,14 +151,9 @@ export function updateContext(info, heading) {
Number.isFinite(info.latitude) &&
Number.isFinite(info.longitude)
) {
const cartographic = Cesium.Cartographic.fromCartesian(closest.position);
const bearing = cartographic
? bearingBetweenCoordinates(
info.latitude,
info.longitude,
Cesium.Math.toDegrees(cartographic.latitude),
Cesium.Math.toDegrees(cartographic.longitude),
)
const at = toLonLatH(closest.position);
const bearing = at
? bearingBetweenCoordinates(info.latitude, info.longitude, at.lat, at.lon)
: null;
relative = relativeBearing(bearing, heading);
}