mirror of
https://github.com/john-okeefe/foliate-js.git
synced 2026-09-09 11:29:14 -04:00
Fix RTL
This commit is contained in:
+2
-2
@@ -678,7 +678,7 @@ export class Paginator extends HTMLElement {
|
|||||||
}
|
}
|
||||||
const offset = this.#getRectMapper()(rect).left
|
const offset = this.#getRectMapper()(rect).left
|
||||||
+ this.layout.margin / 2
|
+ this.layout.margin / 2
|
||||||
return this.#scrollToPage(Math.floor(offset / this.size) + 1, reason)
|
return this.#scrollToPage(Math.floor(offset / this.size) + (this.#rtl ? -1 : 1), reason)
|
||||||
}
|
}
|
||||||
async #scrollTo(offset, reason, smooth) {
|
async #scrollTo(offset, reason, smooth) {
|
||||||
const element = this.#container
|
const element = this.#container
|
||||||
@@ -742,7 +742,7 @@ export class Paginator extends HTMLElement {
|
|||||||
#getVisibleRange() {
|
#getVisibleRange() {
|
||||||
if (this.scrolled) return getVisibleRange(this.#view.document,
|
if (this.scrolled) return getVisibleRange(this.#view.document,
|
||||||
this.start, this.end, this.#getRectMapper())
|
this.start, this.end, this.#getRectMapper())
|
||||||
const { size } = this
|
const size = this.#rtl ? -this.size : this.size
|
||||||
return getVisibleRange(this.#view.document,
|
return getVisibleRange(this.#view.document,
|
||||||
this.start - size, this.end - size, this.#getRectMapper())
|
this.start - size, this.end - size, this.#getRectMapper())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user