fix button state on handler reset

This commit is contained in:
Iris Lightshard 2022-08-14 20:55:19 -06:00
parent fbd1d515d3
commit 5154aff553
Signed by: Iris Lightshard
GPG key ID: 3B7FBC22144E6398
3 changed files with 51 additions and 0 deletions

View file

@ -50,6 +50,24 @@ class MapHandler {
} }
self.map.off("click", MapHandler.polygonAddPoint); self.map.off("click", MapHandler.polygonAddPoint);
} catch {} } catch {}
try {
const saveBtn = document.getElementById("save-btn");
if (saveBtn) {
saveBtn.classList.remove("activeBtn");
}
} catch {}
try {
const clearBtn = document.getElementById("clear-btn");
if (clearBtn) {
clearBtn.classList.remove("activeBtn");
}
} catch {}
try {
const menuBtn = document.getElementById("menu-btn");
if (menuBtn) {
menuBtn.classList.remove("activeBtn");
}
} catch {}
} }
} }
@ -198,6 +216,7 @@ class MapHandler {
okBtn.onclick = ()=> { okBtn.onclick = ()=> {
OverlayState.save(self.overlays); OverlayState.save(self.overlays);
self.modals.okCancel.setVisible(false); self.modals.okCancel.setVisible(false);
MapHandler.resetMapClick();
// show info modal "Save complete" // show info modal "Save complete"
} }
} }
@ -205,6 +224,7 @@ class MapHandler {
if (cancelBtn) { if (cancelBtn) {
cancelBtn.onclick = () => { cancelBtn.onclick = () => {
self.modals.okCancel.setVisible(false); self.modals.okCancel.setVisible(false);
MapHandler.resetMapClick();
} }
} }
self.modals.okCancel.setVisible(true); self.modals.okCancel.setVisible(true);
@ -223,12 +243,14 @@ class MapHandler {
if (okBtn) { if (okBtn) {
okBtn.onclick = ()=> { okBtn.onclick = ()=> {
self.overlays = OverlayState.clear(self.overlays, self.map); self.overlays = OverlayState.clear(self.overlays, self.map);
MapHandler.resetMapClick();
self.modals.okCancel.setVisible(false); self.modals.okCancel.setVisible(false);
} }
} }
const cancelBtn = self.modals.okCancel.cancelBtn(); const cancelBtn = self.modals.okCancel.cancelBtn();
if (cancelBtn) { if (cancelBtn) {
cancelBtn.onclick = () => { cancelBtn.onclick = () => {
MapHandler.resetMapClick();
self.modals.okCancel.setVisible(false); self.modals.okCancel.setVisible(false);
} }
} }

View file

@ -163,11 +163,13 @@ class TileLayerWrapper {
TileLayerWrapper.layers = new Array(); TileLayerWrapper.layers = new Array();
class TextUtils { class TextUtils {
static decodeHTML(text) { static decodeHTML(text) {
return text;
const textArea = document.createElement('textarea'); const textArea = document.createElement('textarea');
textArea.innerHTML = text; textArea.innerHTML = text;
return textArea.value; return textArea.value;
} }
static encodeHTML(text) { static encodeHTML(text) {
return text;
const textArea = document.createElement('textarea'); const textArea = document.createElement('textarea');
textArea.innerText = text; textArea.innerText = text;
return textArea.innerHTML; return textArea.innerHTML;
@ -414,6 +416,27 @@ class MapHandler {
self.map.off("click", MapHandler.polygonAddPoint); self.map.off("click", MapHandler.polygonAddPoint);
} }
catch (_c) { } catch (_c) { }
try {
const saveBtn = document.getElementById("save-btn");
if (saveBtn) {
saveBtn.classList.remove("activeBtn");
}
}
catch (_d) { }
try {
const clearBtn = document.getElementById("clear-btn");
if (clearBtn) {
clearBtn.classList.remove("activeBtn");
}
}
catch (_e) { }
try {
const menuBtn = document.getElementById("menu-btn");
if (menuBtn) {
menuBtn.classList.remove("activeBtn");
}
}
catch (_f) { }
} }
} }
static addMarker(e) { static addMarker(e) {
@ -547,6 +570,7 @@ class MapHandler {
okBtn.onclick = () => { okBtn.onclick = () => {
OverlayState.save(self.overlays); OverlayState.save(self.overlays);
self.modals.okCancel.setVisible(false); self.modals.okCancel.setVisible(false);
MapHandler.resetMapClick();
// show info modal "Save complete" // show info modal "Save complete"
}; };
} }
@ -554,6 +578,7 @@ class MapHandler {
if (cancelBtn) { if (cancelBtn) {
cancelBtn.onclick = () => { cancelBtn.onclick = () => {
self.modals.okCancel.setVisible(false); self.modals.okCancel.setVisible(false);
MapHandler.resetMapClick();
}; };
} }
self.modals.okCancel.setVisible(true); self.modals.okCancel.setVisible(true);
@ -570,12 +595,14 @@ class MapHandler {
if (okBtn) { if (okBtn) {
okBtn.onclick = () => { okBtn.onclick = () => {
self.overlays = OverlayState.clear(self.overlays, self.map); self.overlays = OverlayState.clear(self.overlays, self.map);
MapHandler.resetMapClick();
self.modals.okCancel.setVisible(false); self.modals.okCancel.setVisible(false);
}; };
} }
const cancelBtn = self.modals.okCancel.cancelBtn(); const cancelBtn = self.modals.okCancel.cancelBtn();
if (cancelBtn) { if (cancelBtn) {
cancelBtn.onclick = () => { cancelBtn.onclick = () => {
MapHandler.resetMapClick();
self.modals.okCancel.setVisible(false); self.modals.okCancel.setVisible(false);
}; };
} }

View file

@ -222,6 +222,8 @@ button.negative-btn:hover {
z-index: 10; z-index: 10;
color: white; color: white;
padding: 0.5em; padding: 0.5em;
width: 100%;
max-width: fit-content;
} }
#import-export-container { #import-export-container {