From 9927436ab88c3f5a453db402af19571cbc5e01b0 Mon Sep 17 00:00:00 2001 From: yindeqiang Date: Fri, 14 Jun 2024 10:57:52 +0800 Subject: [PATCH] fix: When the speed of moving the indicator is very slow, continuous calculation error accumulation will occur. --- packages/scroll-bar/src/indicator.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/scroll-bar/src/indicator.ts b/packages/scroll-bar/src/indicator.ts index e8995f31..060c2e14 100644 --- a/packages/scroll-bar/src/indicator.ts +++ b/packages/scroll-bar/src/indicator.ts @@ -326,7 +326,7 @@ export default class Indicator { updatePosition(point: TranslaterPoint) { const { pos, size } = this.caculatePosAndSize(point, this.scrollInfo) - this.refreshStyle(size, pos) + this.refreshStyle(size, Math.round(pos)) this.currentPos = pos } @@ -338,7 +338,7 @@ export default class Indicator { const { sizeRatio, baseSize, maxScrollPos, minScrollPos } = scrollInfo const minSize = this.options.minSize - let pos = Math.round(sizeRatio * point[posKey]) + let pos = sizeRatio * point[posKey] let size // when out of boundary, slow down size reduction if (pos < minScrollPos) {