fix: move hotkey initialization inside option check for better control

This commit is contained in:
Harvey Zack committed 2025-09-13 17:48:56 +08:00
1 parent e28be64026
commit 8041de8411
1 file changed
+3 -1
+3 -1
View File
@@ -5,7 +5,7 @@ export default class Hotkey {
this.art = art this.art = art
this.keys = {} this.keys = {}
if (art.option.hotkey && !isMobile) { if (!isMobile) {
this.init() this.init()
} }
} }
@@ -13,6 +13,7 @@ export default class Hotkey {
init() { init() {
const { constructor } = this.art const { constructor } = this.art
if (this.art.option.hotkey) {
this.add('Escape', () => { this.add('Escape', () => {
if (this.art.fullscreenWeb) { if (this.art.fullscreenWeb) {
this.art.fullscreenWeb = false this.art.fullscreenWeb = false
@@ -38,6 +39,7 @@ export default class Hotkey {
this.add('ArrowDown', () => { this.add('ArrowDown', () => {
this.art.volume -= constructor.VOLUME_STEP this.art.volume -= constructor.VOLUME_STEP
}) })
}
this.art.on('document:keydown', (event) => { this.art.on('document:keydown', (event) => {
if (this.art.isFocus) { if (this.art.isFocus) {