summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2024-11-15 03:03:48 -0500
committerKyle Gunger <kgunger12@gmail.com>2024-11-15 03:03:48 -0500
commit266812564d7905212943f699cc439fcf21d85d26 (patch)
tree0947f9e2d6eee16ee26e54cd1e0806aadfb295ba
parentffae2dfebf7a79415a9fec63ecbfea45f53ad429 (diff)
Correct event handling for select button widget
-rw-r--r--index.html2
-rw-r--r--scripts/gui-common/widgets.js6
2 files changed, 6 insertions, 2 deletions
diff --git a/index.html b/index.html
index 52fb7ff..c075753 100644
--- a/index.html
+++ b/index.html
@@ -32,7 +32,7 @@
<a class="nav-el" href="?page=automation">Home Automation</a>
</nav>
- <content style="height:300vh; flex-direction: column; justify-content: space-evenly;">
+ <content>
</content>
<script src="scripts/gui-common/color.js"></script>
diff --git a/scripts/gui-common/widgets.js b/scripts/gui-common/widgets.js
index 78402c5..3d9d004 100644
--- a/scripts/gui-common/widgets.js
+++ b/scripts/gui-common/widgets.js
@@ -1108,13 +1108,17 @@ class WidgetSelectButton extends Widget
if(this.#selected.length > 0)
{
let swap = this.#selected.shift();
- this.#swgs[swap].set(-swap - 1);
+ this.#swgs[swap].removeEventListener("change", this.#binder);
+ this.#swgs[swap].set(-swap - 1);
+ this.#swgs[swap].addEventListener("change", this.#binder);
}
this.#selected.push(idx);
}
else
{
+ this.#swgs[idx].removeEventListener("change", this.#binder);
this.#swgs[idx].set(-idx - 1);
+ this.#swgs[idx].addEventListener("change", this.#binder);
}
if (!this.#removeLastOver && this.#selected.length >= this.#maxSelections)