From 2697d6843c9008b5e71f0f56733a1f56d00b3861 Mon Sep 17 00:00:00 2001 From: Petrificus-totalus <1966710331@qq.com> Date: Thu, 19 Oct 2023 10:46:00 +1100 Subject: [PATCH] fix issue#2511 --- src/ui/hotkeys.js | 10 ++++++++++ src/ui/interface.js | 6 ++++-- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/src/ui/hotkeys.js b/src/ui/hotkeys.js index a67d9f3f2..ddf276458 100644 --- a/src/ui/hotkeys.js +++ b/src/ui/hotkeys.js @@ -70,6 +70,11 @@ export class Hotkeys { this.ui.btnExit.triggerClick(); } } + pressTab(event) { + if (event.shiftKey) { + this.ui.$brandlogo.addClass('hide'); + } + } pressArrowUp() { this.ui.dashopen ? this.ui.gridSelectUp() : this.ui.game.grid.selectHexUp(); @@ -187,6 +192,11 @@ export function getHotKeys(hk) { hk.pressX(event); }, }, + Tab: { + onkeydown(event) { + hk.pressTab(event); + }, + }, ArrowUp: { onkeydown() { hk.pressArrowUp(); diff --git a/src/ui/interface.js b/src/ui/interface.js index e0f42da2c..492e7003f 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -395,7 +395,9 @@ export class UI { if (keydownAction !== undefined) { keydownAction.call(this, e); - e.preventDefault(); + if (!(e.code === 'Tab' && e.shiftKey)) { + e.preventDefault(); + } } }); @@ -1471,7 +1473,7 @@ export class UI { this.showRandomCreature(); } else if (!randomize) { this.showCreature('--', game.activeCreature.team, ''); - } else if (this.lastViewedCreature) { + } else if (this.lastViewedCreature) { this.showCreature(this.lastViewedCreature, game.activeCreature.team, ''); } else { this.showCreature(game.activeCreature.type, game.activeCreature.team, '');