From d154221464b1fb1c45719b4488234e134d06cdc5 Mon Sep 17 00:00:00 2001 From: Skylar Ittner Date: Wed, 8 Sep 2021 21:31:54 -0600 Subject: [PATCH] Adjust map geolocation control settings --- www/assets/js/map_maplibre.js | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/www/assets/js/map_maplibre.js b/www/assets/js/map_maplibre.js index 0e97fea..cc5bc3e 100644 --- a/www/assets/js/map_maplibre.js +++ b/www/assets/js/map_maplibre.js @@ -30,18 +30,22 @@ function maplibreMap(containerEl, interactive) { showCompass: false }), 'top-left'); - map.addControl( - new mapboxgl.GeolocateControl({ - positionOptions: { - enableHighAccuracy: true, - timeout: 10 * 1000 - }, - fitBoundsOptions: { - maxZoom: 16 - }, - trackUserLocation: false - }), 'top-left' - ); + map.geolocatecontrol = new mapboxgl.GeolocateControl({ + positionOptions: { + enableHighAccuracy: true + }, + fitBoundsOptions: { + maxZoom: 15 + }, + showAccuracyCircle: false, + trackUserLocation: true + }); + + map.addControl(map.geolocatecontrol, 'top-left'); + + map.geolocatecontrol.on('error', function (err) { + console.error("Geolocate error", err); + }); map.addControl( new mapboxgl.ScaleControl({