internalHoverTimer = new Timer(time);
internalHoverTimer.Tick += (s, e) =>
{
- using Touch touch = GetLastTouchEvent();
- if(touch != null && touch.GetPointCount() > 0)
- {
- using Vector2 screenPosition = touch.GetScreenPosition(0);
- using TouchPoint touchPoint = new TouchPoint(touch.GetDeviceId(0), TouchPoint.StateType.Motion, screenPosition.X, screenPosition.Y);
- FeedHover(touchPoint);
- }
+ FeedHover();
internalHoverTimer?.Stop();
internalHoverTimer?.Dispose();
internalHoverTimer = null;
/// <summary>
/// Feeds a hover event into the window.
/// </summary>
- /// <param name="touchPoint">The touch point to feed hover event.</param>
+ /// <param name="touchPoint">The touch point to feed hover event. If null is entered, the feed hover event is generated with the last inputed touch point.</param>
[EditorBrowsable(EditorBrowsableState.Never)]
- internal void FeedHover(TouchPoint touchPoint)
+ internal void FeedHover(TouchPoint touchPoint = null)
{
+ if (touchPoint == null)
+ {
+ using Touch touch = GetLastTouchEvent();
+ if (touch == null || touch.GetPointCount() < 1)
+ {
+ return;
+ }
+ using Vector2 screenPosition = touch.GetScreenPosition(0);
+ touchPoint = new TouchPoint(touch.GetDeviceId(0), TouchPoint.StateType.Motion, screenPosition.X, screenPosition.Y);
+ }
Interop.Window.FeedHoverEvent(SwigCPtr, TouchPoint.getCPtr(touchPoint));
if (NDalicPINVOKE.SWIGPendingException.Pending) throw NDalicPINVOKE.SWIGPendingException.Retrieve();
}