There was an error while loading. Please reload this page.
1 parent fce68e6 commit c587075Copy full SHA for c587075
1 file changed
app/javascript/maplibre/controls/geolocate.js
@@ -32,9 +32,13 @@ export function initializeGeoLocateControl() {
32
33
geolocate.on('geolocate', (position) => {
34
pitchCompassView()
35
- window.dispatchEvent(new CustomEvent('gps-position', {
36
- detail: { lng: position.coords.longitude, lat: position.coords.latitude }
37
- }))
+ const coords = position.coords
+ console.log('geolocate event', coords)
+ if (coords) {
38
+ window.dispatchEvent(new CustomEvent('gps-position', {
39
+ detail: { lng: coords.longitude, lat: coords.latitude }
40
+ }))
41
+ }
42
})
43
44
// follow mode
0 commit comments