Installations: a label box takes a click only when nothing else was hit

The fallback to the label box the shared overlay paints for a site now runs
only when the click hit nothing drawn (the map itself), reads the overlay in
CSS pixels, and accepts the site only when its label is the one painted on
top there: an aircraft or vessel, or another layer's label, over a site's
label keeps its own click. Tested against the overlay's hit rects, not a stub.
This commit is contained in:
Denis Groshev committed 2026-11-17 16:28:04 +01:00
1 parent be326fdcf4
commit 9ed6f11c58
3 files changed
+101 -13

No files matched your search

+7 -9
View File
@@ -204,10 +204,11 @@ export function createControls({
},
/**
* 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. The dot, outline and fill themselves are query port hits, read
* with {@link findByPick}. Null for anything else.
* 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
* 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}.
*/
@@ -216,14 +217,11 @@ export function createControls({
return null;
let hit = null;
try {
hit =
overlayHost?.hitTest?.(position.x, position.y, {
sourceId: LAYER_ID,
}) ?? null;
hit = overlayHost?.hitTest?.(position.x, position.y) ?? null;
} catch {
hit = null;
}
return hit ? methods.getById(hit.entryId) : null;
return hit?.sourceId === LAYER_ID ? methods.getById(hit.entryId) : null;
},
/**