feat(reader): apply RTL reading direction for fixed-layout manga/comics

foliate's goLeft/goRight (and spread ordering) swap on book.dir ===
"rtl", but makeComicBook never sets dir, so manga/comic archives
always paged left-to-right even when the metadata says right-to-left.

For fixed-layout content, set this.book.dir = "rtl" from the
readingDirection metadata after the book opens. Reflowable EPUBs are
unaffected: they keep whatever direction foliate read from the OPF.

This is scoped to isFixedLayout (FXL EPUB, PDF, comics) so it cannot
reach the reflowable path.
This commit is contained in:
2026-06-07 00:03:54 -04:00
parent 423a1c0bf7
commit caaf27427e
+7
View File
@@ -449,6 +449,13 @@ document.addEventListener("alpine:init", () => {
this.book = this.view.book;
this.isFixedLayout = this.view.isFixedLayout;
if (this.isFixedLayout) {
// Manga/RTL comics: foliate's goLeft/goRight swap on book.dir === "rtl",
// but makeComicBook never sets dir. Apply it from metadata so RTL page
// turns (and spread ordering) read right-to-left. Reflowable EPUBs keep
// whatever direction foliate read from the OPF.
if (config.readingDirection === "rtl" && this.book.dir !== "rtl") {
this.book.dir = "rtl";
}
this.isPDF = (this.renderer as any).isPDF;
this.renderer.addEventListener("zoom", () => {
this.zoomPercent = this.renderer.zoomPercent;