1
Fork 0

Extend swipe functionality.

This commit is contained in:
PJ-Watson 2022-08-12 12:04:32 +01:00
parent 1a05b353e6
commit 6ca16fae77
1 changed files with 40 additions and 33 deletions

View File

@ -96,10 +96,17 @@ const PresentNavigationOverlay = ({
}, [])
const handlers = useSwipeable({
onSwipedDown: () => {
if (disableSaveCloseInHistory === true) {
dispatchMedia({ type: 'closePresentMode' })
} else {
closePresentModeAction({ dispatchMedia })
}
},
onSwipedLeft: () => dispatchMedia({ type: 'nextImage' }),
onSwipedRight: () => dispatchMedia({ type: 'previousImage' }),
preventScrollOnSwipe: false,
trackMouse: false,
trackMouse: true,
})
return (
@ -109,7 +116,7 @@ const PresentNavigationOverlay = ({
onMouseMove.current && onMouseMove.current()
}}
>
<div {...handlers}>
<div {...handlers} data-testid="swipe-component">
{children}
<NavigationButton
aria-label="Previous image"