summaryrefslogtreecommitdiff
path: root/scripts/gui/table.js
diff options
context:
space:
mode:
authorKyle Gunger <kgunger12@gmail.com>2022-07-31 19:51:07 -0400
committerKyle Gunger <kgunger12@gmail.com>2022-07-31 19:51:07 -0400
commit5b4e72d70522eb61fd8cf2bbd619bb7ed4da2cfb (patch)
tree336fbb6bc81f78e6b469f97730ee39518feafb99 /scripts/gui/table.js
parentaecd8926c6c7bd7bcc0751e38b4459b57a87821c (diff)
Add table toggle
Diffstat (limited to 'scripts/gui/table.js')
-rw-r--r--scripts/gui/table.js13
1 files changed, 11 insertions, 2 deletions
diff --git a/scripts/gui/table.js b/scripts/gui/table.js
index 87120e3..f17abb1 100644
--- a/scripts/gui/table.js
+++ b/scripts/gui/table.js
@@ -23,7 +23,7 @@ class Table{
openTable ()
{
let state = this.root.getAttribute("state")
- if((state == "close" || state == "closed") && state != "") {
+ if(state == "close" || state == "closed") {
this.root.setAttribute("state", "closed");
setTimeout(this.root.setAttribute.bind(this.root), 50, "state", "open");
}
@@ -33,12 +33,21 @@ class Table{
closeTable ()
{
let state = this.root.getAttribute("state")
- if(state != "close" && state != "closed") {
+ if((state != "close" && state != "closed") && state != "") {
this.root.setAttribute("state", "");
setTimeout(this.root.setAttribute.bind(this.root), 50, "state", "close");
}
}
+ toggleTable ()
+ {
+ let state = this.root.getAttribute("state")
+ if(state == "close" || state == "closed")
+ this.openTable();
+ else if (state == "open")
+ this.closeTable()
+ }
+
// Handle a game closing (expectedly or unexpectedly)
handleClose ()
{