Skip to content

fix: prevent mixed writing-mode views from coexisting in paginator#13

Merged
chrox merged 1 commit into
readest:mainfrom
loveheaven:fix/paginator-mixed-writing-mode
May 5, 2026
Merged

fix: prevent mixed writing-mode views from coexisting in paginator#13
chrox merged 1 commit into
readest:mainfrom
loveheaven:fix/paginator-mixed-writing-mode

Conversation

@loveheaven

Copy link
Copy Markdown

This prevents horizontal cover pages and vertical text chapters from sharing the same flex container, which corrupted scroll/page calculations.

  • Add #directionCache to track section writing-modes after first load
  • Add #isSameDirection() check used by all preload entry points
  • #loadAdjacentSection: destroy cross-direction views immediately after load
  • #preloadNext, #fillVisibleArea, scroll handlers: stop at direction boundaries
  • #goTo: when direction changes, destroy all views and do full #display rebuild
  • #display pre-load: skip cross-direction adjacent sections

- Add #directionCache to track section writing-modes after first load
- Add #isSameDirection() check used by all preload entry points
- #loadAdjacentSection: destroy cross-direction views immediately after load
- #preloadNext, #fillVisibleArea, scroll handlers: stop at direction boundaries
- #goTo: when direction changes, destroy all views and do full #display rebuild
- #display pre-load: skip cross-direction adjacent sections

This prevents horizontal cover pages and vertical text chapters from
sharing the same flex container, which corrupted scroll/page calculations.
@chrox

chrox commented Apr 26, 2026

Copy link
Copy Markdown
Collaborator

Please consider recreating the whole foliate-view and reopen the document if the writing-mode is changed which is currently the designed/implemented approach. This could avoid all kinds of cache / invalidation required in this PR. If there is any unexpected behavior, please open an issue in readest/readest or send a PR there.

@chrox chrox closed this Apr 26, 2026
@chrox chrox reopened this Apr 26, 2026
@chrox

chrox commented Apr 26, 2026

Copy link
Copy Markdown
Collaborator

Sorry I realized that their might be possibility that the same document might have mixed writing-mode. Could you share an EPUB file that has this problem so that I can reproduce this issue?

@loveheaven

Copy link
Copy Markdown
Author

Sorry I realized that their might be possibility that the same document might have mixed writing-mode. Could you share an EPUB file that has this problem so that I can reproduce this issue?

sure. please decompress this zip file and you will get the epub file. The covers in this epub file are horizontal while the text chapters are vertical.

Harry Potter_ シリーズ全7巻.epub.zip

@loveheaven

Copy link
Copy Markdown
Author

please review it. thanks!

@chrox

chrox commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Looks great. Thanks.

@chrox chrox merged commit befe16d into readest:main May 5, 2026
2 checks passed
@loveheaven loveheaven deleted the fix/paginator-mixed-writing-mode branch June 10, 2026 17:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants