From f0e9f95bcf8cb3eb408f7b4e0aebbf585d851634 Mon Sep 17 00:00:00 2001 From: JoneLau <32630749+JoneLau@users.noreply.github.com> Date: Tue, 21 Apr 2020 19:12:34 +0800 Subject: [PATCH] fixed page position err when scrolling (#6591) --- cocos/ui/components/page-view-component.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/ui/components/page-view-component.ts b/cocos/ui/components/page-view-component.ts index 12dac327d4..e4a8c6b318 100644 --- a/cocos/ui/components/page-view-component.ts +++ b/cocos/ui/components/page-view-component.ts @@ -510,11 +510,11 @@ export class PageViewComponent extends ScrollViewComponent { * @param idx index of page. * @param timeInSecond scrolling time. */ - public scrollToPage(idx: number, timeInSecond = 0) { + public scrollToPage(idx: number, timeInSecond = 0.3) { if (idx < 0 || idx >= this._pages.length) { return; } - timeInSecond = timeInSecond !== undefined ? timeInSecond : 0.3; + this._curPageIdx = idx; this.scrollToOffset(this._moveOffsetValue(idx), timeInSecond, true); if (this.indicator) {