Skip to content

Commit

Permalink
Fix updating current page on scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
allanlasser committed Dec 2, 2024
1 parent 1f2bf49 commit d392984
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/lib/components/viewer/Page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,6 @@ Assumes it's a child of a ViewerContext
query: getQuery($page.url, "q"),
});
function isDOMRectReadOnly(
rect: null | undefined | DOMRect | DOMRectReadOnly,
): rect is DOMRectReadOnly {
return Boolean(rect && "readonly" in rect);
}
function watch(el: HTMLElement, once = false): IntersectionObserver {
const io = new IntersectionObserver(
(entries, observer) => {
Expand All @@ -73,10 +67,8 @@ Assumes it's a child of a ViewerContext
}
const { boundingClientRect, rootBounds } = entry;
if (
isDOMRectReadOnly(boundingClientRect) &&
isDOMRectReadOnly(rootBounds) &&
rootBounds &&
boundingClientRect.top > rootBounds.top &&
boundingClientRect.top < rootBounds.height / 2 &&
currentPage // in case context is missing
Expand Down

0 comments on commit d392984

Please sign in to comment.