saveTiles clean up listeners on close

This commit is contained in:
Azgaar 2021-09-25 17:31:25 +03:00
parent 2587a1643b
commit 3dea76777b
2 changed files with 5 additions and 6 deletions

View file

@ -32,7 +32,7 @@ function editMarker() {
$("#markerEditor").dialog({
title: "Edit Marker",
resizable: false,
position: {my: "center top+30", at: "bottom", of: element, collision: "fit"},
position: {my: "left top", at: "left+10 top+10", of: "svg", collision: "fit"},
close: closeMarkerEditor
});

View file

@ -798,6 +798,9 @@ function openSaveTiles() {
status.innerHTML = "";
let loading = null;
const inputs = document.getElementById("saveTilesScreen").querySelectorAll("input");
inputs.forEach(input => input.addEventListener("input", updateTilesOptions));
$("#saveTilesScreen").dialog({
resizable: false,
title: "Download tiles",
@ -819,17 +822,13 @@ function openSaveTiles() {
}
},
close: () => {
inputs.forEach(input => input.removeEventListener("input", updateTilesOptions));
debug.selectAll("*").remove();
clearInterval(loading);
}
});
}
document
.getElementById("saveTilesScreen")
.querySelectorAll("input")
.forEach(el => el.addEventListener("input", updateTilesOptions));
function updateTilesOptions() {
if (this?.tagName === "INPUT") {
const {nextElementSibling: next, previousElementSibling: prev} = this;