private void OnViewOnTouch(object sender, View.TouchEventArgs e) { switch (e.Event.ActionMasked) { case MotionEventActions.ButtonPress: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Pressing); break; case MotionEventActions.ButtonRelease: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Released); break; case MotionEventActions.Cancel: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Cancelled); break; case MotionEventActions.Down: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Pressing); break; case MotionEventActions.HoverEnter: break; case MotionEventActions.HoverExit: break; case MotionEventActions.HoverMove: break; case MotionEventActions.Mask: break; case MotionEventActions.Move: var motionEvent = e.Event as MotionEvent; if (motionEvent != null) { var x = motionEvent.GetX(); var y = motionEvent.GetY(); if (!this.firstX.HasValue || !this.firstY.HasValue) { this.firstX = x; this.firstY = y; } var maxDelta = 10; var deltaX = Math.Abs(x - this.firstX.Value); var deltaY = Math.Abs(y - this.firstY.Value); if (!this.ignored && (deltaX > maxDelta || deltaY > maxDelta)) { this.ignored = true; _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Ignored); } } break; case MotionEventActions.Outside: break; case MotionEventActions.Pointer1Down: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Pressing); break; case MotionEventActions.Pointer1Up: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Released); break; case MotionEventActions.Pointer2Down: break; case MotionEventActions.Pointer2Up: break; case MotionEventActions.Pointer3Down: break; case MotionEventActions.Pointer3Up: break; case MotionEventActions.PointerIdMask: break; case MotionEventActions.PointerIdShift: break; case MotionEventActions.Up: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Released); break; default: throw new ArgumentOutOfRangeException(); } if (e.Event.ActionMasked != MotionEventActions.Move) { this.ignored = false; this.firstX = null; this.firstY = null; } }
private void ViewOnPointerCanceled(object sender, PointerRoutedEventArgs e) { _effectConsumer.ConsumeEvent(EventType.Cancelled); }
public override void PressesBegan(NSSet <UIPress> presses, UIPressesEvent evt) { base.PressesBegan(presses, evt); _touchAndPressEffectConsumer.ConsumeEvent(EventType.Pressing); }
private void OnViewOnTouch(object sender, View.TouchEventArgs e) { switch (e.Event.ActionMasked) { case MotionEventActions.ButtonPress: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Pressing); break; case MotionEventActions.ButtonRelease: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Released); break; case MotionEventActions.Cancel: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Cancelled); break; case MotionEventActions.Down: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Pressing); break; case MotionEventActions.HoverEnter: break; case MotionEventActions.HoverExit: break; case MotionEventActions.HoverMove: break; case MotionEventActions.Mask: break; case MotionEventActions.Move: break; case MotionEventActions.Outside: break; case MotionEventActions.Pointer1Down: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Pressing); break; case MotionEventActions.Pointer1Up: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Released); break; case MotionEventActions.Pointer2Down: break; case MotionEventActions.Pointer2Up: break; case MotionEventActions.Pointer3Down: break; case MotionEventActions.Pointer3Up: break; case MotionEventActions.PointerIdMask: break; case MotionEventActions.PointerIdShift: break; case MotionEventActions.Up: _touchAndPressEffectConsumer?.ConsumeEvent(EventType.Released); break; default: throw new ArgumentOutOfRangeException(); } }
public override void MouseDown(NSEvent mouseEvent) { base.MouseDown(mouseEvent); _touchAndPressEffectConsumer.ConsumeEvent(EventType.Pressing); }