aboutsummaryrefslogtreecommitdiff
path: root/modern/src/map
diff options
context:
space:
mode:
authorAnton Tananaev <anton.tananaev@gmail.com>2021-04-01 17:25:39 -0700
committerGitHub <noreply@github.com>2021-04-01 17:25:39 -0700
commitf09abbd4c301b68fd3172c7752249a5fedc1c3bb (patch)
tree9ef8e8ca7d7a9d6473e16f0696f3a390007ad905 /modern/src/map
parent9ccde8f4495d1a58e644ad36c1866cb91168d173 (diff)
parent56567e683734c1f990fb59f193c2d96df706b6b0 (diff)
downloadetbsa-traccar-web-f09abbd4c301b68fd3172c7752249a5fedc1c3bb.tar.gz
etbsa-traccar-web-f09abbd4c301b68fd3172c7752249a5fedc1c3bb.tar.bz2
etbsa-traccar-web-f09abbd4c301b68fd3172c7752249a5fedc1c3bb.zip
Merge pull request #830 from mtahasahin/BlurryRasterMapFix
Fix Blurry Raster Maps
Diffstat (limited to 'modern/src/map')
-rw-r--r--modern/src/map/Map.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/modern/src/map/Map.js b/modern/src/map/Map.js
index 8a43e97..d83c297 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);