Merge origin/main into space-missions-fixes

Main's single click rule (the card or label on top takes the click, read
once per click through clickCard and isUnderOtherCard in
src/data/pickRegistry.js) covers a click on a Space Missions label: a
mission marker label is an interactive world-overlay entry, so the
host's hit test names it as the card on top for every other layer. The
per-layer label guards in CCTV, Drone Airspace, FIRMS, Ghost Maps, News,
Perimeters, Shipwrecks, Vessels, Wildlife Sightings, ALPR, Local ADS-B
and the cockpit orbital focus are dropped for main's versions.

The mission-label tests are kept on main's API: fakeInputUnderLabel now
also names the label as the card on top, and each test shows a click on
the label never acts on the card, camera, vessel, fire, reader, aircraft
or report under it, and leaves the selection as it is. A launches test
checks that a mission label is interactive and is the card on top for
every other layer. Docs, changelog and the dispatcher's `overlay` note
describe the merged behaviour.

Co-authored-by: Manjunath Paparaju <[email protected]>
This commit is contained in:
Sameh KhamisandManjunath Paparaju committed 2026-11-18 20:00:25 -08:00
commit 0e5c5e624c
146 files changed
+9734 -1157

No files matched your search

+5 -2
View File
@@ -1,5 +1,6 @@
import { isFollowing } from '../../data/followed.js';
import { inputFor } from '../../input/dispatcher.js';
import { isUnderOtherCard } from '../../data/pickRegistry.js';
import { distance, fromDegrees, toLonLatH } from '../../geo/index.js';
import {
LAYER_ID,
@@ -581,11 +582,13 @@ export function createAlprPresentation({ state, services, source }) {
if (state.clickSubscription) return;
state.clickSubscription = inputFor(viewer).onClick((event) => {
if (!state.enabled) return;
// Another layer's card or label painted on top takes the click: the item
// under it does not act, and the click is not empty space either.
if (isUnderOtherCard(event)) return;
// The painted overlay answers first; the scene is picked only if not.
// A click a label painted over both took is on neither.
const hit = event.drawHit;
const id =
(!event.overlay && overlay.pick(event.screenPosition)) ||
overlay.pick(event.screenPosition) ||
(hit && hit.set === markers.icons?.id ? hit.id : null);
if (
id &&
+57 -3
View File
@@ -1,7 +1,8 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import * as Cesium from 'cesium';
import { fakeInputUnderLabel } from '../../input/testDoubles.mjs';
import { fakeInput, fakeInputUnderLabel } from '../../input/testDoubles.mjs';
import { setClickCardHitTest } from '../../data/pickRegistry.js';
import { fakeDrawPort } from '../../testSupport/fakeDrawPort.mjs';
import { bindFakeCesiumScene } from '../../testSupport/fakeCesiumScene.mjs';
import { createAlprMarkerSet } from './markerState.js';
@@ -105,7 +106,7 @@ function harness(t) {
return { state, fake, at: { x: 100, y: 100 } };
}
test('a click a label painted over a camera takes never selects it, and lets go of the selected camera', (t) => {
test('a click on a mission label over a camera never selects it, and keeps the selected camera', (t) => {
const h = harness(t);
h.fake.label.over = true;
h.fake.click(h.at);
@@ -116,7 +117,60 @@ test('a click a label painted over a camera takes never selects it, and lets go
h.fake.click(h.at);
assert.equal(h.state.selectedId, 'camera:0');
// The label on top is its own click: the selection stays.
h.fake.label.over = true;
h.fake.click(h.at);
assert.equal(h.state.selectedId, null, 'the selection is let go');
assert.equal(h.state.selectedId, 'camera:0', 'the selection stays');
});
// The card or label painted on top takes the click: ALPR does not even pick
// under another layer's card, so no camera is selected or released there.
test("another layer's card over an ALPR camera keeps the click", (t) => {
let picks = 0;
const viewer = {
scene: {
canvas: new EventTarget(),
pick: () => {
picks++;
return null;
},
},
};
const input = fakeInput(viewer);
const noop = () => {};
const state = {
enabled: true,
viewer,
clickSubscription: null,
markers: { icons: null },
recordById: new Map(),
selectedId: null,
};
const presentation = createAlprPresentation({
state,
services: {
render: { governorRequestRender: noop },
context: {
clearSelectedEntityContextForLayer: noop,
getSelectedEntityContext: () => null,
registerEntityContext: noop,
removeEntityContextsForLayer: noop,
selectEntityContext: noop,
},
groundFloor: { cachedGroundFloor: () => null },
},
});
presentation.installInteraction(viewer);
let top = { sourceId: 'earthquake-card', entryId: 'earthquake-card:ak1' };
setClickCardHitTest(() => top);
t.after(() => {
setClickCardHitTest(null);
state.clickSubscription?.();
input.destroy();
});
input.tap({ x: 10, y: 10 });
assert.equal(picks, 0, 'covered: the scene under the card is not picked');
top = null;
input.tap({ x: 10, y: 10 });
assert.ok(picks > 0, 'open map: the click reaches the scene');
});