Keep the ridden aircraft's layer when Contacts ends, and clear its rows from Live Signals

Riding an aircraft now adopts its layer the way a direct selection does, and
Contacts gives up a dependency the user adopts, so ending Contacts mid-session
(one of its layers off, or Contacts itself) no longer turns off the ridden
layer and ends the Cockpit. When Contacts goes off, Live Signals drops the
rows built from its snapshot instead of leaving stale distances marked
CURRENT, and the feed-off warning is no longer duplicated.
This commit is contained in:
Sameh Khamis committed 2026-11-05 14:01:17 -08:00
1 parent 459b0e8a71
commit 63fd559496
14 files changed
+441 -16

No files matched your search

+17
View File
@@ -97,6 +97,7 @@ export class CockpitCoordinator {
isUtilityDisclosureOpen: () => !!this.readUtilityDisclosureOpen?.(),
onEntered: () => this.enterPanels(),
onExited: () => this.exitPanels(),
onRide: (layerId) => this._adoptRiddenLayer(layerId),
restoreTrackingFrame: (entity) => {
const [layerId, ...idParts] = String(entity?.gevTrackedId || '').split(
':',
@@ -127,6 +128,22 @@ export class CockpitCoordinator {
_isLayerEnabled(layerId) {
return Boolean(layerId) && !!this._dataManager?.isEnabled(layerId);
}
/**
* Make the ridden aircraft's layer the user's own while Contacts is on.
* Contacts may have turned that layer on, and it releases the layers it
* owns when it goes off; the Cockpit must outlive Contacts, so riding an
* aircraft adopts its layer as a direct selection does. Contacts then stops
* owning it and the Context restore keeps it (session `userAdded`).
* @param {string|null} layerId The ridden aircraft's layer.
*/
_adoptRiddenLayer(layerId) {
if (!COCKPIT_AIRCRAFT_LAYER_IDS.includes(layerId)) return;
if (!this._isLayerEnabled('military-awareness')) return;
this._dataManager?.adoptLayerVisibility?.(layerId, true, {
origin: 'user',
adoptedFromSelection: true,
});
}
/** Whether either aircraft layer is on, so there is an aircraft to ride. */
get _aircraftLayerEnabled() {
return COCKPIT_AIRCRAFT_LAYER_IDS.some((layerId) =>