home · contact · privacy
Hide map movement keys unavailable in current map geometry.
authorChristian Heller <c.heller@plomlompom.de>
Sun, 22 Nov 2020 03:23:16 +0000 (04:23 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Sun, 22 Nov 2020 03:23:16 +0000 (04:23 +0100)
rogue_chat_nocanvas_monochrome.html

index b1dd9929700724c57004413edc17bd5432476c08..4ea33d6b2b715b1c9f115dd0064bb5e4bb271bec 100644 (file)
@@ -549,13 +549,26 @@ let tui = {
     for (let key_selector of key_selectors) {
         this.keys[key_selector.id.slice(4)] = key_selector.value;
     }
-    this.movement_keys = {
-        [this.keys.square_move_up]: 'UP',
-        [this.keys.square_move_left]: 'LEFT',
-        [this.keys.square_move_down]: 'DOWN',
-        [this.keys.square_move_right]: 'RIGHT'
-    };
-    if (game.map_geometry == 'Hex') {
+    if (game.map_geometry == 'Square') {
+        this.movement_keys = {
+            [this.keys.square_move_up]: 'UP',
+            [this.keys.square_move_left]: 'LEFT',
+            [this.keys.square_move_down]: 'DOWN',
+            [this.keys.square_move_right]: 'RIGHT'
+        };
+        document.getElementById("move_upright").hidden = true;
+        document.getElementById("move_upleft").hidden = true;
+        document.getElementById("move_downright").hidden = true;
+        document.getElementById("move_downleft").hidden = true;
+        document.getElementById("move_up").hidden = false;
+        document.getElementById("move_down").hidden = false;
+    } else if (game.map_geometry == 'Hex') {
+        document.getElementById("move_upright").hidden = false;
+        document.getElementById("move_upleft").hidden = false;
+        document.getElementById("move_downright").hidden = false;
+        document.getElementById("move_downleft").hidden = false;
+        document.getElementById("move_up").hidden = true;
+        document.getElementById("move_down").hidden = true;
         this.movement_keys = {
             [this.keys.hex_move_upleft]: 'UPLEFT',
             [this.keys.hex_move_upright]: 'UPRIGHT',