Improve navigation control

This commit is contained in:
Alireza Adli 2023-10-27 15:05:04 -04:00
parent c9a56504ce
commit 88d27dbf6b

View File

@ -121,6 +121,8 @@ export const ColouringMap: FC<ColouringMapProps> = ({
zoom: zoom, zoom: zoom,
}); });
map.current.addControl(new mapboxgl.NavigationControl());
map.current.on("move", () => { map.current.on("move", () => {
setLng(map.current.getCenter().lng.toFixed(4)); setLng(map.current.getCenter().lng.toFixed(4));
setLat(map.current.getCenter().lat.toFixed(4)); setLat(map.current.getCenter().lat.toFixed(4));
@ -128,8 +130,6 @@ export const ColouringMap: FC<ColouringMapProps> = ({
}); });
}); });
map.addControl(new mapboxgl.NavigationControl());
return ( return (
<div <div
ref={mapContainer} ref={mapContainer}