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

+12 -10
View File
@@ -218,16 +218,18 @@ export function createFirePerimetersLayer({
_clickSubscription = inputFor(_viewer).onClick((event) => {
// A click on the incident card itself opens its InciWeb page (when the
// incident has one) and never disturbs the selection.
// A click a label painted over the cards took is not on a card.
const cardHit = event.overlay
? null
: overlayHost.hitTest?.(
event.screenPosition?.x,
event.screenPosition?.y,
{ sourceId: PERIMETER_OVERLAY_SOURCE_ID },
);
if (cardHit && cardHit.entryId === _selectedCardId) {
if (_selectedLink && openExternal) openExternal(_selectedLink);
// The card or label painted on top takes the click, read once per
// click so every layer agrees: this area's shapes are background to
// another layer's card or label painted over them.
const cardHit = picking.clickCard?.(event) ?? null;
if (cardHit) {
if (
cardHit.sourceId === PERIMETER_OVERLAY_SOURCE_ID &&
cardHit.entryId === _selectedCardId &&
_selectedLink &&
openExternal
)
openExternal(_selectedLink);
return;
}
const picked = event.topHit;
+64 -19
View File
@@ -1,6 +1,7 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { createFirePerimetersLayer } from './index.js';
import { clickCard } from '../../data/pickRegistry.js';
import { fakeInput, fakeInputUnderLabel } from '../../input/testDoubles.mjs';
import { bindFakeDraw } from '../../testSupport/fakeDrawPort.mjs';
@@ -59,6 +60,11 @@ function harness(
String(pickedId).startsWith('other-layer:'),
registerPickOwner: (layerId, predicate) => owners.set(layerId, predicate),
unregisterPickOwner: (layerId) => owners.delete(layerId),
// The card on top at a click, as the registry answers from the host;
// a mission label painted over everything comes first.
clickCard: (click) =>
clickCard(click) ??
cardHit(click.screenPosition?.x, click.screenPosition?.y, {}),
},
inciwebSource: inciwebIndex
? { getIndex: async () => inciwebIndex }
@@ -79,7 +85,8 @@ function harness(
clicks,
owners,
opened,
/** A label painted over the map: while `over`, it takes each click. */
/** A Space Missions label painted over the map: while `over`, it takes
* each click and is the card on top. */
label: input.label,
};
}
@@ -246,6 +253,43 @@ test('clicking a perimeter publishes its incident card; empty space clears it',
assert.equal(h.overlay.entries.get('fire-perimeters')?.length ?? 0, 0);
});
// Another layer's card or label painted over the area (a quake's card or
// magnitude label) is that layer's click: the area under it stands aside.
test("another layer's overlay on top keeps a click off the area", async () => {
let pickResult = null;
let foreignOnTop = false;
const h = harness(
{ getSnapshot: async () => [row] },
{
pick: () => pickResult,
// Unfiltered: the topmost entry of any source.
cardHit: (_x, _y, options) =>
foreignOnTop && !options?.sourceId
? { sourceId: 'earthquake-card', entryId: 'earthquake-card:ak1' }
: null,
},
);
await h.layer.update(h.viewer);
pickResult = perimeterPick('fire-perimeter:2026-NMGNF-000123:0');
foreignOnTop = true;
h.clicks.handler({ position: { x: 10, y: 10 } });
assert.equal(h.overlay.entries.get('fire-perimeters')?.length ?? 0, 0);
// With nothing painted over it, the same click selects the area.
foreignOnTop = false;
h.clicks.handler({ position: { x: 10, y: 10 } });
assert.equal(
h.overlay.entries.get('fire-perimeters')[0].id,
'fire-perimeter-card:2026-NMGNF-000123',
);
// An overlay on top never clears an existing selection either.
foreignOnTop = true;
h.clicks.handler({ position: { x: 10, y: 10 } });
assert.equal(
h.overlay.entries.get('fire-perimeters')[0].id,
'fire-perimeter-card:2026-NMGNF-000123',
);
});
test('disable removes the click handler, pick ownership, and any card', async () => {
const h = harness(
{ getSnapshot: async () => [row] },
@@ -282,12 +326,16 @@ test('a matched incident card carries the InciWeb line and click-through', async
},
];
let cardHitResult = null;
let foreignOnTop = false;
const h = harness(
{ getSnapshot: async () => [{ ...row, name: 'Fixture' }] },
{
pick: () => null,
inciwebIndex,
cardHit: () => cardHitResult,
cardHit: (_x, _y, options) =>
foreignOnTop && !options?.sourceId
? { sourceId: 'earthquake-card', entryId: 'earthquake-card:ak1' }
: cardHitResult,
},
);
await h.layer.update(h.viewer);
@@ -302,9 +350,15 @@ test('a matched incident card carries the InciWeb line and click-through', async
const entries = h.overlay.entries.get('fire-perimeters');
assert.equal(entries[0].details.at(-1), 'InciWeb ↗ · click card to open');
// Clicking the card itself opens the InciWeb page.
cardHitResult = { entryId: entries[0].id };
// A selected card covered by a quake card cannot open its hidden link.
cardHitResult = { sourceId: 'fire-perimeters', entryId: entries[0].id };
h.viewer.scene.pick = () => null;
foreignOnTop = true;
h.clicks.handler({ position: { x: 12, y: 12 } });
assert.deepEqual(h.opened, []);
assert.equal(h.overlay.entries.get('fire-perimeters')[0].id, entries[0].id);
// Removing the foreground card makes the incident card actionable again.
foreignOnTop = false;
h.clicks.handler({ position: { x: 12, y: 12 } });
assert.deepEqual(h.opened, ['https://inciweb.wildfire.gov/node/329300']);
assert.equal(
@@ -314,7 +368,7 @@ test('a matched incident card carries the InciWeb line and click-through', async
);
});
test('a click a label painted over the incident card takes never opens its InciWeb page, and closes the card', async () => {
test('a click on a mission label over the incident card never opens its InciWeb page, and keeps the card open', async () => {
let cardHitResult = null;
const h = harness(
{ getSnapshot: async () => [row] },
@@ -336,26 +390,17 @@ test('a click a label painted over the incident card takes never opens its InciW
const [card] = h.overlay.entries.get('fire-perimeters');
assert.equal(card.details.at(-1), 'InciWeb ↗ · click card to open');
// The open card lies under the label: the click opens nothing.
cardHitResult = { entryId: card.id };
// The open card lies under the label: the click opens nothing, and the
// label on top is its own click, so the card stays open.
cardHitResult = { sourceId: 'fire-perimeters', entryId: card.id };
h.viewer.scene.pick = () => null;
h.label.over = true;
h.clicks.handler({ position: { x: 12, y: 12 } });
assert.deepEqual(h.opened, [], 'the page beneath the label is not opened');
assert.equal(
h.overlay.entries.get('fire-perimeters')?.length ?? 0,
0,
'the card is closed',
);
assert.equal(h.overlay.entries.get('fire-perimeters')?.[0]?.id, card.id);
// Off the label, a click on the open card opens its page.
h.label.over = false;
h.viewer.scene.pick = () =>
perimeterPick('fire-perimeter:2026-NMGNF-000123:0');
h.clicks.handler({ position: { x: 10, y: 10 } });
await new Promise((done) => setTimeout(done, 0));
cardHitResult = { entryId: h.overlay.entries.get('fire-perimeters')[0].id };
h.viewer.scene.pick = () => null;
h.clicks.handler({ position: { x: 12, y: 12 } });
assert.deepEqual(h.opened, ['https://inciweb.wildfire.gov/node/329300']);
h.layer.destroy();
@@ -378,7 +423,7 @@ test('an unmatched incident renders no InciWeb line and card clicks stay inert',
entries[0].details.some((line) => line.includes('InciWeb')),
false,
);
cardHitResult = { entryId: entries[0].id };
cardHitResult = { sourceId: 'fire-perimeters', entryId: entries[0].id };
h.viewer.scene.pick = () => null;
h.clicks.handler({ position: { x: 12, y: 12 } });
assert.deepEqual(h.opened, []);