Browse Source

WIP - trying out new leaflet usage structure - works with popup and clusters (and cleaner code)

pull/4140/head
flisowna 2 years ago
parent
commit
6385c78db3
  1. 12
      packages/nc-gui/components/smartsheet/Map.vue

12
packages/nc-gui/components/smartsheet/Map.vue

@ -75,14 +75,18 @@ onMounted(async () => {
attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>', attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>',
}).addTo(myMap) }).addTo(myMap)
markersClusterGroupRef.value = L.markerClusterGroup() markersClusterGroupRef.value = L.markerClusterGroup({
iconCreateFunction(cluster) {
return L.divIcon({ html: `${cluster.getChildCount()}`, className: 'geo-map-marker-cluster' })
},
})
myMap.addLayer(markersClusterGroupRef.value) myMap.addLayer(markersClusterGroupRef.value)
}) })
</script> </script>
<template> <template>
<div class="flex flex-col h-full w-full nounderline"> <div class="flex flex-col h-full w-full nounderline">
<div id="mapContainer" ref="mapContainerRef" class="FOOBAR"></div> <div id="mapContainer" ref="mapContainerRef"></div>
</div> </div>
</template> </template>
@ -93,4 +97,8 @@ onMounted(async () => {
.nounderline { .nounderline {
text-decoration: none; text-decoration: none;
} }
:global(.geo-map-marker-cluster) {
background-color: pink;
}
</style> </style>

Loading…
Cancel
Save