From b525436497748927e65347c38929faf9d1954163 Mon Sep 17 00:00:00 2001 From: Rafael Araujo Lehmkuhl Date: Fri, 28 Jul 2023 19:27:55 -0300 Subject: [PATCH] Reload tiles when map widget is resized --- src/components/widgets/Map.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/components/widgets/Map.vue b/src/components/widgets/Map.vue index d8a3d1dd9..ca81bc9e5 100644 --- a/src/components/widgets/Map.vue +++ b/src/components/widgets/Map.vue @@ -122,7 +122,7 @@ import { useRefHistory } from '@vueuse/core' import { formatDistanceToNow } from 'date-fns' import type { Map } from 'leaflet' import Swal from 'sweetalert2' -import { type Ref, computed, nextTick, onBeforeMount, ref, toRefs } from 'vue' +import { type Ref, computed, nextTick, onBeforeMount, ref, toRefs, watch } from 'vue' import { degrees } from '@/libs/utils' import { useMainVehicleStore } from '@/stores/mainVehicle' @@ -237,6 +237,10 @@ const props = defineProps<{ const widget = toRefs(props).widget +watch(props.widget, () => { + leafletObject.value?.invalidateSize() +}) + onBeforeMount(() => { // Set initial widget options if they don't exist if (Object.keys(widget.value.options).length === 0) {