Skip to content

Commit 161ae1d

Browse files
fix(geoLocation): distinguish map moves from zoom gestures
1 parent f3a5427 commit 161ae1d

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/plugins/geoLocation/components/GeoLocation.ce.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ import { useCoreStore } from '@/core/stores'
2121
import { useGeoLocationStore } from '../store'
2222
import { PluginId } from '../types'
2323
24-
const { layout, center } = storeToRefs(useCoreStore())
24+
const { layout, center, zoom } = storeToRefs(useCoreStore())
2525
const geoLocationStore = useGeoLocationStore()
2626
const { state } = storeToRefs(geoLocationStore)
2727
const { position, mapHasBeenMovedByUser } = storeToRefs(geoLocationStore)
2828
29+
let lastZoom = zoom.value
30+
2931
const icon = computed(() => {
3032
if (state.value === 'LOCATED') {
3133
return 'kern-icon-fill--near-me'
@@ -44,7 +46,10 @@ const tooltipPosition = computed(() =>
4446
)
4547
4648
watch(center, () => {
47-
if (position.value !== center.value) {
49+
const isZooming = zoom.value !== lastZoom
50+
lastZoom = zoom.value
51+
52+
if (!isZooming && position.value !== center.value) {
4853
mapHasBeenMovedByUser.value = true
4954
}
5055
})

0 commit comments

Comments
 (0)