mirror of
https://github.com/zhw2590582/ArtPlayer.git
synced 2026-10-26 00:31:20 -08:00
fix: move hotkey initialization inside option check for better control
This commit is contained in:
1 parent
e28be64026
commit
8041de8411
1 file changed
+23
-21
@@ -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,31 +13,33 @@ export default class Hotkey {
|
|||||||
init() {
|
init() {
|
||||||
const { constructor } = this.art
|
const { constructor } = this.art
|
||||||
|
|
||||||
this.add('Escape', () => {
|
if (this.art.option.hotkey) {
|
||||||
if (this.art.fullscreenWeb) {
|
this.add('Escape', () => {
|
||||||
this.art.fullscreenWeb = false
|
if (this.art.fullscreenWeb) {
|
||||||
}
|
this.art.fullscreenWeb = false
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
|
||||||
this.add('Space', () => {
|
this.add('Space', () => {
|
||||||
this.art.toggle()
|
this.art.toggle()
|
||||||
})
|
})
|
||||||
|
|
||||||
this.add('ArrowLeft', () => {
|
this.add('ArrowLeft', () => {
|
||||||
this.art.backward = constructor.SEEK_STEP
|
this.art.backward = constructor.SEEK_STEP
|
||||||
})
|
})
|
||||||
|
|
||||||
this.add('ArrowUp', () => {
|
this.add('ArrowUp', () => {
|
||||||
this.art.volume += constructor.VOLUME_STEP
|
this.art.volume += constructor.VOLUME_STEP
|
||||||
})
|
})
|
||||||
|
|
||||||
this.add('ArrowRight', () => {
|
this.add('ArrowRight', () => {
|
||||||
this.art.forward = constructor.SEEK_STEP
|
this.art.forward = constructor.SEEK_STEP
|
||||||
})
|
})
|
||||||
|
|
||||||
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) {
|
||||||
|
|||||||
Reference in new issue
Block a user