diff --git a/src/components/newPdfViewer.tsx b/src/components/newPdfViewer.tsx index 61895ba..3b21009 100644 --- a/src/components/newPdfViewer.tsx +++ b/src/components/newPdfViewer.tsx @@ -9,7 +9,7 @@ import { useZoom, ZoomPluginPackage, ZoomMode } from '@embedpdf/plugin- import { RenderLayer, RenderPluginPackage } from '@embedpdf/plugin-render/react'; import { ExportPluginPackage } from '@embedpdf/plugin-export/react'; -import { Download, ZoomIn, ZoomOut, Maximize2, Minimize2 } from "lucide-react"; +import { Download, ZoomIn, ZoomOut, Maximize2, Minimize2, Focus } from "lucide-react"; import { memo, useCallback, useEffect, useMemo, useRef, useState } from "react"; import { downloadFile } from "../lib/utils/download"; import { Button } from "./ui/button"; @@ -21,6 +21,8 @@ interface ControlProps { documentId: string; toggleFullscreen: () => void; isFullscreen: boolean; + toggleZenMode: () => void; + isZenMode: boolean; onDownload: () => Promise; forceMobile?: boolean; isMobile: boolean; @@ -57,8 +59,8 @@ function useBreakpoint() { return {isMobile: width !== null && width < 768, isSmall: width !== null && width < 640}; } -const Controls = memo(function Controls({documentId, toggleFullscreen, isFullscreen, onDownload, - forceMobile, isMobile, isSmall, viewerRef}: ControlProps) { +const Controls = memo(function Controls({documentId, toggleFullscreen, isFullscreen, toggleZenMode, + isZenMode, onDownload, forceMobile, isMobile, isSmall, viewerRef}: ControlProps) { const { provides: zoomProv, state: zoomState } = useZoom(documentId); const { provides: scrollProv, state: scrollState } = useScroll(documentId); @@ -79,6 +81,9 @@ const Controls = memo(function Controls({documentId, toggleFullscreen, isFullscr setTotalPages(0); }; }, [scrollCapability, documentId]); + // Zen mode isn't real browser fullscreen, but it hides everything around the + // paper the same way, so it gets the same "immersive" control layout. + const immersive = isFullscreen || isZenMode; useEffect(() => { if (!scrollProv) return; @@ -120,7 +125,7 @@ const pageChange = useCallback( } const pageInput = ( -
+
: } + +