Add infinite scroll to reader

This commit is contained in:
schroda
2025-01-28 02:16:00 +01:00
parent 4789a74785
commit 4a9d2903b8
20 changed files with 1068 additions and 238 deletions

View File

@@ -169,7 +169,11 @@ export class ReaderControls {
}
}
static useOpenChapter(): (offset: 'previous' | 'next' | ChapterIdInfo['id'], doTransitionCheck?: boolean) => void {
static useOpenChapter(): (
offset: 'previous' | 'next' | ChapterIdInfo['id'],
doTransitionCheck?: boolean,
scrollIntoView?: boolean,
) => void {
const { t } = useTranslation();
const { readingMode, shouldInformAboutMissingChapter, shouldInformAboutScanlatorChange } =
ReaderService.useSettings();
@@ -179,7 +183,7 @@ export class ReaderControls {
const openChapter = ReaderService.useNavigateToChapter();
return useCallback(
(offset, doTransitionCheck = true) => {
(offset, doTransitionCheck = true, scrollIntoView = true) => {
if (!currentChapter) {
return;
}
@@ -227,7 +231,12 @@ export class ReaderControls {
}
setReaderStateChapters((prevState) =>
updateReaderStateVisibleChapters(isPreviousChapter, prevState, chapterToOpen.sourceOrder),
updateReaderStateVisibleChapters(
isPreviousChapter,
prevState,
chapterToOpen.sourceOrder,
scrollIntoView,
),
);
openChapter(