Skip to content

Commit 9b588b4

Browse files
committed
Ensure bounds correct before setting scrolling page.
1 parent f53da89 commit 9b588b4

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

Assets/Scripts/UI/ScrollPane.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -573,6 +573,8 @@ public int currentPageX
573573
if (!_pageMode)
574574
return;
575575

576+
_owner.EnsureBoundsCorrect();
577+
576578
if (_overlapSize.x > 0)
577579
this.SetPosX(value * _pageSize.x, false);
578580
}
@@ -585,6 +587,11 @@ public int currentPageX
585587
/// <param name="ani">是否使用缓动到达目标。</param>
586588
public void SetCurrentPageX(int value, bool ani)
587589
{
590+
if (!_pageMode)
591+
return;
592+
593+
_owner.EnsureBoundsCorrect();
594+
588595
if (_overlapSize.x > 0)
589596
this.SetPosX(value * _pageSize.x, ani);
590597
}
@@ -607,6 +614,11 @@ public int currentPageY
607614
}
608615
set
609616
{
617+
if (!_pageMode)
618+
return;
619+
620+
_owner.EnsureBoundsCorrect();
621+
610622
if (_overlapSize.y > 0)
611623
this.SetPosY(value * _pageSize.y, false);
612624
}
@@ -619,6 +631,11 @@ public int currentPageY
619631
/// <param name="ani">是否使用缓动到达目标。</param>
620632
public void SetCurrentPageY(int value, bool ani)
621633
{
634+
if (!_pageMode)
635+
return;
636+
637+
_owner.EnsureBoundsCorrect();
638+
622639
if (_overlapSize.y > 0)
623640
this.SetPosY(value * _pageSize.y, ani);
624641
}

0 commit comments

Comments
 (0)