diff options
author | Boubrid Ihab <boubrid.ihab@gmail.com> | 2022-06-20 12:19:16 +0100 |
---|---|---|
committer | Boubrid Ihab <boubrid.ihab@gmail.com> | 2022-06-20 12:26:56 +0100 |
commit | 0ed9f83afacf0200d62bfd59b06d273c57cb48a9 (patch) | |
tree | a889b55526e60771a05b0dfe029ec9b6c10df2a0 /modern | |
parent | 652910400f87fa3e143a75d6587cd8d0f50d5778 (diff) | |
download | trackermap-web-0ed9f83afacf0200d62bfd59b06d273c57cb48a9.tar.gz trackermap-web-0ed9f83afacf0200d62bfd59b06d273c57cb48a9.tar.bz2 trackermap-web-0ed9f83afacf0200d62bfd59b06d273c57cb48a9.zip |
feature: max zoom on map
Diffstat (limited to 'modern')
-rw-r--r-- | modern/src/common/attributes/useCommonUserAttributes.js | 4 | ||||
-rw-r--r-- | modern/src/map/core/MapView.js | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/modern/src/common/attributes/useCommonUserAttributes.js b/modern/src/common/attributes/useCommonUserAttributes.js index da19885e..1409c5ac 100644 --- a/modern/src/common/attributes/useCommonUserAttributes.js +++ b/modern/src/common/attributes/useCommonUserAttributes.js @@ -64,12 +64,12 @@ export default (t) => useMemo(() => ({ 'web.selectZoom': { name: t('attributeWebSelectZoom'), type: 'number', - }, + }, */ 'web.maxZoom': { name: t('attributeWebMaxZoom'), type: 'number', }, - 'ui.hidePositionAttributes': { + /* 'ui.hidePositionAttributes': { name: t('attributeUiHidePositionAttributes'), type: 'string', }, */ diff --git a/modern/src/map/core/MapView.js b/modern/src/map/core/MapView.js index 20e84185..f7d62c77 100644 --- a/modern/src/map/core/MapView.js +++ b/modern/src/map/core/MapView.js @@ -78,6 +78,11 @@ const MapView = ({ children }) => { const [activeMapStyles] = usePersistedState('activeMapStyles', ['locationIqStreets', 'osm', 'carto']); const [defaultMapStyle] = usePersistedState('selectedMapStyle', 'locationIqStreets'); const mapboxAccessToken = useAttributePreference('mapboxAccessToken'); + const maxZoom = useAttributePreference('web.maxZoom') || 16; + + useEffect(() => { + map.setMaxZoom(maxZoom); + }, [maxZoom]); useEffect(() => { maplibregl.accessToken = mapboxAccessToken; |