mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Fix for FixedLayout.index returning incorrect values depending on position in spread. (#59)
This commit is contained in:
+2
-2
@@ -234,14 +234,14 @@ export class FixedLayout extends HTMLElement {
|
|||||||
else {
|
else {
|
||||||
if (last.center || last.left) newSpread().right = section
|
if (last.center || last.left) newSpread().right = section
|
||||||
else if (last.right || !i) last.left = section
|
else if (last.right || !i) last.left = section
|
||||||
else last .right = section
|
else last.right = section
|
||||||
}
|
}
|
||||||
return arr
|
return arr
|
||||||
}, [{}])
|
}, [{}])
|
||||||
}
|
}
|
||||||
get index() {
|
get index() {
|
||||||
const spread = this.#spreads[this.#index]
|
const spread = this.#spreads[this.#index]
|
||||||
const section = spread?.center ?? (this.side === 'left'
|
const section = spread?.center ?? (this.#side === 'left'
|
||||||
? spread.left ?? spread.right : spread.right ?? spread.left)
|
? spread.left ?? spread.right : spread.right ?? spread.left)
|
||||||
return this.book.sections.indexOf(section)
|
return this.book.sections.indexOf(section)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user