diff options
-rw-r--r-- | modern/src/map/Map.js | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js index 8a43e97b..d83c297d 100644 --- a/modern/src/map/Map.js +++ b/modern/src/map/Map.js @@ -93,6 +93,23 @@ const Map = ({ children }) => { }; }, []); + useEffect(() => { + if (mapReady && Object.values(map.getStyle().sources).some(e => e.type === 'raster')) { + const onIdle = function () { + const zoom = Math.round(map.getZoom()); + if (zoom !== map.getZoom()) { + map.zoomTo(zoom); + } + }; + map.scrollZoom.setWheelZoomRate(1); + map.on('idle', onIdle); + return () => { + map.scrollZoom.setWheelZoomRate(1/450); + map.off('idle', onIdle); + } + } + }, [mapReady]); + useLayoutEffect(() => { const currentEl = containerEl.current; currentEl.appendChild(element); |