From b5d0453004ddc9322528843e21c9255c1755bcc0 Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Sat, 14 Sep 2024 00:49:33 +0800 Subject: [PATCH] FXL: ignore `linear` & default to odd pages right This matches the behavior of other reading systems. See https://github.com/johnfactotum/foliate/issues/1318#issuecomment-2349375230 --- fixed-layout.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/fixed-layout.js b/fixed-layout.js index 2ebd9e9..c1ab86e 100644 --- a/fixed-layout.js +++ b/fixed-layout.js @@ -183,10 +183,9 @@ export class FixedLayout extends HTMLElement { if (rendition?.spread === 'none') this.#spreads = book.sections.map(section => ({ center: section })) - else this.#spreads = book.sections.reduce((arr, section) => { + else this.#spreads = book.sections.reduce((arr, section, i) => { const last = arr[arr.length - 1] - const { linear, pageSpread } = section - if (linear === 'no') return arr + const { pageSpread } = section const newSpread = () => { const spread = {} arr.push(spread) @@ -197,21 +196,21 @@ export class FixedLayout extends HTMLElement { spread.center = section } else if (pageSpread === 'left') { - const spread = last.center || last.left || ltr ? newSpread() : last + const spread = last.center || last.left || ltr && i ? newSpread() : last spread.left = section } else if (pageSpread === 'right') { - const spread = last.center || last.right || rtl ? newSpread() : last + const spread = last.center || last.right || rtl && i ? newSpread() : last spread.right = section } else if (ltr) { if (last.center || last.right) newSpread().left = section - else if (last.left) last.right = section + else if (last.left || !i) last.right = section else last.left = section } else { if (last.center || last.left) newSpread().right = section - else if (last.right) last.left = section + else if (last.right || !i) last.left = section else last .right = section } return arr