feat(webreader): add fullscreen keyboard shortcut

This commit is contained in:
Gauthier Roebroeck 2021-12-23 15:36:57 +08:00
parent 3fb24cba26
commit a72a3bab62
3 changed files with 7 additions and 0 deletions

View File

@ -17,6 +17,9 @@ export const shortcutsSettings = [
new Shortcut('bookreader.shortcuts.cycle_scale',
(ctx: any) => ctx.cycleScale()
, 'c'),
new Shortcut('bookreader.shortcuts.fullscreen',
(ctx: any) => ctx.switchFullscreen()
, 'f'),
]
export const shortcutsMenus = [

View File

@ -128,6 +128,7 @@
"cycle_scale": "Cycle scale",
"cycle_side_padding": "Cycle side padding",
"first_page": "First page",
"fullscreen": "Enter/exit full screen",
"last_page": "Last page",
"left_to_right": "Left to Right",
"menus": "Menus",

View File

@ -626,6 +626,9 @@ export default Vue.extend({
enterFullscreen() {
if (screenfull.isEnabled) screenfull.request(document.documentElement, {navigationUI: 'hide'})
},
switchFullscreen() {
if (screenfull.isEnabled) screenfull.isFullscreen ? screenfull.exit() : this.enterFullscreen()
},
fullscreenChanged() {
if (screenfull.isEnabled && screenfull.isFullscreen) this.fullscreenIcon = 'mdi-fullscreen-exit'
else this.fullscreenIcon = 'mdi-fullscreen'