Skip to content

Commit c587075

Browse files
committed
debug help for mobile location
1 parent fce68e6 commit c587075

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

app/javascript/maplibre/controls/geolocate.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,13 @@ export function initializeGeoLocateControl() {
3232

3333
geolocate.on('geolocate', (position) => {
3434
pitchCompassView()
35-
window.dispatchEvent(new CustomEvent('gps-position', {
36-
detail: { lng: position.coords.longitude, lat: position.coords.latitude }
37-
}))
35+
const coords = position.coords
36+
console.log('geolocate event', coords)
37+
if (coords) {
38+
window.dispatchEvent(new CustomEvent('gps-position', {
39+
detail: { lng: coords.longitude, lat: coords.latitude }
40+
}))
41+
}
3842
})
3943

4044
// follow mode

0 commit comments

Comments
 (0)