mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52:21 +00:00
fix(overlays): let only the topmost painted card act on a click
Card handlers hit-tested only their own source, so a card buried under another layer's card still acted, and a click on a selected quake card over a vessel or fire card made both layers act. Vessels, FIRMS, wildlife, news, ghost maps and shipwrecks now read the unfiltered topmost painted entry: their own card acts only when it is on top, and a click on another layer's card is that layer's, so it neither acts here nor clears a selection. A top news or wildlife card still acts over another layer's scene item, so it never goes dead over a flight trail or a directions route; a registered marker under a foreign card is still its layer's to select.
This commit is contained in:
1 parent
5bc31ce08a
commit
836daf82b3
14 files changed
+310
-43
No files matched your search
@@ -1348,10 +1348,10 @@ export function createNewsLayer({
|
||||
clickOff = inputFor(viewer).onClick((event) => {
|
||||
const at = event?.screenPosition;
|
||||
if (!enabled || destroyed || !isPointerFree() || !at) return;
|
||||
const card = hitTestOverlay(at.x, at.y, {
|
||||
sourceId: NEWS_OVERLAY_SOURCE_ID,
|
||||
});
|
||||
if (card?.entry?.activate) {
|
||||
// The topmost painted entry decides: our own card acts; one covered by
|
||||
// another layer's card does not.
|
||||
const card = hitTestOverlay(at.x, at.y);
|
||||
if (card?.sourceId === NEWS_OVERLAY_SOURCE_ID && card.entry?.activate) {
|
||||
card.entry.activate();
|
||||
return;
|
||||
}
|
||||
@@ -1408,6 +1408,8 @@ export function createNewsLayer({
|
||||
return;
|
||||
}
|
||||
if (id && isOwnedByOtherLayer(NEWS_LAYER_ID, id)) return;
|
||||
// Another layer's card on top is that layer's click, not empty map.
|
||||
if (card) return;
|
||||
if (selectedId && !picked?.id) layer.setParams({ clear: true });
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user