mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
Keep satellite tracking stopped by a place search through the Space Missions restore
A place search or fly-to stops satellite tracking with the tool origin, which the saved Satellites state did not take in, so a satellite tracked by voice during the mission was tracked again when Space Missions ended. The saved state now takes in every deliberate Satellites setting (person, voice or tool), as the layer state does. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
ab01345c7d
commit
29d0fa6e0b
3 files changed
+44
-5
No files matched your search
@@ -743,6 +743,35 @@ test('a Satellites setting changed between missions survives the next one', asyn
|
||||
assert.equal(f.manager.getLayerParams('satellites').showOrbits, false);
|
||||
});
|
||||
|
||||
test('tracking stopped by a place search during a mission stays stopped after it', async (t) => {
|
||||
const f = await fixture(t);
|
||||
f.upstream.status = 200;
|
||||
assert.equal(
|
||||
await f.manager.setEnabled('rocket-launches', true, { origin: 'user' }),
|
||||
true,
|
||||
);
|
||||
await f.settle();
|
||||
f.manager.setLayerParams(
|
||||
'satellites',
|
||||
{ selectedSatTrackingId: 25544 },
|
||||
{ origin: 'voice' },
|
||||
);
|
||||
await f.settle();
|
||||
// A place search stops tracking with the tool origin.
|
||||
f.manager.setLayerParams(
|
||||
'satellites',
|
||||
{ selectedSatTrackingId: null },
|
||||
{ origin: 'tool' },
|
||||
);
|
||||
await f.settle();
|
||||
await f.manager.setEnabled('rocket-launches', false, { origin: 'user' });
|
||||
await f.settle();
|
||||
assert.equal(
|
||||
f.manager.getLayerParams('satellites').selectedSatTrackingId ?? null,
|
||||
null,
|
||||
);
|
||||
});
|
||||
|
||||
test('a failed Satellites restore still clears the selected mission panel', async (t) => {
|
||||
const f = await fixture(t);
|
||||
f.upstream.status = 200;
|
||||
|
||||
@@ -16,6 +16,15 @@ function isExplicitOrigin(origin) {
|
||||
return origin === 'user' || origin === 'voice';
|
||||
}
|
||||
|
||||
/**
|
||||
* A setting changed on purpose: by the person, by voice, or by a tool such
|
||||
* as a place search (the layer state's own rule, isExplicitLayerStateOrigin
|
||||
* in src/data/layerState.js).
|
||||
*/
|
||||
function isDeliberateOrigin(origin) {
|
||||
return isExplicitOrigin(origin) || origin === 'tool';
|
||||
}
|
||||
|
||||
export function createSatelliteIntents({ state: layerState }) {
|
||||
const requestOrder = new Map();
|
||||
let sequence = 0;
|
||||
@@ -94,15 +103,16 @@ export function createSatelliteIntents({ state: layerState }) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Keep a Satellites setting the person changed while Space Missions holds
|
||||
* its saved state ("show orbits" off): it survives the mission teardown,
|
||||
* as their visibility choice does.
|
||||
* Keep a Satellites setting changed on purpose while Space Missions holds
|
||||
* its saved state ("show orbits" off, tracking a satellite, or a place
|
||||
* search that stops tracking): it survives the mission teardown, as a
|
||||
* visibility choice does.
|
||||
*/
|
||||
function handleParams(change) {
|
||||
if (
|
||||
change?.type !== 'params' ||
|
||||
change.layerId !== 'satellites' ||
|
||||
!isExplicitOrigin(change.origin)
|
||||
!isDeliberateOrigin(change.origin)
|
||||
)
|
||||
return;
|
||||
const previous = layerState._satelliteStateBeforeMission;
|
||||
|
||||
Reference in new issue
Block a user