mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-20 10:12:18 +00:00
Keep the camera still in the cockpit when a mission's dot is clicked or its orbit arrives
The cockpit holds the camera: the mission dot, like its label, selects the mission there without flying to it, and a mission picked in the cockpit is not flown to when the active satellite lookup returns. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
813c6b23ea
commit
6c960eb3c9
6 files changed
+46
-20
No files matched your search
@@ -196,8 +196,8 @@ test("another layer's label keeps the click above mission geometry", (t) => {
|
||||
assert.deepEqual(r.focused, ['L1']);
|
||||
});
|
||||
|
||||
test('in the cockpit a mission label selects its mission without moving the camera', (t) => {
|
||||
const r = rig(t, { overlayHit: label('launch:L2') });
|
||||
test('in the cockpit a mission label or dot selects its mission without moving the camera', (t) => {
|
||||
const r = rig(t, { overlayHit: label('launch:L2'), geometryLaunchId: 'L1' });
|
||||
const previous = Object.getOwnPropertyDescriptor(globalThis, 'document');
|
||||
Object.defineProperty(globalThis, 'document', {
|
||||
configurable: true,
|
||||
@@ -213,6 +213,23 @@ test('in the cockpit a mission label selects its mission without moving the came
|
||||
}
|
||||
assert.deepEqual(r.focused, ['L2'], 'the mission is selected');
|
||||
assert.deepEqual(r.moved, [], 'the cockpit keeps the camera');
|
||||
// The dot, with no label over it, does the same.
|
||||
r.setHit(null);
|
||||
Object.defineProperty(globalThis, 'document', {
|
||||
configurable: true,
|
||||
value: {
|
||||
body: { classList: { contains: (name) => name === 'cockpit-mode' } },
|
||||
},
|
||||
});
|
||||
try {
|
||||
r.click();
|
||||
} finally {
|
||||
if (previous) Object.defineProperty(globalThis, 'document', previous);
|
||||
else delete globalThis.document;
|
||||
}
|
||||
assert.deepEqual(r.focused, ['L2', 'L1']);
|
||||
assert.deepEqual(r.moved, []);
|
||||
r.setHit(label('launch:L2'));
|
||||
// Out of the cockpit the same click moves there too.
|
||||
r.click();
|
||||
assert.deepEqual(r.moved, ['L2']);
|
||||
|
||||
Reference in new issue
Block a user