[NUI] Fix ScrollableBase maxScrollDistance issue (#2051)
authorhuiyueun <35286162+huiyueun@users.noreply.github.com>
Thu, 24 Sep 2020 06:19:14 +0000 (15:19 +0900)
committerGitHub <noreply@github.com>
Thu, 24 Sep 2020 06:19:14 +0000 (15:19 +0900)
[TDAF-1221] issue

1. If the size of ScrollableBase is changed, maxScrollDistance update is required.
  maxScrollDistance: Maximum range that ScrollableBase can scroll
2. Change maxScrollDistance by calling OnSCrollingChildRelayout at OnMeasure when size changes.
3. Currently, maxScrollDistance is updated based on ContentContainer size only.
  Change this to be modified even if the ScrollableBase size is changed

Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
src/Tizen.NUI.Components/Controls/ScrollableBase.cs

index e9fbe35..3e2632c 100755 (executable)
@@ -148,6 +148,7 @@ namespace Tizen.NUI.Components
 
                 // Size of ScrollableBase is changed. Change Page width too.
                 scrollableBase.mPageWidth = (int)MeasuredWidth.Size.AsRoundedValue();
+                scrollableBase.OnScrollingChildRelayout(null , null);
             }
 
             protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
@@ -498,6 +499,7 @@ namespace Tizen.NUI.Components
         private float ratioOfScreenWidthToCompleteScroll = 0.5f;
         private float totalDisplacementForPan = 0.0f;
         private Size previousContainerSize = new Size();
+        private Size previousSize = new Size();
         private PropertyNotification propertyNotification;
         private float noticeAnimationEndBeforePosition = 0.0f;
         private bool readyToNotice = false;
@@ -611,7 +613,8 @@ namespace Tizen.NUI.Components
         private void OnScrollingChildRelayout(object source, EventArgs args)
         {
             // Size is changed. Calculate maxScrollDistance.
-            bool isSizeChanged = previousContainerSize.Width != ContentContainer.Size.Width || previousContainerSize.Height != ContentContainer.Size.Height;
+            bool isSizeChanged = previousContainerSize.Width != ContentContainer.Size.Width || previousContainerSize.Height != ContentContainer.Size.Height
+                || previousSize.Width != Size.Width || previousSize.Height != Size.Height;
 
             if (isSizeChanged)
             {
@@ -620,6 +623,7 @@ namespace Tizen.NUI.Components
             }
 
             previousContainerSize = ContentContainer.Size;
+            previousSize = Size;
         }
 
         /// <summary>