Use keydown event to get actual modifiers

This commit is contained in:
Dmitry Lyzo
2024-09-14 01:44:52 +03:00
parent d20c617d30
commit 4c68f500d9
3 changed files with 14 additions and 14 deletions
+4 -4
View File
@@ -23,7 +23,7 @@ export class ComicsPlayer {
this.imageMap = new Map();
this.onDialogClosed = this.onDialogClosed.bind(this);
this.onWindowKeyUp = this.onWindowKeyUp.bind(this);
this.onWindowKeyDown = this.onWindowKeyDown.bind(this);
}
play(options) {
@@ -177,7 +177,7 @@ export class ComicsPlayer {
this.swiperInstance.update();
}
onWindowKeyUp(e) {
onWindowKeyDown(e) {
const key = keyboardnavigation.getKeyName(e);
if (key === 'Escape') {
this.stop();
@@ -196,7 +196,7 @@ export class ComicsPlayer {
bindEvents() {
this.bindMediaElementEvents();
document.addEventListener('keyup', this.onWindowKeyUp);
document.addEventListener('keydown', this.onWindowKeyDown);
}
unbindMediaElementEvents() {
@@ -211,7 +211,7 @@ export class ComicsPlayer {
unbindEvents() {
this.unbindMediaElementEvents();
document.removeEventListener('keyup', this.onWindowKeyUp);
document.removeEventListener('keydown', this.onWindowKeyDown);
}
createMediaElement() {