Skip to content

Commit

Permalink
fix: confused player shortcuts with ctrlKey and altKey
Browse files Browse the repository at this point in the history
  • Loading branch information
tachibana-shin committed Mar 8, 2024
1 parent 16392b3 commit c17874b
Showing 1 changed file with 22 additions and 4 deletions.
26 changes: 22 additions & 4 deletions src/components/BrtPlayer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -227,10 +227,10 @@
artCurrentTimeHoving <= intro.end
? '\n ' + $t('mo-dau')
: outro &&
artCurrentTimeHoving >= outro.start &&
artCurrentTimeHoving <= outro.end
? '\n ' + $t('ket-thuc')
: '')
artCurrentTimeHoving >= outro.start &&
artCurrentTimeHoving <= outro.end
? '\n ' + $t('ket-thuc')
: '')
"
:style="{
width: `${(artCurrentTimeHoving / artDuration) * 100}%`
Expand Down Expand Up @@ -2535,9 +2535,16 @@ function skipOpening() {
)
}
useEventListener(window, "keydown", (event: KeyboardEvent) => {
if (
document.activeElement?.tagName === "INPUT" ||
document.activeElement?.tagName === "TEXTAREA"
)
return
switch (event.code) {
case "Space":
case "KeyK": {
if (event.ctrlKey || event.shiftKey) break
if (!checkContentEditable(event.target as Element | null))
event.preventDefault()
const playing = artPlaying.value
Expand All @@ -2547,39 +2554,50 @@ useEventListener(window, "keydown", (event: KeyboardEvent) => {
break
}
case "KeyF":
if (event.ctrlKey || event.shiftKey) break
void toggleArtFullscreen()
break
case "ArrowLeft":
if (event.ctrlKey || event.shiftKey) break
skipBack()
break
case "ArrowRight":
if (event.ctrlKey || event.shiftKey) break
skipForward()
break
case "ArrowUp":
if (event.ctrlKey || event.shiftKey) break
if (artFullscreen.value) upVolume()
break
case "ArrowDown":
if (event.ctrlKey || event.shiftKey) break
if (artFullscreen.value) downVolume()
break
case "KeyM":
if (event.ctrlKey || event.shiftKey) break
toggleMuted()
break
case "KeyN":
if (event.ctrlKey) break
if (event.shiftKey) emitNextChap(true)
break
case "KeyP":
if (event.ctrlKey) break
if (event.shiftKey) emitPrevChap(true)
break
case "KeyJ":
if (event.ctrlKey || event.shiftKey) break
skipOpening()
break
case "KeyT":
if (event.ctrlKey || event.shiftKey) break
settingsStore.ui.modeMovie = !settingsStore.ui.modeMovie
break
case "Enter":
if (event.ctrlKey || event.shiftKey) break
if (skiping.value) skipOpEnd()
break
Expand Down

0 comments on commit c17874b

Please sign in to comment.