From 0945d40ab8aa0ba86b34a5841c90f1f6e2251a4f Mon Sep 17 00:00:00 2001 From: jaehyun0cho Date: Thu, 4 Jun 2020 13:43:37 +0900 Subject: [PATCH] [NUI] Fix ScrollTo to move pan position to the argument position (#1652) Previously, ScrollTo moved pan position including the ScrollableBase's current position. e.g. ScrollTo(360, true); //moves by 360 ScrollTo(0, true); //moves by 360 again based on current position The argument position is the new pan position. So the new position of ScrollableBase becomes (-position). To move ScrollableBase's position to (-position), it moves by (-position - currentPosition). Co-authored-by: Jaehyun Cho --- src/Tizen.NUI.Components/Controls/ScrollableBase.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs index 54dcbfd..952f032 100755 --- a/src/Tizen.NUI.Components/Controls/ScrollableBase.cs +++ b/src/Tizen.NUI.Components/Controls/ScrollableBase.cs @@ -591,7 +591,9 @@ namespace Tizen.NUI.Components float currentPositionX = mScrollingChild.CurrentPosition.X != 0 ? mScrollingChild.CurrentPosition.X : mScrollingChild.Position.X; float currentPositionY = mScrollingChild.CurrentPosition.Y != 0 ? mScrollingChild.CurrentPosition.Y : mScrollingChild.Position.Y; float delta = ScrollingDirection == Direction.Horizontal ? currentPositionX : currentPositionY; - delta -= position; + // The argument position is the new pan position. So the new position of ScrollableBase becomes (-position). + // To move ScrollableBase's position to (-position), it moves by (-position - currentPosition). + delta = -position - delta; ScrollBy(delta, animate); } -- 2.7.4