From df0054eaf647cff30de296592090e98cb5388150 Mon Sep 17 00:00:00 2001 From: Mitchell McCaffrey Date: Mon, 13 Apr 2020 10:33:49 +1000 Subject: [PATCH] Fix map zoom on safari and remove unneeded scroll behaviour setting --- src/components/Map.js | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/src/components/Map.js b/src/components/Map.js index 6c9b811..fe6413a 100644 --- a/src/components/Map.js +++ b/src/components/Map.js @@ -80,11 +80,9 @@ function Map({ const mapContainer = mapContainerRef.current; function handleZoom(event) { - // Stop the trackpad zoom event from zooming the - // webpage when in the map - if (event.ctrlKey) { - event.preventDefault(); - } + // Stop overscroll on chrome and safari + // also stop pinch to zoom on chrome + event.preventDefault(); const deltaY = event.deltaY * zoomSpeed; setMapScale((previousMapScale) => @@ -105,16 +103,6 @@ function Map({ }; }, []); - // Stop the overscroll when the map is loaded and restore it when - // unmounted - useEffect(() => { - document.body.style.overscrollBehavior = "none"; - - return () => { - document.body.style.overscrollBehavior = "initial"; - }; - }, []); - const mapRef = useRef(null); const mapContainerRef = useRef(); const rows = mapData && mapData.rows;