diff --git a/frontend/src/components/MapComponent.vue b/frontend/src/components/MapComponent.vue index ebe5695..57f6b8b 100644 --- a/frontend/src/components/MapComponent.vue +++ b/frontend/src/components/MapComponent.vue @@ -145,19 +145,21 @@ export default { const popup = new maplibregl.Popup({ closeButton: false, closeOnClick: false, - }); + }) - map.value.on("mouseover", "fields-layer", (e) => { - map.value.getCanvas().style.cursor = "pointer"; - popup + map.value.on("click", "fields-layer", (e) => { + new maplibregl.Popup({}) .setLngLat(e.lngLat) .setHTML(e.features[0].properties["descriptio"]) .addTo(map.value); }) + map.value.on("mouseover", "fields-layer", (e) => { + map.value.getCanvas().style.cursor = "pointer"; + }) + map.value.on("mouseleave", "fields-layer", (e) => { map.value.getCanvas().style.cursor = ""; - popup.remove(); }) map.value.on("mouseover", "samples-layer", (e) => {