Skip to content

Commit b5dace6

Browse files
fix(geoLocation): watch zoom and center separately to prevent undesired behaviour
1 parent 8c9e656 commit b5dace6

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/plugins/geoLocation/store.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,12 +170,17 @@ export const useGeoLocationStore = defineStore('plugins/geoLocation', () => {
170170
geolocation.value.on('error', onError)
171171
}
172172

173+
watch(
174+
() => coreStore.zoom,
175+
(newZoom) => {
176+
lastZoom = newZoom
177+
}
178+
)
179+
173180
watch(
174181
() => coreStore.center,
175182
() => {
176183
const isZooming = coreStore.zoom !== lastZoom
177-
lastZoom = coreStore.zoom
178-
179184
if (!isZooming && position.value !== coreStore.center) {
180185
mapHasBeenMovedByUser.value = true
181186
}

0 commit comments

Comments
 (0)