mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-15 07:42:23 +00:00
Make a reset inside Contacts the detection that leaving puts back
Contacts lends detection for the session and puts back the earlier state on leaving; a share link carries that earlier state. A reset in Visual is the user's choice, so it becomes both. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
63dc5756d5
commit
a1e7b2a394
4 files changed
+48
-1
No files matched your search
@@ -598,6 +598,8 @@ export class StyleManager extends ShellFacade {
|
|||||||
_setScope: (...args) => this._visualSettings._setScope(...args),
|
_setScope: (...args) => this._visualSettings._setScope(...args),
|
||||||
_applyGlobalPostDefaults: (...args) =>
|
_applyGlobalPostDefaults: (...args) =>
|
||||||
this._applyGlobalPostDefaults(...args),
|
this._applyGlobalPostDefaults(...args),
|
||||||
|
_adoptDetectionAsRestore: () =>
|
||||||
|
this._visualSettings.adoptDetectionAsRestore(),
|
||||||
setCelestialRingEnabled: (...args) =>
|
setCelestialRingEnabled: (...args) =>
|
||||||
this.setCelestialRingEnabled(...args),
|
this.setCelestialRingEnabled(...args),
|
||||||
_setModels3dEnabled: (...args) => this._setModels3dEnabled(...args),
|
_setModels3dEnabled: (...args) => this._setModels3dEnabled(...args),
|
||||||
|
|||||||
@@ -185,6 +185,12 @@ export class DisplayBindings {
|
|||||||
this._setModels3dEnabled(true);
|
this._setModels3dEnabled(true);
|
||||||
this._setModels3dMode('proximity');
|
this._setModels3dMode('proximity');
|
||||||
this._syncModels3dModeRow?.();
|
this._syncModels3dModeRow?.();
|
||||||
|
// Inside Contacts the detection shown is lent for the session, and
|
||||||
|
// leaving puts back the state from before. A reset there is the user's
|
||||||
|
// choice, so the defaults become what leaving puts back and what a
|
||||||
|
// share link carries.
|
||||||
|
this.claimDetection();
|
||||||
|
this._adoptDetectionAsRestore?.();
|
||||||
this._syncShareState();
|
this._syncShareState();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import { createApp, h, nextTick } from 'vue';
|
|||||||
import { createPinia } from 'pinia';
|
import { createPinia } from 'pinia';
|
||||||
import { useDisplayStore } from './stores/display.js';
|
import { useDisplayStore } from './stores/display.js';
|
||||||
import { DisplayBindings } from './displayBindings.js';
|
import { DisplayBindings } from './displayBindings.js';
|
||||||
|
import { VisualSettings } from './visualSettings.js';
|
||||||
import CommandDockView from './views/CommandDockView.vue';
|
import CommandDockView from './views/CommandDockView.vue';
|
||||||
import DisplayControlsView from './views/DisplayControlsView.vue';
|
import DisplayControlsView from './views/DisplayControlsView.vue';
|
||||||
import DrawControls from './views/panels/DrawControls.vue';
|
import DrawControls from './views/panels/DrawControls.vue';
|
||||||
@@ -296,13 +297,14 @@ test('DisplayBindings sets the scope opacity and resets Visual to its defaults',
|
|||||||
_setModels3dMode: (mode) => calls.push(['models3dMode', mode]),
|
_setModels3dMode: (mode) => calls.push(['models3dMode', mode]),
|
||||||
_syncModels3dModeRow: () => calls.push(['models3dRow']),
|
_syncModels3dModeRow: () => calls.push(['models3dRow']),
|
||||||
_syncShareState: () => calls.push(['share']),
|
_syncShareState: () => calls.push(['share']),
|
||||||
|
_adoptDetectionAsRestore: () => calls.push(['adoptDetection']),
|
||||||
},
|
},
|
||||||
readState: () => ({
|
readState: () => ({
|
||||||
shareLinkManager: {
|
shareLinkManager: {
|
||||||
claimRestoreLane: (lane) => calls.push(['claim', lane]),
|
claimRestoreLane: (lane) => calls.push(['claim', lane]),
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
claimDetection: () => {},
|
claimDetection: () => calls.push(['claimDetection']),
|
||||||
displayStore: store,
|
displayStore: store,
|
||||||
});
|
});
|
||||||
bindings._initUI();
|
bindings._initUI();
|
||||||
@@ -325,6 +327,29 @@ test('DisplayBindings sets the scope opacity and resets Visual to its defaults',
|
|||||||
['models3d', true],
|
['models3d', true],
|
||||||
['models3dMode', 'proximity'],
|
['models3dMode', 'proximity'],
|
||||||
['models3dRow'],
|
['models3dRow'],
|
||||||
|
['claimDetection'],
|
||||||
|
['adoptDetection'],
|
||||||
['share'],
|
['share'],
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('a reset inside Contacts makes the shown detection what leaving puts back', () => {
|
||||||
|
const adopt = VisualSettings.prototype.adoptDetectionAsRestore;
|
||||||
|
const live = { detectionMode: 'DENSE', densityPct: 75 };
|
||||||
|
const inContacts = {
|
||||||
|
_contactsDetectionRestore: { mode: 'OFF', densityPct: 50 },
|
||||||
|
getDetectionState: () => live,
|
||||||
|
};
|
||||||
|
adopt.call(inContacts);
|
||||||
|
assert.deepEqual(inContacts._contactsDetectionRestore, {
|
||||||
|
mode: 'DENSE',
|
||||||
|
densityPct: 75,
|
||||||
|
});
|
||||||
|
// Outside Contacts there is no saved state to change.
|
||||||
|
const outside = {
|
||||||
|
_contactsDetectionRestore: null,
|
||||||
|
getDetectionState: () => live,
|
||||||
|
};
|
||||||
|
adopt.call(outside);
|
||||||
|
assert.equal(outside._contactsDetectionRestore, null);
|
||||||
|
});
|
||||||
@@ -355,6 +355,20 @@ export class VisualSettings {
|
|||||||
this._syncShareState();
|
this._syncShareState();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* While Contacts holds detection, make the detection shown now the state
|
||||||
|
* leaving Contacts puts back (and a share link carries): the user chose it,
|
||||||
|
* as with Reset in Visual. Nothing changes outside Contacts.
|
||||||
|
*/
|
||||||
|
adoptDetectionAsRestore() {
|
||||||
|
if (!this._contactsDetectionRestore) return;
|
||||||
|
const state = this.getDetectionState();
|
||||||
|
this._contactsDetectionRestore = {
|
||||||
|
mode: state.detectionMode,
|
||||||
|
densityPct: state.densityPct,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
_setCockpitVision(mode, active, { revealParameters = false } = {}) {
|
_setCockpitVision(mode, active, { revealParameters = false } = {}) {
|
||||||
const next = active ? normalizeCockpitVisionMode(mode) : 'optical';
|
const next = active ? normalizeCockpitVisionMode(mode) : 'optical';
|
||||||
if (!this.stages) return;
|
if (!this.stages) return;
|
||||||
|
|||||||
Reference in new issue
Block a user