mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-19 17:52: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,4 +1,5 @@
|
||||
import { cardKeepsClick, resolvePickedContext } from '../data/pickedContext.js';
|
||||
import { resolvePickedContext } from '../data/pickedContext.js';
|
||||
import { clickCard } from '../data/pickRegistry.js';
|
||||
import { followedOf, onFollowChanged } from '../data/followed.js';
|
||||
import { fromDegreesInto } from '../geo/ellipsoid.js';
|
||||
import { inputFor } from '../input/dispatcher.js';
|
||||
@@ -45,8 +46,6 @@ const FOLLOWABLE = new Set(['flights', 'military', 'satellites']);
|
||||
* to the point under the camera without it.
|
||||
* @param {(lat: number, lon: number) => Promise<object>} [options.regionalBrief]
|
||||
* The app's regional brief service, for the weather and news Context shows.
|
||||
* @param {(x: number, y: number) => object|null} [options.overlayHit]
|
||||
* The overlay card under a screen point, if any (a vessel's, a fire's).
|
||||
* @returns {() => void} disconnects
|
||||
*/
|
||||
export function installEntityContext({
|
||||
@@ -55,7 +54,6 @@ export function installEntityContext({
|
||||
pinia,
|
||||
pickWorld,
|
||||
regionalBrief,
|
||||
overlayHit,
|
||||
}) {
|
||||
const store = useEntityCardStore(pinia);
|
||||
const omnibar = useOmnibarStore(pinia);
|
||||
@@ -311,16 +309,14 @@ export function installEntityContext({
|
||||
// Cockpit has its own picks, and Context is hidden while it runs. A
|
||||
// camera drag never selects, even if it ends over something.
|
||||
if (inCockpit() || !isTrackingSelectionGesture(event.gesture)) return;
|
||||
// A card or label painted on top is its layer's click, read once per
|
||||
// click so every layer agrees: Context names nothing under it and keeps
|
||||
// its own card as it is.
|
||||
if (clickCard(event)) return;
|
||||
const identity = resolvePickedContext(event.hit, {
|
||||
dataManager: getDataManager(),
|
||||
});
|
||||
if (identity) {
|
||||
// A card or label painted over an item its layer does not act on here
|
||||
// (a quake card beside a fire, or over a route) is the card's click.
|
||||
const underCard = Boolean(
|
||||
overlayHit?.(event.screenPosition?.x, event.screenPosition?.y),
|
||||
);
|
||||
if (cardKeepsClick(event, underCard)) return;
|
||||
// These layers start following on their own click; following again
|
||||
// from here would fight them (the flights layer reads a second track
|
||||
// of the same plane as a click on empty map and lets go).
|
||||
@@ -330,14 +326,8 @@ export function installEntityContext({
|
||||
// A click on open ground, sea or sky lets go of what was selected. A
|
||||
// click on something else Context cannot describe (a label, a trail)
|
||||
// leaves the card as it is.
|
||||
// Only a clean click lets go, as the layers' own clicks do; a card
|
||||
// painted on the overlay (a vessel's, a fire's) is not open map.
|
||||
if (
|
||||
event.surface &&
|
||||
isTrackingClickGesture(event.gesture) &&
|
||||
!overlayHit?.(event.screenPosition?.x, event.screenPosition?.y)
|
||||
)
|
||||
store.clear();
|
||||
// Only a clean click lets go, as the layers' own clicks do.
|
||||
if (event.surface && isTrackingClickGesture(event.gesture)) store.clear();
|
||||
});
|
||||
|
||||
// Layers that select through the context store (GeoJSON sites, fires,
|
||||
|
||||
Reference in new issue
Block a user