diff --git a/src/components/reader/BookReader.tsx b/src/components/reader/BookReader.tsx index 7ec0724..af45a5d 100644 --- a/src/components/reader/BookReader.tsx +++ b/src/components/reader/BookReader.tsx @@ -142,23 +142,11 @@ export function BookReader({ book, pages, onClose }: BookReaderProps) { // Effet pour gérer le fullscreen useEffect(() => { - const enterFullscreen = async () => { - try { - if (readerRef.current && !isFullscreen) { - await readerRef.current.requestFullscreen(); - setIsFullscreen(true); - } - } catch (error) { - console.error("Erreur lors du passage en plein écran:", error); - } - }; - const handleFullscreenChange = () => { setIsFullscreen(!!document.fullscreenElement); }; document.addEventListener("fullscreenchange", handleFullscreenChange); - enterFullscreen(); return () => { document.removeEventListener("fullscreenchange", handleFullscreenChange); diff --git a/src/components/reader/components/ControlButtons.tsx b/src/components/reader/components/ControlButtons.tsx index 513e976..d621d1f 100644 --- a/src/components/reader/components/ControlButtons.tsx +++ b/src/components/reader/components/ControlButtons.tsx @@ -25,10 +25,10 @@ export const ControlButtons = ({ }: ControlButtonsProps) => { return ( <> - {/* Bouton mode double page */} + {/* Boutons de contrôle */}
diff --git a/src/components/reader/hooks/usePageNavigation.ts b/src/components/reader/hooks/usePageNavigation.ts index b2e42cb..36dd602 100644 --- a/src/components/reader/hooks/usePageNavigation.ts +++ b/src/components/reader/hooks/usePageNavigation.ts @@ -20,6 +20,7 @@ export const usePageNavigation = ({ const [imageError, setImageError] = useState(false); const timeoutRef = useRef(null); const touchStartXRef = useRef(null); + const touchStartYRef = useRef(null); const currentPageRef = useRef(currentPage); useEffect(() => { @@ -94,16 +95,17 @@ export const usePageNavigation = ({ const handleTouchStart = useCallback((event: TouchEvent) => { touchStartXRef.current = event.touches[0].clientX; + touchStartYRef.current = event.touches[0].clientY; }, []); const handleTouchEnd = useCallback( (event: TouchEvent) => { - if (touchStartXRef.current === null) return; + if (touchStartXRef.current === null || touchStartYRef.current === null) return; const touchEndX = event.changedTouches[0].clientX; const touchEndY = event.changedTouches[0].clientY; const deltaX = touchEndX - touchStartXRef.current; - const deltaY = Math.abs(touchEndY - event.touches[0].clientY); + const deltaY = Math.abs(touchEndY - touchStartYRef.current); const minSwipeDistance = 50; if (deltaY > Math.abs(deltaX)) return; @@ -117,6 +119,7 @@ export const usePageNavigation = ({ } touchStartXRef.current = null; + touchStartYRef.current = null; }, [handlePreviousPage, handleNextPage] );