Fix infinite scroll intersection info calculation

Scrollbars need to be considered since they decrease the available viewport size in which the element can be visible
This commit is contained in:
schroda
2025-02-10 22:27:28 +01:00
parent eb7397e639
commit a45338647e
3 changed files with 24 additions and 5 deletions

View File

@@ -416,6 +416,8 @@ const BaseReaderChapterViewer = ({
isPreviousChapterVisible={isPreviousChapterVisible}
isNextChapterVisible={isNextChapterVisible}
imageWrapper={pagerRef.current}
scrollbarXSize={scrollbarXSize}
scrollbarYSize={scrollbarYSize}
/>
)}
{showPreviousTransitionPage && (

View File

@@ -9,7 +9,7 @@
import { memo } from 'react';
import { withPropsFrom } from '@/modules/core/hoc/withPropsFrom.tsx';
import { useReaderInfiniteScrollUpdateChapter } from '@/modules/reader/hooks/useReaderInfiniteScrollUpdateChapter.ts';
import { ReadingDirection, ReadingMode } from '@/modules/reader/types/Reader.types.ts';
import { ReadingDirection, ReadingMode, TReaderScrollbarContext } from '@/modules/reader/types/Reader.types.ts';
import { ReaderControls } from '@/modules/reader/services/ReaderControls.ts';
import { ChapterIdInfo } from '@/modules/chapter/services/Chapters.ts';
@@ -24,7 +24,9 @@ const BaseReaderInfiniteScrollUpdateChapter = ({
isNextChapterVisible,
imageWrapper,
openChapter,
}: {
scrollbarXSize,
scrollbarYSize,
}: Pick<TReaderScrollbarContext, 'scrollbarXSize' | 'scrollbarYSize'> & {
readingMode: ReadingMode;
readingDirection: ReadingDirection;
chapterId: ChapterIdInfo['id'];
@@ -46,6 +48,8 @@ const BaseReaderInfiniteScrollUpdateChapter = ({
readingDirection,
openChapter,
imageWrapper,
scrollbarXSize,
scrollbarYSize,
);
useReaderInfiniteScrollUpdateChapter(
'last',
@@ -57,6 +61,8 @@ const BaseReaderInfiniteScrollUpdateChapter = ({
readingDirection,
openChapter,
imageWrapper,
scrollbarXSize,
scrollbarYSize,
);
return null;