mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +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
@@ -17,11 +17,25 @@ export function createDependencies({
|
||||
parts.subject.refreshSelectedSubject(true);
|
||||
return;
|
||||
}
|
||||
if (adoptSelectedVessel()) return;
|
||||
if (layerState.autoFocusRetryPending) {
|
||||
layerState.autoFocusRetryPending = !parts.focus.focusAttentionTarget();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Take the selected AIS vessel as the subject, as its selection would have
|
||||
* had Contacts been on. A followed flight is checked first by the callers.
|
||||
* @returns {boolean} Whether a vessel became the subject.
|
||||
*/
|
||||
function adoptSelectedVessel() {
|
||||
const vessel = parts.subject.currentSelectedVesselSubject();
|
||||
if (!vessel) return false;
|
||||
layerState.autoFocusRetryPending = false;
|
||||
parts.subject.selectSubject(vessel);
|
||||
return Boolean(layerState.subject);
|
||||
}
|
||||
|
||||
async function enableDependencies(activationId = layerState.activationId) {
|
||||
const aircraftPending = [];
|
||||
for (const layerId of DEPENDENCIES) {
|
||||
@@ -104,6 +118,7 @@ export function createDependencies({
|
||||
const initialTrackedSubject = parts.subject.currentTrackedFlightSubject();
|
||||
if (initialTrackedSubject)
|
||||
parts.subject.selectSubject(initialTrackedSubject);
|
||||
else adoptSelectedVessel();
|
||||
return enableDependencies(activationId)
|
||||
.then(() => {
|
||||
if (
|
||||
@@ -121,6 +136,7 @@ export function createDependencies({
|
||||
parts.subject.selectSubject(layerState.subject);
|
||||
return;
|
||||
}
|
||||
if (adoptSelectedVessel()) return;
|
||||
if (layerState.autoFocusAttempted) return;
|
||||
layerState.autoFocusRetryPending = !parts.focus.focusAttentionTarget();
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user