[NUI] : Add ScrollPosition in ScrollEventArgs for user convenience.
authorSangHyeon Jade Lee <sh10233.lee@samsung.com>
Tue, 16 Mar 2021 05:44:09 +0000 (14:44 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Wed, 17 Mar 2021 06:50:14 +0000 (15:50 +0900)
Current Position property in ScrollEventArgs is position of
ContentContainer which is negative.
user controls scrollableBase via ScrollTo and other API with
positive position of pan not ContentContainer so user must convert
current Position Property to use.

By this patch, we provide positive ScrollPosition which represent
position of scroll pan, so no need to convert value for using it.

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

index b238901..671f8e3 100755 (executable)
@@ -31,15 +31,17 @@ namespace Tizen.NUI.Components
     public class ScrollEventArgs : EventArgs
     {
         private Position position;
+        private Position scrollPosition;
 
         /// <summary>
         /// Default constructor.
         /// </summary>
-        /// <param name="position">Current scroll position</param>
+        /// <param name="position">Current contianer position</param>
         /// <since_tizen> 8 </since_tizen>
         public ScrollEventArgs(Position position)
         {
             this.position = position;
+            this.scrollPosition = new Position(-position);
         }
 
         /// <summary>
@@ -53,6 +55,18 @@ namespace Tizen.NUI.Components
                 return position;
             }
         }
+        /// <summary>
+        /// Current scroll position of scrollableBase pan.
+        /// This is the position in the opposite direction to the current position of ContentContainer.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Position ScrollPosition
+        {
+            get
+            {
+                return scrollPosition;
+            }
+        }
     }
 
     /// <summary>