[NUI] Enable/Disable overshooting effect for ScrollableBase.
authorhuayong.xu <huayong.xu@samsung.com>
Thu, 5 Nov 2020 09:24:04 +0000 (17:24 +0800)
committerdongsug-song <35130733+dongsug-song@users.noreply.github.com>
Mon, 30 Nov 2020 06:36:08 +0000 (15:36 +0900)
A property EnableOverShootingEffect is added. default is false.
And shadow would be raised to top when effect appears.

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

index f652788..519e9a6 100755 (executable)
@@ -1020,8 +1020,17 @@ namespace Tizen.NUI.Components
             AnimateChildTo(ScrollDuration, destinationX);
         }
 
+        /// <summary>
+        /// Enable/Disable overshooting effect. default is disabled.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public bool EnableOverShootingEffect { get; set; } = false;
+
         private void AttachShadowView()
         {
+            if (!EnableOverShootingEffect)
+                return;
+
             if (ScrollingDirection != Direction.Vertical)
                 return;
 
@@ -1033,9 +1042,11 @@ namespace Tizen.NUI.Components
 
             verticalTopShadowView.Size = new Size(SizeWidth, 0.0f);
             verticalTopShadowView.Opacity = 1.0f;
+            verticalTopShadowView.RaiseToTop();
 
             verticalBottomShadowView.Size = new Size(SizeWidth, 0.0f);
             verticalBottomShadowView.Opacity = 1.0f;
+            verticalBottomShadowView.RaiseToTop();
 
             // at the beginning, height of vertical shadow is 0, so it is invisible.
             isVerticalShadowShown = false;
@@ -1043,6 +1054,9 @@ namespace Tizen.NUI.Components
 
         private void DragVerticalShadow(float displacement)
         {
+            if (!EnableOverShootingEffect)
+                return;
+
             if (ScrollingDirection != Direction.Vertical)
                 return;
 
@@ -1101,6 +1115,9 @@ namespace Tizen.NUI.Components
 
         private void PlayVerticalShadowAnimation()
         {
+            if (!EnableOverShootingEffect)
+                return;
+
             if (ScrollingDirection != Direction.Vertical)
                 return;