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

Loading…
Cancel
Save