[NUI] Fix scroll item touch issue (#1864)
authorneostom432 <31119276+neostom432@users.noreply.github.com>
Tue, 28 Jul 2020 02:19:42 +0000 (11:19 +0900)
committerGitHub <noreply@github.com>
Tue, 28 Jul 2020 02:19:42 +0000 (11:19 +0900)
Previously when velocity is 0, ScrollAnimationFinished callback is not
working so touch interrupt view is not disappear.

Now, ScrollAnimation is started even if velocity is 0.

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

index 103f2ca..3d623b3 100755 (executable)
@@ -924,22 +924,30 @@ namespace Tizen.NUI.Components
 
                 float panVelocity = (ScrollingDirection == Direction.Horizontal) ? e.PanGesture.Velocity.X : e.PanGesture.Velocity.Y;
 
-                if(panVelocity != 0 || SnapToPage)
+                if (SnapToPage)
                 {
-                    if (SnapToPage)
+                    PageSnap(panVelocity);
+                }
+                else
+                {
+                    if(panVelocity == 0)
                     {
-                        PageSnap(panVelocity);
+                        float currentScrollPosition = (ScrollingDirection == Direction.Horizontal ? ContentContainer.CurrentPosition.X : ContentContainer.CurrentPosition.Y);
+                        scrollAnimation.DefaultAlphaFunction = new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear);
+                        scrollAnimation.Duration = 0;
+                        scrollAnimation.AnimateTo(ContentContainer, (ScrollingDirection == Direction.Horizontal) ? "PositionX" : "PositionY", currentScrollPosition);
+                        scrollAnimation.Play();
                     }
                     else
                     {
                         Decelerating(panVelocity, scrollAnimation);
                     }
-
-                    totalDisplacementForPan = 0;
-                    scrolling = true;
-                    readyToNotice = true;
-                    OnScrollAnimationStarted();
                 }
+
+                totalDisplacementForPan = 0;
+                scrolling = true;
+                readyToNotice = true;
+                OnScrollAnimationStarted();
             }
         }