Add SetDoubleTapTimeout binding
authorjoogab.yun <joogab.yun@samsung.com>
Mon, 30 Aug 2021 06:38:17 +0000 (15:38 +0900)
committerhuiyu <35286162+huiyueun@users.noreply.github.com>
Tue, 7 Sep 2021 09:05:39 +0000 (18:05 +0900)
src/Tizen.NUI/src/internal/Interop/Interop.GestureOptions.cs
src/Tizen.NUI/src/public/Events/GestureOptions.cs
test/Tizen.NUI.Samples/Tizen.NUI.Samples/Samples/TouchGestureSample.cs

index 8bc01ac..b90a6c1 100644 (file)
@@ -89,6 +89,9 @@ namespace Tizen.NUI
 
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GestureOptions_SetLongPressMinimumHoldingTime")]
             public static extern void SetLongPressMinimumHoldingTime(uint time);
+
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_GestureOptions_SetTapMaximumAllowedTime")]
+            public static extern void SetDoubleTapTimeout(uint ms);
         }
     }
 }
index 9272fbf..381ea23 100644 (file)
@@ -284,6 +284,7 @@ namespace Tizen.NUI
         /// </summary>
         /// <remarks>This is a global configuration option. Affects all gestures.</remarks>
         /// <param name="number">The number of touch events</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
         public void SetPinchGestureMinimumTouchEventsAfterStart(uint number)
         {
             Interop.GestureOptions.SetPinchGestureMinimumTouchEventsAfterStart(number);
@@ -326,6 +327,16 @@ namespace Tizen.NUI
             if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
         }
 
-
+        /// <summary>
+        /// Sets the duration in milliseconds between the first tap's up event and the second tap's down event to be recognized as a duoble-tap gesture.
+        /// </summary>
+        /// <remarks>This is a global configuration option. Affects all gestures.</remarks>
+        /// <param name="ms">The time value in milliseconds</param>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public void SetDoubleTapTimeout(uint ms)
+        {
+            Interop.GestureOptions.SetDoubleTapTimeout(ms);
+            if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+        }
     }
 }
index 0ef323a..08d558c 100755 (executable)
@@ -23,17 +23,21 @@ namespace Tizen.NUI.Samples
            frontView = new View
             {
                 Size = new Size(300, 300),
-                // Text = "Front View",
                 Position = new Position(150, 170),
-                // PointSize = 11,
                 BackgroundColor = new Color(1.0f, 0.0f, 0.0f, 1.0f),
             };
             frontView.TouchEvent += OnFrontTouchEvent;
+
+            // The default the maximum allowed time is 500ms.
+            // If you want to change this time, do as below.
+            // But keep in mind this is a global option. Affects all gestures.
+            GestureOptions.Instance.SetDoubleTapTimeout(300);
             tapGestureDetector = new TapGestureDetector();
             tapGestureDetector.Attach(frontView);
+            tapGestureDetector.SetMaximumTapsRequired(2);
             tapGestureDetector.Detected += (s, e) =>
             {
-              Tizen.Log.Error("NUI", $"OnTap\n");
+              Tizen.Log.Error("NUI", $"OnTap {e.TapGesture.NumberOfTaps}\n");
             };
 
             backView = new TextLabel