mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
Let a mission label select its mission in the cockpit, and say what the merged click rule does
Under the card-on-top rule a mission label is the card on top for the cockpit too, so the label no longer steps aside there: it selects its mission without moving the camera the cockpit holds. Tests and docs no longer claim a covered click reaches what lies under the label, and the busy-restore note says an explicit Satellites action lets the saved state go. Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
1 parent
0e5c5e624c
commit
a29efa12c4
4 files changed
+32
-19
No files matched your search
@@ -181,12 +181,12 @@ export function createLifecycle({
|
||||
services.overlays?.hitTestWorldOverlay?.(position?.x, position?.y);
|
||||
const missionsShown = () =>
|
||||
layerState._enabled && parts.rendering.missionsShown();
|
||||
const focusLaunch = (id) => {
|
||||
const focusLaunch = (id, { move = true } = {}) => {
|
||||
if (!id) return false;
|
||||
const launch = layerState._launches.find((entry) => entry.id === id);
|
||||
if (!launch) return false;
|
||||
parts.selection.setSelectedMission(launch.id);
|
||||
parts.selection.focusMission(launch);
|
||||
if (move) parts.selection.focusMission(launch);
|
||||
for (const listener of [...layerState._globePickListeners]) {
|
||||
try {
|
||||
listener(launch.id);
|
||||
@@ -245,14 +245,16 @@ export function createLifecycle({
|
||||
const input = inputFor(viewer);
|
||||
const overlayClicks = new WeakSet();
|
||||
const unsubscribeLabelClick = input.onOverlayClick((event) => {
|
||||
// The cockpit reads ambient clicks; a mission label must not take them.
|
||||
if (!missionsShown() || cockpitActive()) return false;
|
||||
if (!missionsShown()) return false;
|
||||
const hit = overlayAt(event.screenPosition);
|
||||
if (!hit) return false;
|
||||
// Capture the painted hit before other handlers can invalidate the
|
||||
// overlay. An unrelated label keeps the click above mission geometry.
|
||||
overlayClicks.add(event);
|
||||
return focusLaunch(markerLaunchId(hit));
|
||||
// The label is the card on top, so every other layer and the cockpit
|
||||
// leave its click alone. In the cockpit, which holds the camera, it
|
||||
// selects the mission without moving there.
|
||||
return focusLaunch(markerLaunchId(hit), { move: !cockpitActive() });
|
||||
});
|
||||
const unsubscribeClick = input.onClick((event) => {
|
||||
// Another layer's card or label on top is that layer's click, read
|
||||
|
||||
Reference in new issue
Block a user