[NUI] Add TouchArea property.
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 12 Mar 2021 01:50:58 +0000 (10:50 +0900)
committerEunki Hong <h.pichulia@gmail.com>
Wed, 17 Mar 2021 06:50:14 +0000 (15:50 +0900)
Default touchable area is view's size.
TouchArea can reset the view's touchable area.

This is usefull when the view is small, but it should have a larger touch area.

for example

      View view = new View();
      view.Size = new Size(10, 10);
      view.TouchEvent += OnTouchEvent;
      view.TouchArea = new Size2D(200, 200);

The view is small, If you want to set the touch area to a larger area,
you can use the TouchArea property.

This reverts commit 034889141391985f0ad1727ae6e32719d9c5a360.

src/Tizen.NUI/src/internal/Interop/Interop.ActorProperty.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs
src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs

index a85431d..363066a 100755 (executable)
@@ -204,6 +204,9 @@ namespace Tizen.NUI
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Actor_Property_BLEND_EQUATION_get")]
             public static extern int BlendEquationGet();
 
+            [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Actor_Property_TOUCH_AREA_get")]
+            public static extern int TouchAreaGet();
+
             [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_Actor_Property")]
             public static extern global::System.IntPtr NewActorProperty();
 
index 63520b9..498b896 100755 (executable)
@@ -218,6 +218,7 @@ namespace Tizen.NUI.BaseComponents
             internal static readonly int AccessibilityHighlightable = Interop.ViewProperty.AccessibilityHighlightableGet();
             internal static readonly int AccessibilityAttributes = Interop.ViewProperty.AccessibilityAttributesGet();
             internal static readonly int AccessibilityAnimated = Interop.ViewProperty.AccessibilityAnimatedGet();
+            internal static readonly int TouchArea = Interop.ActorProperty.TouchAreaGet();
         }
     }
 }
index 39cb187..d91d0d0 100755 (executable)
@@ -1364,5 +1364,25 @@ namespace Tizen.NUI.BaseComponents
             }
         }
 
+        /// <summary>
+        /// TouchArea can reset the view's touchable area.<br/>
+        /// If you set the TouchArea on an view, when you touch the view, the touch area is used rather than the size of the view.
+        /// </summary>
+        [EditorBrowsable(EditorBrowsableState.Never)]
+        public Size2D TouchArea
+        {
+            get
+            {
+                Size2D value = new Size2D(0, 0);
+                GetProperty(View.Property.TouchArea).Get(value);
+                return value;
+            }
+            set
+            {
+                SetProperty(View.Property.TouchArea, new Tizen.NUI.PropertyValue(value));
+                NotifyPropertyChanged();
+            }
+        }
+
     }
 }