From abcd87ed9a9c45033bbb36170a3fda524751f3e5 Mon Sep 17 00:00:00 2001 From: John Factotum <50942278+johnfactotum@users.noreply.github.com> Date: Sat, 27 May 2023 02:20:07 +0800 Subject: [PATCH] Fix RTL --- paginator.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/paginator.js b/paginator.js index 58f47c5..3b1a1c1 100644 --- a/paginator.js +++ b/paginator.js @@ -678,7 +678,7 @@ export class Paginator extends HTMLElement { } const offset = this.#getRectMapper()(rect).left + 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) { const element = this.#container @@ -742,7 +742,7 @@ export class Paginator extends HTMLElement { #getVisibleRange() { if (this.scrolled) return getVisibleRange(this.#view.document, this.start, this.end, this.#getRectMapper()) - const { size } = this + const size = this.#rtl ? -this.size : this.size return getVisibleRange(this.#view.document, this.start - size, this.end - size, this.#getRectMapper()) }