Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.
fix: jumping to a page in the vertical doesn't count intermediary pages
Marc Seitzc062d893cf60
diff --git a/components/view/viewer/pages-vertical-viewer.tsx b/components/view/viewer/pages-vertical-viewer.tsxindex 56d73648..40e3f3db 100644--- a/components/view/viewer/pages-vertical-viewer.tsx+++ b/components/view/viewer/pages-vertical-viewer.tsx@@ -136,6 +136,9 @@ export default function PagesVerticalViewer({const visibilityRef = useRef<boolean>(true);const containerRef = useRef<HTMLDivElement>(null);const scrollActionRef = useRef<boolean>(false);+ const scrollEndTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(+ null,+ );const hasTrackedDownRef = useRef<boolean>(false);const hasTrackedUpRef = useRef<boolean>(false);const imageRefs = useRef<(HTMLImageElement | null)[]>([]);@@ -394,6 +397,8 @@ export default function PagesVerticalViewer({const container = containerRef.current;if (!container) return;+ if (scrollActionRef.current) return;+const containerRect = container.getBoundingClientRect();// Find which page is most visible in the viewport@@ -675,11 +680,23 @@ export default function PagesVerticalViewer({const container = containerRef.current;if (!container) return;- const handler = () => handleScrollRef.current();+ const handler = () => {+ handleScrollRef.current();++ if (scrollActionRef.current) {+ if (scrollEndTimeoutRef.current)+ clearTimeout(scrollEndTimeoutRef.current);+ scrollEndTimeoutRef.current = setTimeout(() => {+ scrollActionRef.current = false;+ }, 150);+ }+ };container.addEventListener("scroll", handler, { passive: true });return () => {container.removeEventListener("scroll", handler);+ if (scrollEndTimeoutRef.current)+ clearTimeout(scrollEndTimeoutRef.current);};}, []);