You can expand the touch area.
for example)
View view = new View();
view.Size = new Size(10, 10);
view.TouchEvent += OnTouch;
view.TouchAreaOffset = new Offset(-100, 100, 100, -100); // left, right, bottom, top
then touch area is 210x210.
this is view.width -touchAreaOffset.left + touchAreaOffset.right
and view.height + touchAreaOffset.bottom -touchAreaOffset.top
[global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_Dali_Actor_GetMaximumSize")]
public static extern global::System.IntPtr GetMaximumSize(global::System.Runtime.InteropServices.HandleRef jarg1);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_DevelActor_Property_SetTouchAreaOffset")]
+ public static extern void SetTouchAreaOffset(global::System.Runtime.InteropServices.HandleRef jarg1, int jarg2, int jarg3, int jarg4, int jarg5);
+
+ [global::System.Runtime.InteropServices.DllImport(NDalicPINVOKE.Lib, EntryPoint = "CSharp_DevelActor_Property_GetTouchAreaOffset")]
+ public static extern void GetTouchAreaOffset(global::System.Runtime.InteropServices.HandleRef jarg1, out int jarg2, out int jarg3, out int jarg4, out int jarg5);
}
}
}
[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();
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();
}
}
}
}
/// <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.
+ /// TouchArea can expand the view's touchable area.<br/>
+ /// If you set the TouchAreaOffset on an view, when you touch the view, the touch area is used rather than the size of the view.<br/>
+ /// This is based on the top left x, y coordinates.<br/>
+ /// example) <br/>
+ /// view.Size = new Size(100, 100);<br/>
+ /// view.TouchAreaOffset = new Offset(-10, 20, 30, -40); // left, right, bottom, top <br/>
+ /// then touch area is 130x170.<br/>
+ /// this is view.width + TouchAreaOffset.right - TouchAreaOffset.left and view.height + TouchAreaOffset.bottom - TouchAreaOffset.top <br/>
+ /// +---------------------+ <br/>
+ /// | ^ | <br/>
+ /// | | | <br/>
+ /// | | -40 | <br/>
+ /// | | | <br/>
+ /// | | | <br/>
+ /// | +----+----+ | <br/>
+ /// | | | | <br/>
+ /// | -10| | 20 | <br/>
+ /// |<---+ +----->| <br/>
+ /// | | | | <br/>
+ /// | | | | <br/>
+ /// | +----+----+ | <br/>
+ /// | | | <br/>
+ /// | | 30 | <br/>
+ /// | | | <br/>
+ /// | v | <br/>
+ /// +---------------------+ <br/>
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
- public Size TouchArea
+ public Offset TouchAreaOffset
{
get
{
- Size value = new Size(0, 0, 0);
- GetProperty(View.Property.TouchArea).Get(value);
- return value;
+ Interop.ActorInternal.GetTouchAreaOffset(SwigCPtr, out int left, out int right, out int bottom, out int top);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
+ return new Offset(left, right, bottom, top);
}
set
{
- SetProperty(View.Property.TouchArea, new Tizen.NUI.PropertyValue(value));
- NotifyPropertyChanged();
+ Interop.ActorInternal.SetTouchAreaOffset(SwigCPtr, value.Left, value.Right, value.Bottom, value.Top);
+ if (NDalicPINVOKE.SWIGPendingException.Pending)
+ throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}
}
}
/// <summary>
+ /// Offset has left, right, bottom, top value.
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public struct Offset
+ {
+ /// <summary>
+ /// Constructor
+ /// </summary>
+ /// <param name="left">left offset</param>
+ /// <param name="right">right offset</param>
+ /// <param name="bottom">bottom offset</param>
+ /// <param name="top">top offset</param>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public Offset(int left, int right, int bottom, int top)
+ {
+ Left = left;
+ Right = right;
+ Bottom = bottom;
+ Top = top;
+ }
+
+ /// <summary>
+ /// Left
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Left {get; set;}
+
+ /// <summary>
+ /// Right
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Right {get; set;}
+
+ /// <summary>
+ /// Bottom
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Bottom {get; set;}
+
+ /// <summary>
+ /// Top
+ /// </summary>
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public int Top {get; set;}
+
+ }
+
+ /// <summary>
/// TODO This is to get TizenFX resource path. It needs to be fixed to use application framework API in the future.
/// Internal use only. Do not open this API.
/// </summary>