fix(local-adsb): a tap selects only an aircraft exactly under it again

A click read the scene's exact pick and a drill at the tap. Through the
input dispatcher it read the click's id, which on a touch screen comes
from the wider contact search: a tap near a local aircraft selected it,
and one near another layer's contact kept the selection. It reads the
exact top hit again, as the shipwrecks layer does.
This commit is contained in:
Sameh Khamis committed 2026-11-14 01:49:17 -08:00
1 parent 805c9b5ccd
commit cbc0c114eb
2 files changed
+42 -4

No files matched your search

+10 -4
View File
@@ -654,10 +654,16 @@ export function createLocalAdsbLayer({
const top = event.drawHit;
const own = ownHit(top);
if (own) return own;
// What is on top when it is no draw-set item: a sibling's contact
// drawn on its own, a tile, or (on a coarse pointer) a contact found
// under the touch.
const topId = top ? top.id : event.id;
// What is exactly on top when it is no draw-set item: a sibling's
// contact drawn on its own, or a tile. Never a touch's wider contact
// search: a tap that misses an aircraft selects nothing, and one near
// another layer's contact clears the selection, as the exact pick did.
const exact = top ? null : event.topHit;
const topId = top
? top.id
: exact && !exact.surface && exact.id != null
? String(exact.id)
: null;
if (!top && topId && markers.has(topId)) return topId;
const trail = Boolean(topId) && String(topId).startsWith(TRAIL_PICK_PREFIX);
if (ownedElsewhere(topId) && !trail) return 'other';