aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map/Map.js
diff options
context:
space:
mode:
authorAnton Tananaev <anton@traccar.org>2022-04-16 15:49:19 -0700
committerAnton Tananaev <anton@traccar.org>2022-04-16 15:49:19 -0700
commitb0f9aca5d820aae2094f72c56c59a1bee40f2edd (patch)
tree94705e9c226676690034cdaedaef7249c6133272 /modern/src/map/Map.js
parent852cac23dcdfd6462c5bc83676291fa40e1f098e (diff)
downloadtrackermap-web-b0f9aca5d820aae2094f72c56c59a1bee40f2edd.tar.gz
trackermap-web-b0f9aca5d820aae2094f72c56c59a1bee40f2edd.tar.bz2
trackermap-web-b0f9aca5d820aae2094f72c56c59a1bee40f2edd.zip
Fix issue with vector maps (fix #910)
Diffstat (limited to 'modern/src/map/Map.js')
-rw-r--r--modern/src/map/Map.js20
1 files changed, 11 insertions, 9 deletions
diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js
index b020423a..bbfe4764 100644
--- a/modern/src/map/Map.js
+++ b/modern/src/map/Map.js
@@ -68,14 +68,16 @@ map.addControl(new maplibregl.NavigationControl({
const switcher = new SwitcherControl(
() => updateReadyValue(false),
() => {
- const waiting = () => {
- if (!map.loaded()) {
- setTimeout(waiting, 100);
- } else {
- initMap();
- }
- };
- waiting();
+ map.once('styledata', () => {
+ const waiting = () => {
+ if (!map.loaded()) {
+ setTimeout(waiting, 100);
+ } else {
+ initMap();
+ }
+ };
+ waiting();
+ });
},
);
@@ -107,7 +109,7 @@ const Map = ({ children }) => {
{ id: 'mapboxSatellite', title: t('mapMapboxSatellite'), uri: styleMapbox('satellite-v9') },
{ id: 'mapTilerBasic', title: t('mapMapTilerBasic'), uri: styleMapTiler('basic', mapTilerKey) },
{ id: 'mapTilerHybrid', title: t('mapMapTilerHybrid'), uri: styleMapTiler('hybrid', mapTilerKey) },
- ], 'osm');
+ ], 'locationIqStreets');
}, [mapTilerKey]);
useEffect(() => {