mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
feat(web): improve slideshow quality of life (#18778)
* Add a new setting to toggle autoplay when showing the slideshow. * Fix an issue where the slideshow would restart automatically when navigating after it was paused. * Add a keyboard shortcut 's' to start the slideshow from the asset viewer. * Add a keyboard shortcut ' ' to toggle the slideshow play/paused. * Change the timeout for hiding the slideshow controls from 10 to 2.5 seconds. * Add English translation for the 'autoplay_slideshow' setting. Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
df927dd3ce
commit
d544053c67
7 changed files with 45 additions and 11 deletions
|
|
@ -28,7 +28,8 @@
|
|||
onSetToFullScreen = () => {},
|
||||
}: Props = $props();
|
||||
|
||||
const { restartProgress, stopProgress, slideshowDelay, showProgressBar, slideshowNavigation } = slideshowStore;
|
||||
const { restartProgress, stopProgress, slideshowDelay, showProgressBar, slideshowNavigation, slideshowAutoplay } =
|
||||
slideshowStore;
|
||||
|
||||
let progressBarStatus: ProgressBarStatus | undefined = $state();
|
||||
let progressBar = $state<ReturnType<typeof ProgressBar>>();
|
||||
|
|
@ -60,20 +61,20 @@
|
|||
showControls = false;
|
||||
setCursorStyle('none');
|
||||
}
|
||||
}, 10_000);
|
||||
}, 2500);
|
||||
};
|
||||
|
||||
onMount(() => {
|
||||
hideControlsAfterDelay();
|
||||
unsubscribeRestart = restartProgress.subscribe((value) => {
|
||||
if (value) {
|
||||
progressBar?.restart(value);
|
||||
progressBar?.restart();
|
||||
}
|
||||
});
|
||||
|
||||
unsubscribeStop = stopProgress.subscribe((value) => {
|
||||
if (value) {
|
||||
progressBar?.restart(false);
|
||||
progressBar?.restart();
|
||||
stopControlsHideTimer();
|
||||
}
|
||||
});
|
||||
|
|
@ -90,7 +91,7 @@
|
|||
});
|
||||
|
||||
const handleDone = async () => {
|
||||
await progressBar?.reset();
|
||||
await progressBar?.resetProgress();
|
||||
|
||||
if ($slideshowNavigation === SlideshowNavigation.AscendingOrder) {
|
||||
onPrevious();
|
||||
|
|
@ -113,6 +114,17 @@
|
|||
{ shortcut: { key: 'Escape' }, onShortcut: onClose },
|
||||
{ shortcut: { key: 'ArrowLeft' }, onShortcut: onPrevious },
|
||||
{ shortcut: { key: 'ArrowRight' }, onShortcut: onNext },
|
||||
{
|
||||
shortcut: { key: ' ' },
|
||||
onShortcut: () => {
|
||||
if (progressBarStatus === ProgressBarStatus.Paused) {
|
||||
progressBar?.play();
|
||||
} else {
|
||||
progressBar?.pause();
|
||||
}
|
||||
},
|
||||
preventDefault: true,
|
||||
},
|
||||
]}
|
||||
/>
|
||||
|
||||
|
|
@ -187,7 +199,7 @@
|
|||
{/if}
|
||||
|
||||
<ProgressBar
|
||||
autoplay
|
||||
autoplay={$slideshowAutoplay}
|
||||
hidden={!$showProgressBar}
|
||||
duration={$slideshowDelay}
|
||||
bind:this={progressBar}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue