This commit is contained in:
John Factotum
2023-05-27 02:20:07 +08:00
parent 90a1706e82
commit abcd87ed9a
+2 -2
View File
@@ -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())
} }