[NUI] Fix picker, scroller animation gives abnormal position value
authorWoochanLee <wc0917.lee@samsung.com>
Wed, 12 Oct 2022 08:46:02 +0000 (17:46 +0900)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Wed, 12 Oct 2022 09:45:12 +0000 (18:45 +0900)
src/Tizen.NUI.Components/Controls/Picker.cs
src/Tizen.NUI.Components/Controls/ScrollableBase.cs

index e119bae..e4d8517 100755 (executable)
@@ -541,7 +541,7 @@ namespace Tizen.NUI.Components
         private void OnScrollAnimationEnded(object sender, ScrollEventArgs e)
         {
             //Ignore if the scroll position was not changed. (called it from this function)
-            if (lastScrollPosion == (int)e.Position.Y) return;
+            if (lastScrollPosion == (int)e.Position.Y && !onAlignAnimation) return;
 
             //Calc offset from closest item.
             int offset = (int)(e.Position.Y + startScrollOffset) % itemHeight;
@@ -876,6 +876,9 @@ namespace Tizen.NUI.Components
                     float realDistance = velocityOfLastPan * ((float)Math.Pow(decelerationRate, realDuration) - 1) / logValueOfDeceleration;
                     float result = Math.Min(realDistance / Math.Abs(panAnimationDelta), 1.0f);
 
+                    // This is hot-fix for if the velocity has very small value, result is not updated even progress done.
+                    if (progress > 0.99) result = 1.0f;
+
                     return result;
                 }
             }
index ad2cdbf..231880d 100755 (executable)
@@ -1781,6 +1781,10 @@ namespace Tizen.NUI.Components
                 float realDuration = progress * panAnimationDuration;
                 float realDistance = velocityOfLastPan * ((float)Math.Pow(decelerationRate, realDuration) - 1) / logValueOfDeceleration;
                 float result = Math.Min(realDistance / Math.Abs(panAnimationDelta), 1.0f);
+
+                // This is hot-fix for if the velocity has very small value, result is not updated even progress done.
+                if (progress > 0.99) result = 1.0f;
+
                 return result;
             }
         }