file-show: key 'a' to auto-play
Massimo Melina committed
Feb 3, 2024 at 18:49 UTC
fa17d7296acafffd9c1bb1bafdc2e9bdecbf3614
1 file changed
+7
-1
frontend/src/show.ts
+7
-1
@@ -49,6 +49,8 @@ export function fileShow(entry: DirEntry) {
49
return toggleShuffle()
50
if (key === 'r')
51
return toggleRepeat()
52
+ if (key === 'a')
53
+ return toggleAutoPlay()
54
if (key === ' ') {
55
const sel = state.selected
56
if (sel[cur.uri])
@@ -110,7 +112,7 @@ export function fileShow(entry: DirEntry) {
112
className: 'small',
113
label: t`Auto-play`,
114
toggled: autoPlaying,
113
- onClick: () => setAutoPlaying(x => !x),
115
+ onClick: toggleAutoPlay,
116
}),
117
autoPlaying && h(Btn, {
118
className: 'small',
@@ -218,6 +220,10 @@ export function fileShow(entry: DirEntry) {
220
setRepeat(x => !x)
221
}
222
223
+ function toggleAutoPlay() {
224
+ setAutoPlaying(x => !x)
225
+ }
226
+
227
function scrollY(dy: number) {
228
containerRef.current?.scrollBy(0, dy * .5 * containerRef.current?.clientHeight)
229
}