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
@@ -4,6 +4,8 @@ import { canvasOf, findCamera, findFrame } from '../../render/rendererOf.js';
|
||||
import { worldClock } from '../../time/worldClock.js';
|
||||
|
||||
const HOVER_PICK_INTERVAL_MS = 120;
|
||||
/** Our id in the pick registry's card backgrounds. */
|
||||
const CARD_BACKGROUND_ID = 'rocket-launches';
|
||||
|
||||
/**
|
||||
* Bound hover picking independently of precise click selection. A move inside
|
||||
@@ -200,8 +202,29 @@ export function createLifecycle({
|
||||
layerState._orbitMatches = 0;
|
||||
parts.overlays.clearMissionOverlaySources();
|
||||
const input = inputFor(viewer);
|
||||
// Our mission items 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 (services.overlays?.hitTestWorldOverlay)
|
||||
services.picking?.registerCardBackground?.(
|
||||
CARD_BACKGROUND_ID,
|
||||
(hit) =>
|
||||
layerState._enabled &&
|
||||
parts.rendering.missionsShown() &&
|
||||
parts.rendering.launchIdFromPicks([hit]) !== null,
|
||||
);
|
||||
const unsubscribeClick = input.onClick((event) => {
|
||||
if (!layerState._enabled || !parts.rendering.missionsShown()) return;
|
||||
// Mission overlays are not interactive, so any overlay entry hit
|
||||
// here is another layer's card or label painted over the click: that
|
||||
// layer's click, not a mission's.
|
||||
if (
|
||||
services.overlays?.hitTestWorldOverlay?.(
|
||||
event.screenPosition?.x,
|
||||
event.screenPosition?.y,
|
||||
)
|
||||
)
|
||||
return;
|
||||
// The click's pick position (CSS px), as the click picked it.
|
||||
const launchId = parts.rendering.launchIdFromPicks(
|
||||
parts.rendering.missionHitsAt(event.position, 12),
|
||||
@@ -221,6 +244,7 @@ export function createLifecycle({
|
||||
layerState._inputSubscription = () => {
|
||||
unsubscribeClick();
|
||||
unsubscribeHover();
|
||||
services.picking?.unregisterCardBackground?.(CARD_BACKGROUND_ID);
|
||||
};
|
||||
// Apply horizon visibility before the renderer draws and picks.
|
||||
// A postRender write is one frame late and can remain visibly stale when
|
||||
|
||||
Reference in new issue
Block a user