resize box on window resize

This commit is contained in:
Johan Le Baut 2023-01-11 17:12:21 +01:00
parent 2f5dddde8b
commit 296ed8da8a

View file

@ -140,14 +140,19 @@ async function initLimitsBox(map, btn) {
await getServerBoxBounds(map, box); await getServerBoxBounds(map, box);
box.addTo(map); box.addTo(map);
map.on("zoom move", () => { map.on("zoom move zoomend moveend", () => {
box.setBounds(getRectangleCoord(map)) box.setBounds(getRectangleCoord(map))
}) })
btn.addEventListener("click", () => { btn.addEventListener("click", () => {
getServerBoxBounds(map, box) getServerBoxBounds(map, box);
}); });
addEventListener("resize", () => {
getServerBoxBounds(map, box);
});
} }
function createRectangleBox(map) { function createRectangleBox(map) {