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:
manjunath22466 committed 2026-11-17 01:33:06 +05:30
1 parent 836daf82b3
commit 133d022b29
23 files changed
+825 -78

No files matched your search

+31 -17
View File
@@ -23,8 +23,13 @@ export function createLifecycle({
source,
}) {
const { activateCctvCameraFromWorldClick } = services.activation;
const { resolvePickId, registerPickOwner, unregisterPickOwner } =
services.picking;
const {
resolvePickId,
registerPickOwner,
unregisterPickOwner,
isOwnedByOtherLayer,
isCardBackground,
} = services.picking;
const { onFocusTargetAppear } = services.focus;
const { releaseContinuousRender } = services.render;
@@ -401,23 +406,32 @@ export function createLifecycle({
);
return;
}
// Any identified scene object owns this click even if its layer does not
// register a shared pick predicate. This keeps selectable siblings ahead
// of an overlapping CCTV card while ID-less globe/terrain/tile surfaces
// remain eligible for true empty-space deselection.
const pickedId = resolvePickId(picked);
if (pickedId !== null) return;
// Item A (owner round 2): the scene pick found no camera — try the
// painted ambient cards. The cards canvas is pointer-events:none (this
// handler owns the events), so a click landing on a card's rect selects
// its camera exactly like a click on the icon. Click positions
// and the recorded rects are both CSS px — direct comparison.
const cardId = layerState._cctvOverlayHost.hitTest(
// Cards use the last-painted top hit, never an obscured card from
// our own source. Actual camera icons above keep their normal route.
const cardHit = layerState._cctvOverlayHost.hitTest(
event.screenPosition.x,
event.screenPosition.y,
{ sourceId: CCTV_OVERLAY_SOURCE_ID },
)?.entryId;
if (cardId && layerState._recordById.has(cardId)) {
{},
);
const cardId =
cardHit?.sourceId === CCTV_OVERLAY_SOURCE_ID &&
layerState._recordById.has(cardHit.entryId)
? cardHit.entryId
: null;
const pickedId = resolvePickId(picked);
const hit = event.drawHit;
// A live top CCTV card acts over shapes whose layers stand aside
// for a painted card (drone zones, fire perimeters, quake discs,
// cables, launch markers), as each registers them. Unknown
// identified objects and registered owners remain barriers.
const cardBackground =
cardId &&
typeof pickedId === 'string' &&
!isOwnedByOtherLayer?.('cctv', pickedId) &&
Boolean(isCardBackground?.(hit));
if (pickedId !== null && !cardBackground) return;
if (cardHit && cardHit.sourceId !== CCTV_OVERLAY_SOURCE_ID) return;
if (cardId) {
activateCctvCameraFromWorldClick(
cardId,
parts.selection.setActiveCamera,