mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Re-render single pages when paginating fixed layout (#61)
This commit is contained in:
+6
-8
@@ -179,18 +179,18 @@ export class FixedLayout extends HTMLElement {
|
|||||||
#goLeft() {
|
#goLeft() {
|
||||||
if (this.#center || this.#left?.blank) return
|
if (this.#center || this.#left?.blank) return
|
||||||
if (this.#portrait && this.#left?.element?.style?.display === 'none') {
|
if (this.#portrait && this.#left?.element?.style?.display === 'none') {
|
||||||
this.#right.element.style.display = 'none'
|
|
||||||
this.#left.element.style.display = 'block'
|
|
||||||
this.#side = 'left'
|
this.#side = 'left'
|
||||||
|
this.#render()
|
||||||
|
this.#reportLocation('page')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#goRight() {
|
#goRight() {
|
||||||
if (this.#center || this.#right?.blank) return
|
if (this.#center || this.#right?.blank) return
|
||||||
if (this.#portrait && this.#right?.element?.style?.display === 'none') {
|
if (this.#portrait && this.#right?.element?.style?.display === 'none') {
|
||||||
this.#left.element.style.display = 'none'
|
|
||||||
this.#right.element.style.display = 'block'
|
|
||||||
this.#side = 'right'
|
this.#side = 'right'
|
||||||
|
this.#render()
|
||||||
|
this.#reportLocation('page')
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -295,13 +295,11 @@ export class FixedLayout extends HTMLElement {
|
|||||||
}
|
}
|
||||||
async next() {
|
async next() {
|
||||||
const s = this.rtl ? this.#goLeft() : this.#goRight()
|
const s = this.rtl ? this.#goLeft() : this.#goRight()
|
||||||
if (s) this.#reportLocation('page')
|
if (!s) return this.goToSpread(this.#index + 1, this.rtl ? 'right' : 'left', 'page')
|
||||||
else return this.goToSpread(this.#index + 1, this.rtl ? 'right' : 'left', 'page')
|
|
||||||
}
|
}
|
||||||
async prev() {
|
async prev() {
|
||||||
const s = this.rtl ? this.#goRight() : this.#goLeft()
|
const s = this.rtl ? this.#goRight() : this.#goLeft()
|
||||||
if (s) this.#reportLocation('page')
|
if (!s) return this.goToSpread(this.#index - 1, this.rtl ? 'left' : 'right', 'page')
|
||||||
else return this.goToSpread(this.#index - 1, this.rtl ? 'left' : 'right', 'page')
|
|
||||||
}
|
}
|
||||||
getContents() {
|
getContents() {
|
||||||
return Array.from(this.#root.querySelectorAll('iframe'), frame => ({
|
return Array.from(this.#root.querySelectorAll('iframe'), frame => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user