mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
fix(picking): arbitrate card clicks over passive and background shapes
Flight trails register their ids so every layer reads a trail click as a
no-op, and the directions route claims its line and markers though it acts
only on its maneuver steps. The quake card and magnitude labels yielded to
any registered owner, so over a trail or a route they did nothing. Pick
owners can now name the picks they never act on (registerPickOwner(...,
{ passive })); isActedOnByOtherLayer leaves those out while
isOwnedByOtherLayer is unchanged, so they are still not empty space.
Submarine cables and rocket launches acted on any scene pick, so a card or
label over a cable or a launch marker made both layers act. Both now stand
aside when a world-overlay entry is under the click, as drone airspace and
fire perimeters do through the top-entry check. Each of these layers, and
the quake discs, registers its shapes with registerCardBackground. CCTV
asks isCardBackground instead of matching other layers' set and id formats,
so a live top CCTV card acts once over any of them, while unknown
identified objects and registered owners still block it.
This commit is contained in:
1 parent
836daf82b3
commit
133d022b29
23 files changed
+825
-78
No files matched your search
@@ -215,14 +215,23 @@ export function createFirePerimetersLayer({
|
||||
// so claiming these large ground polygons would make FIRMS/vessel/CCTV
|
||||
// cards inert anywhere over a perimeter. Unowned, our picks read as
|
||||
// "empty space" to siblings — the pre-existing behavior for the globe.
|
||||
// Our shapes stand aside for a card painted over them (below), so that
|
||||
// card's layer may act on the click; without a hit-test they cannot.
|
||||
if (overlayHost?.hitTest)
|
||||
picking?.registerCardBackground?.(
|
||||
layer.id,
|
||||
(hit) => pickedIncidentId(hit) !== null,
|
||||
);
|
||||
_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.
|
||||
const cardHit = overlayHost.hitTest?.(
|
||||
event.screenPosition?.x,
|
||||
event.screenPosition?.y,
|
||||
{ sourceId: PERIMETER_OVERLAY_SOURCE_ID },
|
||||
);
|
||||
// Only the top painted card owns the click; this area's shapes are
|
||||
// background when another layer has painted a card or label over them.
|
||||
if (cardHit && cardHit.sourceId !== PERIMETER_OVERLAY_SOURCE_ID) return;
|
||||
if (cardHit && cardHit.entryId === _selectedCardId) {
|
||||
if (_selectedLink && openExternal) openExternal(_selectedLink);
|
||||
return;
|
||||
@@ -230,15 +239,6 @@ export function createFirePerimetersLayer({
|
||||
const picked = event.topHit;
|
||||
const incidentId = picked ? pickedIncidentId(event.drawHit) : null;
|
||||
if (incidentId) {
|
||||
// Another layer's card or label painted over the perimeter (a
|
||||
// quake's card or magnitude label, a fire card) is that layer's
|
||||
// click: under it the perimeter is background, so it stays as is.
|
||||
const top = overlayHost.hitTest?.(
|
||||
event.screenPosition?.x,
|
||||
event.screenPosition?.y,
|
||||
{},
|
||||
);
|
||||
if (top && top.sourceId !== PERIMETER_OVERLAY_SOURCE_ID) return;
|
||||
abortLinkVerification();
|
||||
_selectedId = incidentId;
|
||||
publishSelectedCard();
|
||||
@@ -261,6 +261,7 @@ export function createFirePerimetersLayer({
|
||||
function removeClickHandler() {
|
||||
_clickSubscription?.();
|
||||
_clickSubscription = null;
|
||||
picking?.unregisterCardBackground?.(layer.id);
|
||||
}
|
||||
|
||||
function clearSelection() {
|
||||
|
||||
Reference in new issue
Block a user