diff options
author | Anton Tananaev <anton@traccar.org> | 2022-12-07 17:33:28 -0800 |
---|---|---|
committer | Anton Tananaev <anton@traccar.org> | 2022-12-07 17:33:28 -0800 |
commit | 55400d4286f07fedcbfa7263de3ba663b811dbf2 (patch) | |
tree | 4ead85bf2def91805b368ca98bcbd89c5023a68d /modern/src/map | |
parent | 376255707d7b21503a752dfcc4bd9b3f6623e908 (diff) | |
download | trackermap-web-55400d4286f07fedcbfa7263de3ba663b811dbf2.tar.gz trackermap-web-55400d4286f07fedcbfa7263de3ba663b811dbf2.tar.bz2 trackermap-web-55400d4286f07fedcbfa7263de3ba663b811dbf2.zip |
Fallback map styles
Diffstat (limited to 'modern/src/map')
-rw-r--r-- | modern/src/map/core/MapView.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modern/src/map/core/MapView.js b/modern/src/map/core/MapView.js index 2c49b8ba..35b3a65a 100644 --- a/modern/src/map/core/MapView.js +++ b/modern/src/map/core/MapView.js @@ -91,8 +91,9 @@ const MapView = ({ children }) => { }, [mapboxAccessToken]); useEffect(() => { - const filteredStyles = mapStyles.filter((style) => style.available && activeMapStyles.includes(style.id)); - switcher.updateStyles(filteredStyles, defaultMapStyle); + const filteredStyles = mapStyles.filter((s) => s.available && activeMapStyles.includes(s.id)); + const styles = filteredStyles.length ? filteredStyles : mapStyles.filter((s) => s.id === 'osm'); + switcher.updateStyles(styles, defaultMapStyle); }, [mapStyles, defaultMapStyle]); useEffect(() => { |