From 3dea76777bf48cbc28ebfde013ef5d97f956624d Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sat, 25 Sep 2021 17:31:25 +0300 Subject: [PATCH] saveTiles clean up listeners on close --- modules/ui/markers-editor.js | 2 +- modules/ui/options.js | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/modules/ui/markers-editor.js b/modules/ui/markers-editor.js index bf63a685..5664bbbe 100644 --- a/modules/ui/markers-editor.js +++ b/modules/ui/markers-editor.js @@ -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 }); diff --git a/modules/ui/options.js b/modules/ui/options.js index e7fb1357..f59716b4 100644 --- a/modules/ui/options.js +++ b/modules/ui/options.js @@ -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;