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 1/3] 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, ''); From 7ff6f2dcc8427b1998075eaf6f699720ff2f40cc Mon Sep 17 00:00:00 2001 From: Petrificus-totalus <1966710331@qq.com> Date: Sat, 21 Oct 2023 11:03:54 +1100 Subject: [PATCH 2/3] fix#2511 hideLogo --- src/ui/hotkeys.js | 1 + src/ui/interface.js | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/src/ui/hotkeys.js b/src/ui/hotkeys.js index ddf276458..1ce6754de 100644 --- a/src/ui/hotkeys.js +++ b/src/ui/hotkeys.js @@ -71,6 +71,7 @@ export class Hotkeys { } } pressTab(event) { + console.log(event); if (event.shiftKey) { this.ui.$brandlogo.addClass('hide'); } diff --git a/src/ui/interface.js b/src/ui/interface.js index 492e7003f..908fdfc8d 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -2324,6 +2324,13 @@ export class UI { ui.game.grid.redoLastQuery(); }; + // hide the brand logo when navigating away using a hotkey + document.addEventListener('visibilitychange', function () { + if (document.hidden) { + ui.$brandlogo.addClass('hide'); + } + }); + const SIGNAL_CREATURE_CLICK = 'vignettecreatureclick'; const SIGNAL_CREATURE_MOUSE_ENTER = 'vignettecreaturemouseenter'; const SIGNAL_CREATURE_MOUSE_LEAVE = 'vignettecreaturemouseleave'; From 6c9276c92ad54715f26de19b4f34eebd1faeb209 Mon Sep 17 00:00:00 2001 From: Dread Knight Date: Sat, 21 Oct 2023 15:18:27 +0300 Subject: [PATCH 3/3] tweaked comment --- src/ui/interface.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/interface.js b/src/ui/interface.js index 908fdfc8d..d43cc0441 100644 --- a/src/ui/interface.js +++ b/src/ui/interface.js @@ -2324,7 +2324,7 @@ export class UI { ui.game.grid.redoLastQuery(); }; - // hide the brand logo when navigating away using a hotkey + // Hide the project logo when navigating away using a hotkey document.addEventListener('visibilitychange', function () { if (document.hidden) { ui.$brandlogo.addClass('hide');