diff options
author | Anton Tananaev <anton.tananaev@gmail.com> | 2021-04-01 17:25:39 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-01 17:25:39 -0700 |
commit | f09abbd4c301b68fd3172c7752249a5fedc1c3bb (patch) | |
tree | 9ef8e8ca7d7a9d6473e16f0696f3a390007ad905 /modern | |
parent | 9ccde8f4495d1a58e644ad36c1866cb91168d173 (diff) | |
parent | 56567e683734c1f990fb59f193c2d96df706b6b0 (diff) | |
download | trackermap-web-f09abbd4c301b68fd3172c7752249a5fedc1c3bb.tar.gz trackermap-web-f09abbd4c301b68fd3172c7752249a5fedc1c3bb.tar.bz2 trackermap-web-f09abbd4c301b68fd3172c7752249a5fedc1c3bb.zip |
Merge pull request #830 from mtahasahin/BlurryRasterMapFix
Fix Blurry Raster Maps
Diffstat (limited to 'modern')
-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); |