Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
4983c03
feat(geoLocation): stop centering map after user pans map
jedi-of-the-sea Mar 2, 2026
f3a5427
test: change config for testing
jedi-of-the-sea Mar 2, 2026
161ae1d
fix(geoLocation): distinguish map moves from zoom gestures
jedi-of-the-sea Mar 2, 2026
c246f5c
Merge branch 'next' into vue3/update-behaviour-of-GeoLocation
jedi-of-the-sea Mar 3, 2026
cd6351e
Merge branch 'next' into vue3/update-behaviour-of-GeoLocation
jedi-of-the-sea Mar 3, 2026
eaef84f
Update src/plugins/geoLocation/store.ts
jedi-of-the-sea Mar 4, 2026
dec5a44
docs(core): add description for center
jedi-of-the-sea Mar 4, 2026
6dad490
refactor(geoLocation): watch for user interactions in store
jedi-of-the-sea Mar 4, 2026
dc351ee
fix(geoLocation): correct center/zoom watch behavior
jedi-of-the-sea Mar 4, 2026
8c9e656
refactor(geoLocation): move mapHasBeenMovedByUser into internal exports
jedi-of-the-sea Mar 4, 2026
6675d73
Merge branch 'next' into vue3/update-behaviour-of-GeoLocation
jedi-of-the-sea Mar 4, 2026
1c8357e
Merge branch 'next' into vue3/update-behaviour-of-GeoLocation
jedi-of-the-sea Mar 5, 2026
e3b64cd
Merge branch 'next' into vue3/update-behaviour-of-GeoLocation
dopenguin Mar 5, 2026
4d03083
Merge branch 'next' into vue3/update-behaviour-of-GeoLocation
dopenguin Mar 5, 2026
ad5c864
Update src/core/stores/index.ts
jedi-of-the-sea Mar 6, 2026
df52008
Update src/plugins/geoLocation/store.ts
jedi-of-the-sea Mar 6, 2026
a33b316
fix(geoLocation): exclude zoom from mapHasBeenMovedByUser logic
jedi-of-the-sea Mar 6, 2026
26ab1e3
Merge branch 'next' into vue3/update-behaviour-of-GeoLocation
jedi-of-the-sea Mar 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/snowbox/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
colorScheme,
startCenter: [565874, 5934140],
layers: [
// TODO: Add internalization to snowbox

Check warning on line 95 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / Linting

Unexpected 'todo' comment: 'TODO: Add internalization to snowbox'
{
id: basemapId,
visibility: true,
Expand Down Expand Up @@ -336,7 +336,7 @@
},
],
menus: [
// TODO: Delete the mock plugins including the components once the correct plugins have been implemented

Check warning on line 339 in examples/snowbox/index.js

View workflow job for this annotation

GitHub Actions / Linting

Unexpected 'todo' comment: 'TODO: Delete the mock plugins including...'
[
{
plugin: pluginFullscreen({}),
Expand All @@ -359,7 +359,7 @@
{
plugin: pluginGeoLocation({
checkLocationInitially: false,
keepCentered: false,
keepCentered: true,
showTooltip: true,
zoomLevel: 7,
// usable when you're in HH or fake your geolocation to HH
Expand Down
8 changes: 8 additions & 0 deletions src/core/stores/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ export const useCoreStore = defineStore('core', () => {
const markerStore = useMarkerStore()

return {
/**
* The current center coordinates of the map.
*
* @alpha
* @readonly
*/
center: computed(() => mainStore.center),

/**
* Color scheme the client should be using.
*/
Expand Down
17 changes: 15 additions & 2 deletions src/plugins/geoLocation/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import * as Proj from 'ol/proj'
import { transform as transformCoordinates } from 'ol/proj'
import VectorSource from 'ol/source/Vector'
import { defineStore } from 'pinia'
import { computed, ref } from 'vue'
import { computed, ref, watch } from 'vue'

import { useCoreStore } from '@/core/stores'
import { notifyUser } from '@/lib/notifyUser'
Expand Down Expand Up @@ -46,6 +46,8 @@ export const useGeoLocationStore = defineStore('plugins/geoLocation', () => {
const lastBoundaryCheck = ref<boolean | symbol | null>(null)
const position = ref<number[]>([])

let mapHasBeenMovedByUser = false

const configuration = computed<
GeoLocationPluginOptions & { showTooltip: boolean; zoomLevel: number }
>(() =>
Expand Down Expand Up @@ -141,6 +143,7 @@ export const useGeoLocationStore = defineStore('plugins/geoLocation', () => {

/** Enable tracking of geo position */
function track() {
mapHasBeenMovedByUser = false
if (isGeolocationDenied.value) {
onError({
message: 'Geolocation API usage was denied by user or configuration.',
Expand All @@ -166,6 +169,15 @@ export const useGeoLocationStore = defineStore('plugins/geoLocation', () => {
geolocation.value.on('error', onError)
}

watch(
() => coreStore.center,
() => {
if (position.value !== coreStore.center) {
mapHasBeenMovedByUser = true
}
}
)

/**
* Show error information and stop tracking if there are errors by tracking the position
*/
Expand Down Expand Up @@ -245,7 +257,8 @@ export const useGeoLocationStore = defineStore('plugins/geoLocation', () => {

if (
(configuration.value.keepCentered || !hadPosition) &&
lastBoundaryCheck.value
lastBoundaryCheck.value &&
!mapHasBeenMovedByUser
) {
coreStore.map.getView().setCenter(coordinate)
coreStore.map.getView().setZoom(configuration.value.zoomLevel)
Expand Down
Loading