[NUI] Add SetPanGestureMinimumTouchesRequired and SetPanGestureMaximumTouchesRequired...
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 7 Apr 2025 07:15:24 +0000 (16:15 +0900)
committerJaehyun Cho <jaehyun0cho@gmail.com>
Wed, 9 Apr 2025 02:09:46 +0000 (11:09 +0900)
This sets MinimumTouchesRequired and MaximumTouchesRequired when creating a PanGesture.

src/Tizen.NUI/src/public/Events/GestureOptions.cs
src/Tizen.NUI/src/public/Events/PanGestureDetector.cs

index 41158af9d8982d248d7860923f3a511bf72c7788..05c0d0d8d3bfabacebb4906a0a7d7ddbaf0e9f51 100644 (file)
@@ -26,6 +26,8 @@ namespace Tizen.NUI
     public sealed class GestureOptions
     {
         private static readonly GestureOptions instance = new GestureOptions();
+        private static uint panGestureMinimumTouchesRequired;
+        private static uint panGestureMaximumTouchesRequired;
 
         /// <summary>
         /// Constructor.
@@ -255,6 +257,44 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
+        /// <summary>
+        /// Sets the minimum number of touches required for the pan gesture to be detected.
+        /// </summary>
+        /// <param name="minimum"></param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetPanGestureMinimumTouchesRequired(uint minimum)
+        {
+            panGestureMinimumTouchesRequired = minimum;
+        }
+
+        /// <summary>
+        /// Gets the minimum number of touches required for the pan gesture to be detected.
+        /// </summary>
+        /// <returns>The minimum number of touches required</returns>
+        internal uint GetPanGestureMinimumTouchesRequired()
+        {
+            return panGestureMinimumTouchesRequired;
+        }
+
+        /// <summary>
+        /// Sets the maximum number of touches required for the pan gesture to be detected.
+        /// </summary>
+        /// <param name="minimum"></param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetPanGestureMaximumTouchesRequired(uint maximum)
+        {
+            panGestureMaximumTouchesRequired = maximum;
+        }
+
+        /// <summary>
+        /// Gets the maximum number of touches required for the pan gesture to be detected.
+        /// </summary>
+        /// <returns>The maximum number of touches required</returns>
+        internal uint GetPanGestureMaximumTouchesRequired()
+        {
+            return panGestureMaximumTouchesRequired;
+        }
+
         /// <summary>
         /// Sets the minimum distance required to start a pinch event
         /// </summary>
index 2cd0aac1078fc6c65f92c37a6a8beae1cd133e88..baf3fd98b22ab157fb6ed05c7f52eb3d6fa26920 100755 (executable)
@@ -36,7 +36,6 @@ namespace Tizen.NUI
         public PanGestureDetector() : this(Interop.PanGestureDetector.New(), true)
         {
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
-
         }
 
         /// <summary>
@@ -52,10 +51,28 @@ namespace Tizen.NUI
 
         internal PanGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn) : this(cPtr, cMemoryOwn, cMemoryOwn)
         {
+            Initialized();
         }
 
         internal PanGestureDetector(global::System.IntPtr cPtr, bool cMemoryOwn, bool cRegister) : base(cPtr, cMemoryOwn, cRegister)
         {
+            Initialized();
+        }
+
+        private void Initialized()
+        {
+            if (HasBody())
+            {
+                if (GestureOptions.Instance.GetPanGestureMinimumTouchesRequired() > 0)
+                {
+                    SetMinimumTouchesRequired(GestureOptions.Instance.GetPanGestureMinimumTouchesRequired());
+                }
+
+                if (GestureOptions.Instance.GetPanGestureMaximumTouchesRequired() > 0)
+                {
+                    SetMaximumTouchesRequired(GestureOptions.Instance.GetPanGestureMaximumTouchesRequired());
+                }
+            }
         }
 
         private DaliEventHandler<object, DetectedEventArgs> detectedEventHandler;