mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-06 11:24:00 +00:00
fix(ui): explicit navigation releases flights when an engine leaves out military awareness
On Navara the military-awareness module has no controls, so its releaseCameraOwnership was skipped silently and a city pill, voice fly_to_location or reset ended the follow but kept the aircraft selected. The trackers it would release are released directly instead, as on Cesium (selection and follow both cleared).
This commit is contained in:
1 parent
2da7b6d0d9
commit
e007350645
3 files changed
+41
No files matched your search
@@ -811,3 +811,36 @@ test("north-up and tilt inside an engine's own follow keep following (Navara)",
|
|||||||
handle.stop();
|
handle.stop();
|
||||||
engine.destroy();
|
engine.destroy();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('a navigation releases the flights follow when military awareness has no controls (Navara)', () => {
|
||||||
|
const stopped = [];
|
||||||
|
const navigation = new NavigationController({
|
||||||
|
viewer: null,
|
||||||
|
engine: createFakeEngine(),
|
||||||
|
tracking: {
|
||||||
|
flightsLayer: {
|
||||||
|
stopTracking: ({ origin }) => stopped.push(`flights:${origin}`),
|
||||||
|
},
|
||||||
|
militaryFlightsLayer: {
|
||||||
|
stopTracking: ({ origin }) => stopped.push(`military:${origin}`),
|
||||||
|
},
|
||||||
|
satellitesLayer: {},
|
||||||
|
aisLiveVesselsLayer: { clearSelection: () => stopped.push('vessels') },
|
||||||
|
// A layer this engine leaves out: its module, without the controls.
|
||||||
|
militaryAwarenessLayer: {},
|
||||||
|
rocketLaunchesLayer: {},
|
||||||
|
},
|
||||||
|
isCockpitActive: () => false,
|
||||||
|
cancelOrientation() {},
|
||||||
|
clearLocation() {},
|
||||||
|
cancelShareSelection() {},
|
||||||
|
interruptCameraMotion() {},
|
||||||
|
stopOrbit() {},
|
||||||
|
showToast() {},
|
||||||
|
});
|
||||||
|
assert.equal(
|
||||||
|
navigation._releaseFollowCamera({ preserveVesselSelection: false }),
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
assert.deepEqual(stopped, ['flights:tool', 'military:tool', 'vessels']);
|
||||||
|
});
|
||||||
@@ -327,6 +327,10 @@ export class LocationNavigation {
|
|||||||
this._stopOrbit();
|
this._stopOrbit();
|
||||||
this.cockpitView?.exit({ restoreTracking: false });
|
this.cockpitView?.exit({ restoreTracking: false });
|
||||||
try {
|
try {
|
||||||
|
// A layer an engine leaves out (military awareness on Navara) has no
|
||||||
|
// controls: release the trackers it would release, below.
|
||||||
|
if (typeof militaryAwarenessLayer?.releaseCameraOwnership !== 'function')
|
||||||
|
throw new Error('no military awareness controls');
|
||||||
militaryAwarenessLayer.releaseCameraOwnership?.({ origin: 'tool' });
|
militaryAwarenessLayer.releaseCameraOwnership?.({ origin: 'tool' });
|
||||||
} catch {
|
} catch {
|
||||||
// Keep reset available if Context has not initialized completely.
|
// Keep reset available if Context has not initialized completely.
|
||||||
|
|||||||
@@ -145,6 +145,10 @@ export class NavigationController {
|
|||||||
} = this.tracking;
|
} = this.tracking;
|
||||||
let contactSelected = false;
|
let contactSelected = false;
|
||||||
try {
|
try {
|
||||||
|
// A layer an engine leaves out (military awareness on Navara) has no
|
||||||
|
// controls: release the trackers it would release, below.
|
||||||
|
if (typeof militaryAwarenessLayer?.releaseCameraOwnership !== 'function')
|
||||||
|
throw new Error('no military awareness controls');
|
||||||
contactSelected = Boolean(
|
contactSelected = Boolean(
|
||||||
militaryAwarenessLayer.releaseCameraOwnership?.({
|
militaryAwarenessLayer.releaseCameraOwnership?.({
|
||||||
preserveVesselSelection,
|
preserveVesselSelection,
|
||||||
|
|||||||
Reference in new issue
Block a user