mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
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:
1 parent
725f2f2998
commit
2ac157aca2
4 files changed
+146
-1
No files matched your search
@@ -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,
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user