[NUI] Fix ScrollableBase when velocity is 0 (#1822)
authorneostom432 <31119276+neostom432@users.noreply.github.com>
Wed, 15 Jul 2020 04:11:59 +0000 (13:11 +0900)
committerGitHub <noreply@github.com>
Wed, 15 Jul 2020 04:11:59 +0000 (13:11 +0900)
When velocity is 0, fomular cannot be working.
Skip deceleration when velocity is 0.

src/Tizen.NUI.Components/Controls/ScrollableBase.cs

index 19e6d9d..103f2ca 100755 (executable)
@@ -922,19 +922,24 @@ namespace Tizen.NUI.Components
                     scrollAnimation.Finished += ScrollAnimationFinished;
                 }
 
-                if (SnapToPage)
-                {
-                    PageSnap((ScrollingDirection == Direction.Horizontal) ? e.PanGesture.Velocity.X : e.PanGesture.Velocity.Y);
-                }
-                else
+                float panVelocity = (ScrollingDirection == Direction.Horizontal) ? e.PanGesture.Velocity.X : e.PanGesture.Velocity.Y;
+
+                if(panVelocity != 0 || SnapToPage)
                 {
-                    Decelerating((ScrollingDirection == Direction.Horizontal) ? e.PanGesture.Velocity.X : e.PanGesture.Velocity.Y, scrollAnimation);
-                }
+                    if (SnapToPage)
+                    {
+                        PageSnap(panVelocity);
+                    }
+                    else
+                    {
+                        Decelerating(panVelocity, scrollAnimation);
+                    }
 
-                totalDisplacementForPan = 0;
-                scrolling = true;
-                readyToNotice = true;
-                OnScrollAnimationStarted();
+                    totalDisplacementForPan = 0;
+                    scrolling = true;
+                    readyToNotice = true;
+                    OnScrollAnimationStarted();
+                }
             }
         }