Never fly to a mission while the cockpit holds the camera

Focusing a mission does nothing in the cockpit, so the layer row's arrows
select the next mission without moving the camera, as its label and dot
already do.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 20:58:17 -08:00
1 parent 6c960eb3c9
commit cdde80f3ad
4 files changed
+33 -6

No files matched your search

+21 -1
View File
@@ -36,10 +36,12 @@ function scene(t) {
],
};
const viewer = { scene: {} };
const flights = [];
const { draw, unbind } = bindFakeDraw(viewer, {
camera: {
pose: () => ({ position: { x: 2e7, y: 0, z: 0 } }),
on: () => () => {},
flyTo: (...args) => flights.push(args),
},
});
t.after(unbind);
@@ -88,7 +90,7 @@ function scene(t) {
path: item(`rocket-trajectory:${launch.id}:0`).show,
};
};
return { state, rendering, launch, syncs, shown, draw };
return { state, rendering, launch, syncs, shown, draw, parts, flights };
}
test('live shows every launch in the window, lifted off or not', (t) => {
@@ -127,3 +129,21 @@ test('the live orbit rings turn at the frame time, not the wall clock', (t) => {
);
assert.deepEqual(orbits.spec.motionClock, { kind: 'scene' });
});
test('in the cockpit a chosen mission is not flown to', (t) => {
const { launch, parts, flights } = scene(t);
const previous = Object.getOwnPropertyDescriptor(globalThis, 'document');
Object.defineProperty(globalThis, 'document', {
configurable: true,
value: {
body: { classList: { contains: (name) => name === 'cockpit-mode' } },
},
});
try {
parts.selection.focusMission(launch);
} finally {
if (previous) Object.defineProperty(globalThis, 'document', previous);
else delete globalThis.document;
}
assert.deepEqual(flights, [], 'the cockpit keeps the camera');
});