Fix map zoom on safari and remove unneeded scroll behaviour setting
This commit is contained in:
parent
974e1d5792
commit
df0054eaf6
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user