diff --git a/src/ui/hotkeys.js b/src/ui/hotkeys.js index a67d9f3f2..1ce6754de 100644 --- a/src/ui/hotkeys.js +++ b/src/ui/hotkeys.js @@ -70,6 +70,12 @@ export class Hotkeys { this.ui.btnExit.triggerClick(); } } + pressTab(event) { + console.log(event); + if (event.shiftKey) { + this.ui.$brandlogo.addClass('hide'); + } + } pressArrowUp() { this.ui.dashopen ? this.ui.gridSelectUp() : this.ui.game.grid.selectHexUp(); @@ -187,6 +193,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..d43cc0441 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, ''); @@ -2322,6 +2324,13 @@ export class UI { ui.game.grid.redoLastQuery(); }; + // Hide the project 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';