CONTACTS takes the selected vessel as its subject instead of following the nearest flight

Turning CONTACTS on with a vessel selected made the nearest flight to the view the subject and followed it. The selected vessel is now adopted as if it had been selected while CONTACTS was on; a followed flight still comes first, and with nothing selected the nearest flight is still focused.
This commit is contained in:
Sameh Khamis committed 2026-11-15 18:33:29 -08:00
1 parent 725f2f2998
commit 2ac157aca2
4 files changed
+146 -1

No files matched your search

+21
View File
@@ -531,6 +531,26 @@ export function createSubject({ state: layerState, services, parts, source }) {
};
}
/**
* The AIS vessel the user has selected, as a subject. Contacts turned on
* after the selection never heard its `gev:entity-selected`, so activation
* asks the vessel layer and shapes its answer as that event's record.
* @returns {object|null} Detached subject, or null when no vessel is selected.
*/
function currentSelectedVesselSubject() {
const info = aisLiveVesselsLayer.getSelectedInfo?.();
if (!info?.id) return null;
return subjectFromContext({
layerId: 'ais-live-vessels',
id: info.id,
label: info.name || (info.mmsi ? `MMSI ${info.mmsi}` : info.id),
latitude: info.latitude,
longitude: info.longitude,
properties: { vesselId: info.id, mmsi: info.mmsi },
});
}
/**
* Record that the current subject left its feed on its own.
*
@@ -579,6 +599,7 @@ export function createSubject({ state: layerState, services, parts, source }) {
resolveSubjectPhoto,
refreshSelectedSubject,
subjectFromContext,
currentSelectedVesselSubject,
markSubjectEvicted,
clearAwarenessSubject,
};