fix(click): the card or label on top takes the click in every layer

Review fixes for #1781:

- One rule for cards: the world-overlay host hands its hit test to the
  pick registry, and every click handler reads the topmost interactive
  card or label once per click (`clickCard`, `isUnderOtherCard` in
  src/data/pickRegistry.js), so all handlers agree in any listener order.
  A layer whose own card or label is on top acts on it whatever is drawn
  under it; a layer under another layer's card neither acts nor treats
  the click as empty space (a tracked aircraft stays tracked, a selection
  stays selected); Context names nothing under a card. A selected news
  card over a vessel no longer opens the link and selects the vessel.
- With one rule, the per-owner arbitration options are no longer read
  and are removed: `passive`, `expanded` and `declinesClick` pick owners,
  `rememberClickPickActions`, `isActedOnByOtherLayer`, card backgrounds
  and `cardKeepsClick`. The dispatcher is unchanged from main.
- A drag that ends on a quake disc, label or card does nothing; opening
  the USGS page or clearing the selection needs a clean click.
- A click on the map under another layer's card opens no Street Level
  ground image.
- A CCTV card that is going away is still not the scene under it.
- Docs and changelog describe the new rule.
This commit is contained in:
Sameh Khamis committed 2026-11-18 18:23:41 -08:00
1 parent 7312280817
commit bb3bf9858b
87 files changed
+1398 -1775

No files matched your search

+24 -67
View File
@@ -2061,75 +2061,32 @@ the M6 framing. The package takes clicks, picking, context, focus, the ground
height, the opener, the painter and the translator by injection
(`src/app/layers/earthquakes.js`); without input and picking it draws and takes
no clicks, and its labels stay non-interactive.
On a coarse pointer, a nearby FIRMS or CCTV icon that requires an exact hit
does not swallow a quake card or label tap, or a tap on a vessel's own card.
Owners that pick nearby contacts register as `expanded` pick owners: flights,
military aircraft, vessels, radio and Street Level, and a quake card or label
yields to one the shared touch contact (14 px) reaches. Flights, military and
vessels act on that contact, and so do radio and Street Level, which also pick
through their own windows (17 and 9 px). A station or Street Level item found
only through that window, not as the exact hit or the touch contact, yields to
another layer's card or label painted over it, so a quake card or label beside
one acts alone, with a mouse or a coarse pointer; under such a card, their own
touch contact stays theirs even when the window names another item. Fire and
CCTV cards in turn
yield to a touch contact whose layer acts on it. The aircraft a layer already
tracks and Street Level's position marker are passive picks, since a click on
either does nothing, and the aircraft layers decline a tap that drifts past
the click travel or comes in cockpit mode (`declinesClick`), as CCTV declines
any click that is not clean, so a card over them keeps that tap. The pick
registry records which owners act on a click's exact hit and touch contact
when the click first reads them (`rememberClickPickActions`), and every layer
asks that record for the rest of
the click, so an aircraft that starts tracking during the click does not leave
it to a later card handler as well. Fire, CCTV and vessel cards, like the
quake's, act over a passive owner's pick (a flight trail, the directions
route); with no card there, that pick still leaves a selection alone. The
Bhote Koshi trigger-record callout (`src/data/bhoteKoshiLocator.js`) opens its
source on a click, as its keyboard action does, and yields in the same way: to
a drag, and to a layer that acts on its exact pick or touch contact. Context
(`src/ui/entityContextBridge.js`) names what a click identifies, except under a
world-overlay card or label when the item's owner does not act on that hit
(`cardKeepsClick` in `src/data/pickedContext.js`): a passive route, or a fire
or camera reached only as a nearby contact. The card takes that click.
A press that travels past the tracking click limit is a drag, not a pick: the
quake handler ignores it, and opening the source or clearing the selection
also needs a short press (`src/data/trackingClickGesture.js`).
Quake discs are deliberately not registered in the pick-ownership registry,
like drone airspace and fire perimeters: sibling layers read a disc as empty
space, so their cards, near-miss taps and deselection work over a quake as
before. When another layer's card or label is painted over a disc (a fire card
on a large quake), the quake handler yields to it rather than selecting the
quake beneath. The same rule holds the other way: drone airspace and fire
perimeters do not select a zone or incident from a shape hit while another
layer's card or label is the topmost overlay entry, so a quake card or
magnitude label over one of them acts once, as the quake's. Items of layers
that never act on clicks (air-quality stations, traffic lines, OSM places) do
not block the quake card or labels. A bare area click with nothing painted on
top still selects the area and clears the quake selection. These rules hold in
any listener order because world-overlay hit rectangles are what is painted on
screen until the next paint: an overlay change (a click subscriber publishing
its selection card) no longer clears them mid-click, and a paint that draws
nothing clears them (`src/overlays/worldOverlay.js`).
Card consumers resolve the unfiltered top painted entry before acting, so a
covered vessel, fire, wildlife, news, CCTV, perimeter, ghost-map or shipwreck
card does not act alongside the card above it; drone-airspace shapes use the
same top-entry check (their cards are not interactive). A top news or wildlife
card still acts over another layer's scene item, as before, so a card over a
flight trail (registered as a no-op for every layer) or a directions route is
never a dead click. A click on another layer's card does not activate a covered
card of these layers or clear their selection; a marker of theirs under that
card is still theirs to select. Flight trails and the directions route line and
markers are passive pick owners (`registerPickOwner(…, { passive })`): still
not empty space (`isOwnedByOtherLayer`), but `isActedOnByOtherLayer` leaves
them out, so the quake card and magnitude labels act over them, as do fire,
vessel and CCTV cards. Directions selects only its maneuver steps, though any
other click still clears a selected step. Submarine cables and rocket
launches, whose own overlays are not
interactive, stand aside when any overlay entry is under the click, so a card
or label over a cable or a launch marker acts once. Layers whose shapes stand
aside like this (drone airspace, fire perimeters, quake discs, cables,
launches) register them with `registerCardBackground`, and a live top CCTV card
acts over any shape `isCardBackground` names; unknown identified objects and
registered foreign owners still block it. An empty-map click keeps its existing
deselection behavior.
space, so their near-miss taps and deselection work over a quake as before,
and a disc yields to another layer's registered pick (an aircraft) under it.
The card or label painted on top takes the click. The world-overlay host hands
its hit test to the pick registry (`setClickCardHitTest`), and every click
handler reads the topmost interactive card or label at the click through
`clickCard(click)`, once per click, so all of them agree in any listener order
(`src/data/pickRegistry.js`). A layer whose own card or label is on top acts
on it, whatever is drawn under it: an aircraft, a vessel, a fire, a camera, a
trail, a route. A layer under another layer's card or label
(`isUnderOtherCard`) does nothing: it neither acts on its item there nor
treats the click as empty space, so a tracked aircraft stays tracked and a
selection stays selected. Context (`src/ui/entityContextBridge.js`) names
nothing under a card. With no card on top, the scene rules are unchanged.
World-overlay hit rectangles are what is painted on screen until the next
paint: an overlay change (a click subscriber publishing its selection card)
no longer clears them mid-click, and a paint that draws nothing clears them
(`src/overlays/worldOverlay.js`). A click on the map under another layer's
card opens no Street Level ground image. The Bhote Koshi trigger-record
callout (`src/data/bhoteKoshiLocator.js`) opens its source on a click, as its
keyboard action does, and ignores a drag; its evidence cards act only when
they are the card on top.
Air quality (`./layers/air-quality`) draws its station discs as one renderer
draw set of ground-clamped fills and reads the view through the camera port; it