Browse Source

geo data map bug: partially fixing it (but local storage values for zoom and center are not consistently used atm)

pull/4723/head
flisowna 2 years ago
parent
commit
dc31554179
  1. 9
      packages/nc-gui/components/smartsheet/Map.vue

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

@ -1,6 +1,6 @@
<script lang="ts" setup>
import 'leaflet/dist/leaflet.css'
import L from 'leaflet'
import L, { LatLng } from 'leaflet'
import 'leaflet.markercluster'
import { ViewTypes } from 'nocodb-sdk'
import { IsGalleryInj, IsGridInj, IsMapInj, onMounted, provide, ref } from '#imports'
@ -51,7 +51,6 @@ const expandedFormRowState = ref<Record<string, any>>()
// submitted.value = true
// }
// interface Props {
// // modelValue?: GeoLocationType | null
// modelValue?: string | null
@ -164,6 +163,7 @@ watch([formattedData, mapMetaData, markersClusterGroupRef], () => {
const resetZoomAndCenterBasedOnLocalStorage = () => {
if (mapMetaData?.value?.fk_view_id == null) {
console.error('Early leaving of resetZoomAndCenterBasedOnLocalStorage because "mapMetaData?.value?.fk_view_id == null"');
return
}
const initialZoomLevel = parseInt(localStorage.getItem(getMapZoomLocalStorageKey(mapMetaData.value.fk_view_id)) || '10')
@ -180,7 +180,10 @@ const resetZoomAndCenterBasedOnLocalStorage = () => {
}
onMounted(async () => {
const myMap = L.map(mapContainerRef.value!)
const myMap = L.map(mapContainerRef.value!, {
center: new LatLng(10, 10),
zoom: 2,
})
myMapRef.value = myMap

Loading…
Cancel
Save