mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
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:
1 parent
6ee3bb2f7d
commit
d928c30337
7 files changed
+153
-87
No files matched your search
@@ -11,6 +11,7 @@ import {
|
||||
showContextCard,
|
||||
updateContext,
|
||||
} from './cockpitContext.js';
|
||||
import { fromDegrees } from '../geo/index.js';
|
||||
import { createContextState } from './cockpitContextState.js';
|
||||
import { syncWeatherToggle } from './cockpitInstruments.js';
|
||||
import { setContextCollapsed } from './cockpitLayout.js';
|
||||
@@ -159,6 +160,40 @@ test('a snapshot fills the card and keeps classes other code sets', async (t) =>
|
||||
assert.equal(layouts.length, 1);
|
||||
});
|
||||
|
||||
test('when the tracked aircraft is the subject, the bearing points at the nearest contact', async (t) => {
|
||||
const tracked = { layerId: 'flights', id: 'abc123', label: 'ABC123' };
|
||||
const contact = (lon, lat) =>
|
||||
snapshot({
|
||||
subject: tracked,
|
||||
cohorts: [
|
||||
{
|
||||
id: 'flights',
|
||||
label: 'Flights',
|
||||
count: 1,
|
||||
relationship: 'OBSERVED',
|
||||
nearest: [
|
||||
{ id: 'N1', distanceM: 96_000, position: fromDegrees(lon, lat) },
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
const { text, owner } = fixture(t, contact(-96, 30));
|
||||
// Due east of a north-facing nose.
|
||||
updateContext.call(owner, INFO, 0);
|
||||
await nextTick();
|
||||
assert.equal(text('#cockpit-context-bearing'), 'R 090°');
|
||||
// Due north: inside the dead-ahead cone.
|
||||
owner.snapshot = contact(-97, 31);
|
||||
updateContext.call(owner, INFO, 0);
|
||||
await nextTick();
|
||||
assert.equal(text('#cockpit-context-bearing'), 'AHEAD');
|
||||
// Due west of a nose turned to the north-east.
|
||||
owner.snapshot = contact(-98, 30);
|
||||
updateContext.call(owner, INFO, 45);
|
||||
await nextTick();
|
||||
assert.equal(text('#cockpit-context-bearing'), 'L 135°');
|
||||
});
|
||||
|
||||
test('a lost contact holds its readout behind the CONTACT LOST cue', async (t) => {
|
||||
const { $, text, owner, layouts } = fixture(t, snapshot());
|
||||
updateContext.call(owner, INFO, 0);
|
||||
|
||||
Reference in new issue
Block a user