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
1 changed files with 7 additions and 2 deletions

View File

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