mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-21 02:32:18 +00:00
Installations: a label takes a click only where nothing else is drawn
An interactive overlay entry is a card that takes every click from what is drawn under it, so a base's label kept an aircraft or vessel under it from being selected. The labels are no longer interactive entries. The layer claims a click on a label box through the pick registry's click claim, as CCTV counts do, only where nothing another layer draws is under it; over the map or the layer's own dots and fills the label takes it, and another layer's card painted over the label keeps its click. The label box is read from the box the overlay painted for it (overlayHost.paintRect).
This commit is contained in:
1 parent
7b7eb2318a
commit
dac8738b80
9 files changed
+229
-102
No files matched your search
Vendored
+10
-8
@@ -178,10 +178,10 @@ export function createControls({
|
||||
},
|
||||
|
||||
/**
|
||||
* The mapped installation whose label box the shared overlay paints on
|
||||
* top at a canvas position: what a click lands on from far out, where the
|
||||
* dot is 7 px. Another layer's label painted over it there wins, so this
|
||||
* answers null. The dot, outline and fill themselves are query port
|
||||
* The mapped installation whose label box the shared overlay paints at a
|
||||
* canvas position: what a click lands on from far out, where the dot is
|
||||
* 7 px. Another layer's card or label that takes clicks there wins, so
|
||||
* this answers null. The dot, outline and fill themselves are query port
|
||||
* hits, read with {@link findByPick}. Null for anything else.
|
||||
* @param {{x: number, y: number}|null|undefined} position Canvas CSS px.
|
||||
* @returns {object|null} As {@link getById}.
|
||||
@@ -189,13 +189,15 @@ export function createControls({
|
||||
findAt(position) {
|
||||
if (!Number.isFinite(position?.x) || !Number.isFinite(position?.y))
|
||||
return null;
|
||||
let hit = null;
|
||||
let top = null;
|
||||
try {
|
||||
hit = overlayHost?.hitTest?.(position.x, position.y) ?? null;
|
||||
top = overlayHost?.hitTest?.(position.x, position.y) ?? null;
|
||||
} catch {
|
||||
hit = null;
|
||||
top = null;
|
||||
}
|
||||
return hit?.sourceId === LAYER_ID ? methods.getById(hit.entryId) : null;
|
||||
if (top) return null;
|
||||
const id = parts.namedMarkers?.labelAt?.(position) ?? null;
|
||||
return id ? methods.getById(id) : null;
|
||||
},
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user