From aa4c6476bf3b032a42d86b9a10e65c57fd2e76a6 Mon Sep 17 00:00:00 2001 From: flisowna Date: Thu, 10 Nov 2022 20:06:52 +0400 Subject: [PATCH] WIP - trying out new leaflet usage structure, step by step (markers on map visibile AND with popup, without cluster api) --- packages/nc-gui/components/smartsheet/Map.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/nc-gui/components/smartsheet/Map.vue b/packages/nc-gui/components/smartsheet/Map.vue index 2c50ac79c4..39a6103815 100644 --- a/packages/nc-gui/components/smartsheet/Map.vue +++ b/packages/nc-gui/components/smartsheet/Map.vue @@ -42,8 +42,11 @@ function addMarker(lat: number, long: number, popupContent: string) { if (myMapRef.value == null) { throw new Error('Map is null') } - L.marker([lat, long]).addTo(myMapRef.value) - console.log(popupContent) + const newMarker = L.marker([lat, long]).addTo(myMapRef.value) + + if (newMarker) { + newMarker.bindPopup(popupContent) + } console.log('myMapRef.value', myMapRef.value) // const markerNew = markerRef?.value?.([lat, long]) @@ -54,9 +57,6 @@ function addMarker(lat: number, long: number, popupContent: string) { // myMapRef?.value?.addLayer(markerRef.value) - // if (markerNew) { - // markerNew.bindPopup(popupContent) - // } // return markerNew }