|
|
|
@ -622,6 +622,7 @@ function setMapMode(mode) { |
|
|
|
return |
|
|
|
} |
|
|
|
mapMode.value = mode |
|
|
|
layersReady = false |
|
|
|
mapInstance.setStyle(MAP_STYLES[mode] || MAP_STYLES.satellite) |
|
|
|
mapInstance.once('style.load', rebuildAfterStyle) |
|
|
|
} |
|
|
|
@ -671,8 +672,11 @@ function flyToSelected() { |
|
|
|
|
|
|
|
function onMapClick(e) { |
|
|
|
if (suppressMapClick) return |
|
|
|
if (!layersReady) return |
|
|
|
const layers = [DEVICE_CIRCLE, DEVICE_LABEL].filter((id) => mapInstance.getLayer(id)) |
|
|
|
if (!layers.length) return |
|
|
|
const feats = mapInstance.queryRenderedFeatures(e.point, { |
|
|
|
layers: [DEVICE_CIRCLE, DEVICE_LABEL].filter((id) => mapInstance.getLayer(id)), |
|
|
|
layers, |
|
|
|
}) |
|
|
|
const id = feats[0]?.properties?.assetId |
|
|
|
if (id) { |
|
|
|
|