private void OnReleased() { if (_touchEffect != null) { _touchEffect.OnTouchAction(Element, new TouchActionEventArgs(TouchActionType.Released, GetLocalPoint(), GetApplicationPoint(), false)); } }
private void OnPointerEntered(object sender, PointerRoutedEventArgs e) { if (_touchEffect != null) { PointerPoint ptrPt = e.GetCurrentPoint(_view); Point point = new Point(ptrPt.Position.X, ptrPt.Position.Y); PointerPoint applicationPtrPt = e.GetCurrentPoint(Window.Current.Content); Point applicationPoint = new Point(applicationPtrPt.Position.X, applicationPtrPt.Position.Y); _touchEffect.OnTouchAction(Element, new TouchActionEventArgs(TouchActionType.Entered, point, applicationPoint, _isPressed)); } }
private void OnTouch(object sender, global::Android.Views.View.TouchEventArgs args) { TouchActionType?type = null; if (args.Event.Action == MotionEventActions.Down) { _isPressed = true; type = TouchActionType.Pressed; } else if (args.Event.Action == MotionEventActions.Up) { _isPressed = false; type = TouchActionType.Released; } else if (args.Event.Action == MotionEventActions.Cancel) { _isPressed = false; type = TouchActionType.Cancelled; } else if (args.Event.Action == MotionEventActions.Outside) { type = TouchActionType.Cancelled; } else if (args.Event.Action == MotionEventActions.Move) { type = TouchActionType.Move; } else if (args.Event.Action == MotionEventActions.Move && (args.Event.GetX() < 0 || args.Event.GetY() < 0 || args.Event.GetX() > _view.Width || args.Event.GetY() > _view.Height)) { type = TouchActionType.Cancelled; } if (_touchEffect != null && type.HasValue) { Point point = PxToDp(new Point(args.Event.GetX(), args.Event.GetY())); Point applicationPoint = PxToDp(new Point(args.Event.RawX, args.Event.RawY)); _touchEffect.OnTouchAction(Element, new TouchActionEventArgs(type.Value, point, applicationPoint, _isPressed)); } }