mirror of
https://github.com/stashapp/stash.git
synced 2026-05-09 05:05:29 +02:00
Suppress tap navigation concurrent with swipe navigation
This commit is contained in:
parent
c8be7df4e0
commit
e2d5f09b70
2 changed files with 10 additions and 4 deletions
|
|
@ -144,16 +144,20 @@ const LightboxCarousel = forwardRef(function (
|
|||
event: React.PointerEvent,
|
||||
swipeDuration: number,
|
||||
cancelled: boolean
|
||||
) {
|
||||
): boolean {
|
||||
const cappedDuration = Math.max(50, Math.min(500, swipeDuration)) / 1000;
|
||||
const adjustedShift = carouselShift / (2 * cappedDuration);
|
||||
let changed = false;
|
||||
if (!cancelled && adjustedShift < -window.innerWidth / 2) {
|
||||
handleRight();
|
||||
changed = true;
|
||||
} else if (!cancelled && adjustedShift > window.innerWidth / 2) {
|
||||
handleLeft();
|
||||
changed = true;
|
||||
}
|
||||
setCarouselShift(0);
|
||||
overrideTransition(CLASSNAME_SWIPE);
|
||||
return changed;
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ interface IProps {
|
|||
ev: React.PointerEvent,
|
||||
swipeDuration: number,
|
||||
cancelled: boolean
|
||||
) => void;
|
||||
) => boolean;
|
||||
isVideo: boolean;
|
||||
}
|
||||
|
||||
|
|
@ -501,8 +501,10 @@ export const LightboxImage: React.FC<IProps> = ({
|
|||
}
|
||||
|
||||
if (ev.pointerType === "touch" && startPoint.current !== null) {
|
||||
// Swipe navigation
|
||||
releaseCarousel(ev, ev.timeStamp - startTime.current, false);
|
||||
// Swipe navigation, returns true if actually moved to another image.
|
||||
if (releaseCarousel(ev, ev.timeStamp - startTime.current, false)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
|
|
|
|||
Loading…
Reference in a new issue