Add padding to bounding box

This commit is contained in:
Sacha Weatherstone
2022-12-28 14:13:19 +11:00
parent 2c3b7893ef
commit c6540ddb20
@@ -27,10 +27,20 @@ export const MapControlls = (): JSX.Element => {
const bounds = bbox(line); const bounds = bbox(line);
const center = map?.cameraForBounds([ const center = map?.cameraForBounds(
[
[bounds[1], bounds[0]], [bounds[1], bounds[0]],
[bounds[3], bounds[2]] [bounds[3], bounds[2]]
]); ],
{
padding: {
top: 10,
bottom: 10,
left: 10,
right: 10
}
}
);
if (center) { if (center) {
map?.easeTo(center); map?.easeTo(center);
@@ -48,7 +58,7 @@ export const MapControlls = (): JSX.Element => {
useEffect(() => { useEffect(() => {
getBBox(); getBBox();
}, []) }, []);
return ( return (
<div className="absolute right-0 top-0 z-10 m-2 "> <div className="absolute right-0 top-0 z-10 m-2 ">