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:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 20:37:53 -08:00
1 parent 813c6b23ea
commit 6c960eb3c9
6 files changed
+46 -20

No files matched your search

+19 -2
View File
@@ -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']);