From bdc9cfa20f92bb41749790ac4943ab2a11e39d9a Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sun, 22 Nov 2020 04:23:16 +0100 Subject: [PATCH] Hide map movement keys unavailable in current map geometry. --- rogue_chat_nocanvas_monochrome.html | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/rogue_chat_nocanvas_monochrome.html b/rogue_chat_nocanvas_monochrome.html index b1dd992..4ea33d6 100644 --- a/rogue_chat_nocanvas_monochrome.html +++ b/rogue_chat_nocanvas_monochrome.html @@ -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', -- 2.30.2