From 26e21f69bc3f056e277f198833f3eba05392459c Mon Sep 17 00:00:00 2001 From: JoogabYun <40262755+JoogabYun@users.noreply.github.com> Date: Tue, 3 Nov 2020 10:23:13 +0900 Subject: [PATCH] [NUI] Add TouchArea property. (#2105) 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. --- .../src/internal/Interop/Interop.ActorProperty.cs | 3 +++ src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs | 1 + src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs | 20 ++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/src/Tizen.NUI/src/internal/Interop/Interop.ActorProperty.cs b/src/Tizen.NUI/src/internal/Interop/Interop.ActorProperty.cs index ec56de3..2b0c9b4 100755 --- a/src/Tizen.NUI/src/internal/Interop/Interop.ActorProperty.cs +++ b/src/Tizen.NUI/src/internal/Interop/Interop.ActorProperty.cs @@ -188,6 +188,9 @@ namespace Tizen.NUI [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Actor_Property_CAPTURE_ALL_TOUCH_AFTER_START_get")] public static extern int ActorPropertyCaptureAllTouchAfterStartGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Actor_Property_TOUCH_AREA_get")] + public static extern int ActorPropertyTouchAreaGet(); + [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_new_Actor_Property")] public static extern global::System.IntPtr new_Actor_Property(); diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs index afdc48b..cfc8534 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewEnum.cs @@ -208,6 +208,7 @@ namespace Tizen.NUI.BaseComponents internal static readonly int PADDING = Interop.ViewProperty.View_Property_PADDING_get(); internal static readonly int SHADOW = Interop.ViewProperty.View_Property_SHADOW_get(); internal static readonly int CaptureAllTouchAfterStart = Interop.ActorProperty.ActorPropertyCaptureAllTouchAfterStartGet(); + internal static readonly int TouchArea = Interop.ActorProperty.ActorPropertyTouchAreaGet(); } } } diff --git a/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs b/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs index 62513e7..c4e380e 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ViewEvent.cs @@ -1273,5 +1273,25 @@ namespace Tizen.NUI.BaseComponents } } + /// + /// TouchArea can reset the view's touchable area.
+ /// 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. + ///
+ [EditorBrowsable(EditorBrowsableState.Never)] + public Size2D TouchArea + { + get + { + Size2D temp = new Size2D(0, 0); + GetProperty(View.Property.TouchArea).Get(temp); + return new Size2D(temp.Width, temp.Height); + } + set + { + SetProperty(View.Property.TouchArea, new Tizen.NUI.PropertyValue(value)); + NotifyPropertyChanged(); + } + } + } } -- 2.7.4