mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 09:42:21 +00:00
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:
1 parent
7312280817
commit
bb3bf9858b
87 files changed
+1398
-1775
No files matched your search
@@ -1,10 +1,9 @@
|
||||
import {
|
||||
clearOverlaySource,
|
||||
hitTestWorldOverlay,
|
||||
setOverlayEntries,
|
||||
} from '../overlays/worldOverlay.js';
|
||||
import { inputFor } from '../input/dispatcher.js';
|
||||
import { isActedOnByOtherLayer, resolvePickId } from './pickRegistry.js';
|
||||
import { clickCard } from './pickRegistry.js';
|
||||
import { isTrackingSelectionGesture } from './trackingClickGesture.js';
|
||||
import { governorRequestRender } from '../renderGovernor.js';
|
||||
import { drawOf, findCamera } from '../render/rendererOf.js';
|
||||
@@ -284,7 +283,6 @@ export function createBhoteKoshiLocatorLayer({
|
||||
scheduleDelay = (callback, delayMs) => setTimeout(callback, delayMs),
|
||||
cancelDelay = (handle) => clearTimeout(handle),
|
||||
input = inputFor,
|
||||
hitTest = hitTestWorldOverlay,
|
||||
} = {}) {
|
||||
let _viewer = null;
|
||||
// The globe click that opens an actionable callout of ours on top.
|
||||
@@ -1153,9 +1151,8 @@ export function createBhoteKoshiLocatorLayer({
|
||||
/**
|
||||
* An actionable callout of ours (the trigger record's) is a card painted
|
||||
* over the globe: a click on it opens its source, as its keyboard action
|
||||
* does. Like the other cards, it leaves a drag alone and yields to a layer
|
||||
* that acts on what is under it (an aircraft, a vessel): its exact pick, or
|
||||
* a coarse tap's touch contact whose layer acts on nearby contacts.
|
||||
* does. Like the other cards, it leaves a drag alone and, on top, takes the
|
||||
* click over whatever is drawn under it.
|
||||
*/
|
||||
function installCalloutClick(viewer) {
|
||||
if (_removeClick) return;
|
||||
@@ -1168,26 +1165,9 @@ export function createBhoteKoshiLocatorLayer({
|
||||
_removeClick =
|
||||
clicks?.onClick?.((event) => {
|
||||
if (!_enabled || !isTrackingSelectionGesture(event.gesture)) return;
|
||||
const top = hitTest?.(event.screenPosition?.x, event.screenPosition?.y);
|
||||
// The card painted on top, read once per click so every layer agrees.
|
||||
const top = clickCard(event);
|
||||
if (top?.sourceId !== BHOTE_KOSHI_LOCATOR_OVERLAY_SOURCE_ID) return;
|
||||
const exactId = resolvePickId(event.topHit ?? null);
|
||||
if (
|
||||
exactId &&
|
||||
isActedOnByOtherLayer(BHOTE_KOSHI_LOCATOR_LAYER_ID, exactId, {
|
||||
click: event,
|
||||
})
|
||||
)
|
||||
return;
|
||||
const contactId = resolvePickId(event.hit ?? null);
|
||||
if (
|
||||
contactId &&
|
||||
contactId !== exactId &&
|
||||
isActedOnByOtherLayer(BHOTE_KOSHI_LOCATOR_LAYER_ID, contactId, {
|
||||
expanded: true,
|
||||
click: event,
|
||||
})
|
||||
)
|
||||
return;
|
||||
if (typeof top.entry?.activate === 'function') top.entry.activate();
|
||||
}) ?? null;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user