Fix map zoom on safari and remove unneeded scroll behaviour setting

This commit is contained in:
Mitchell McCaffrey 2020-04-13 10:33:49 +10:00
parent 974e1d5792
commit df0054eaf6

View File

@ -80,11 +80,9 @@ function Map({
const mapContainer = mapContainerRef.current; const mapContainer = mapContainerRef.current;
function handleZoom(event) { function handleZoom(event) {
// Stop the trackpad zoom event from zooming the // Stop overscroll on chrome and safari
// webpage when in the map // also stop pinch to zoom on chrome
if (event.ctrlKey) { event.preventDefault();
event.preventDefault();
}
const deltaY = event.deltaY * zoomSpeed; const deltaY = event.deltaY * zoomSpeed;
setMapScale((previousMapScale) => 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 mapRef = useRef(null);
const mapContainerRef = useRef(); const mapContainerRef = useRef();
const rows = mapData && mapData.rows; const rows = mapData && mapData.rows;