diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ca38c3f..ce1b82bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -34,6 +34,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - (**Reader**) Fix page shift when toggling the "offset double spreads" setting (currently: enable: shift to the right; disable: shift to the left – now: inverted) - (**Reader**) Fix "auto webtoon mode" detection for manga source languages other than english and the current selected language - (**Reader**) Fix the reader transition page previous chapter scanlator name showing the chapter name instead of the scanlator name +- (**Reader**) Fix opening the previous/next chapter in the continuous horizontal mode with inverted reading direction - (**Manga**) Fix dynamic manga page color theme not getting reset after leaving the manga page ## [20251230.01] (r2937) - 2025-12-30 diff --git a/src/features/reader/services/ReaderControls.ts b/src/features/reader/services/ReaderControls.ts index 8a1713ee..506642b1 100644 --- a/src/features/reader/services/ReaderControls.ts +++ b/src/features/reader/services/ReaderControls.ts @@ -19,7 +19,7 @@ import { getPageForMousePos, getProgressBarPositionInfo, } from '@/features/reader/overlay/progress-bar/ReaderProgressBar.utils.tsx'; -import { getCurrentTheme, getOptionForDirection } from '@/features/theme/services/ThemeCreator.ts'; +import { getOptionForDirection } from '@/features/theme/services/ThemeCreator.ts'; import { ReaderService } from '@/features/reader/services/ReaderService.ts'; import type { PageInViewportType, @@ -66,19 +66,11 @@ const getScrollDirectionInvert = ( ): 1 | -1 => { if (scrollDirection === ScrollDirection.X) { if (scrollOffset === ScrollOffset.BACKWARD) { - if (themeDirection === 'ltr') { - return -1; - } - - return 1; + return getOptionForDirection(-1, 1, themeDirection); } if (scrollOffset === ScrollOffset.FORWARD) { - if (themeDirection === 'ltr') { - return 1; - } - - return -1; + return getOptionForDirection(1, -1, themeDirection); } } @@ -106,19 +98,16 @@ export class ReaderControls { } const themeDirectionOfReadingDirection = READING_DIRECTION_TO_THEME_DIRECTION[readingDirection]; - const areReadingDirectionsEqual = getCurrentTheme().direction === themeDirectionOfReadingDirection; const isContinuousReadingModeActive = isContinuousReadingMode(readingMode); const isAtStartY = Math.abs(element.scrollTop) <= 1; const isAtEndY = Math.floor(element.scrollTop) === element.scrollHeight - element.clientHeight || Math.ceil(element.scrollTop) === element.scrollHeight - element.clientHeight; - const isAtStartX = Math.abs(element.scrollLeft) <= 1; + const isAtStartX = Math.floor(Math.abs(element.scrollLeft)) === 0; const isAtEndX = - element.scrollWidth - element.clientWidth - Math.floor(Math.abs(element.scrollLeft)) <= 1 || - element.scrollWidth - element.clientWidth - Math.ceil(Math.abs(element.scrollLeft)) <= 1; - const isAtStartXForDirection = areReadingDirectionsEqual ? isAtStartX : isAtEndX; - const isAtEndXForDirection = areReadingDirectionsEqual ? isAtEndX : isAtStartX; + Math.floor(Math.abs(element.scrollLeft)) === element.scrollWidth - element.clientWidth || + Math.ceil(Math.abs(element.scrollLeft)) === element.scrollWidth - element.clientWidth; const scrollAmount = scrollAmountPercentage / 100; const scrollDirection = getScrollDirectionInvert(direction, offset, themeDirectionOfReadingDirection); @@ -152,7 +141,7 @@ export class ReaderControls { switch (direction) { case ScrollDirection.X: - doScroll(isAtStartXForDirection, isAtEndXForDirection, { + doScroll(isAtStartX, isAtEndX, { left: getNewScrollPosition(element.scrollLeft, element.clientWidth), }); break;