Prevent lightbox transition until specific number of scroll events (#2544)

* Delay before nav to next image on scroll
* Add config for scroll attempts before transition
This commit is contained in:
WithoutPants
2022-05-06 12:22:26 +10:00
committed by GitHub
parent c1a096a1a6
commit 73ded0d97d
9 changed files with 90 additions and 23 deletions

View File

@@ -158,6 +158,11 @@ export const LightboxComponent: React.FC<IProps> = ({
const slideshowDelay =
savedDelay ?? configuredDelay ?? DEFAULT_SLIDESHOW_DELAY;
const scrollAttemptsBeforeChange = Math.max(
0,
config?.interface.imageLightbox.scrollAttemptsBeforeChange ?? 0
);
function setSlideshowDelay(v: number) {
setLightboxSettings({ slideshowDelay: v });
}
@@ -733,6 +738,8 @@ export const LightboxComponent: React.FC<IProps> = ({
onRight={handleRight}
alignBottom={movingLeft}
zoom={i === currentIndex ? zoom : 1}
current={i === currentIndex}
scrollAttemptsBeforeChange={scrollAttemptsBeforeChange}
setZoom={(v) => setZoom(v)}
resetPosition={resetPosition}
/>