Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix issue#2511 #2514

Merged
merged 3 commits into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/ui/hotkeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -187,6 +193,11 @@ export function getHotKeys(hk) {
hk.pressX(event);
},
},
Tab: {
onkeydown(event) {
hk.pressTab(event);
},
},
ArrowUp: {
onkeydown() {
hk.pressArrowUp();
Expand Down
13 changes: 11 additions & 2 deletions src/ui/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,9 @@ export class UI {
if (keydownAction !== undefined) {
keydownAction.call(this, e);

e.preventDefault();
if (!(e.code === 'Tab' && e.shiftKey)) {
e.preventDefault();
}
}
});

Expand Down Expand Up @@ -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, '');
Expand Down Expand Up @@ -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';
Expand Down
Loading