feat: no vertical swipe on reader

This commit is contained in:
Julien Froidefond
2025-02-16 22:47:52 +01:00
parent 4761b47198
commit a4b52a1ee8
2 changed files with 5 additions and 1 deletions

View File

@@ -150,7 +150,7 @@ export function BookReader({ book, pages, onClose }: BookReaderProps) {
); );
return ( return (
<div className="fixed inset-0 bg-background/95 backdrop-blur-sm z-50"> <div className="fixed inset-0 bg-background/95 backdrop-blur-sm z-50 overflow-hidden touch-none">
<div <div
className="relative h-full flex flex-col items-center justify-center" className="relative h-full flex flex-col items-center justify-center"
onClick={() => setShowControls(!showControls)} onClick={() => setShowControls(!showControls)}

View File

@@ -101,9 +101,13 @@ export const usePageNavigation = ({
if (touchStartXRef.current === null) return; if (touchStartXRef.current === null) return;
const touchEndX = event.changedTouches[0].clientX; const touchEndX = event.changedTouches[0].clientX;
const touchEndY = event.changedTouches[0].clientY;
const deltaX = touchEndX - touchStartXRef.current; const deltaX = touchEndX - touchStartXRef.current;
const deltaY = Math.abs(touchEndY - event.touches[0].clientY);
const minSwipeDistance = 50; const minSwipeDistance = 50;
if (deltaY > Math.abs(deltaX)) return;
if (Math.abs(deltaX) > minSwipeDistance) { if (Math.abs(deltaX) > minSwipeDistance) {
if (deltaX > 0) { if (deltaX > 0) {
handlePreviousPage(); handlePreviousPage();