public void OnPointerMoved(PointerState po) { _pobak = po.Clone(); if (isMenu) { return; } foreach (var link in LoopUtil <PartsJitProcessLink> .From( Parts.GetParts <PartsJitProcessLink>(LAYER.JitProcessConnector) .OrderBy(a => (int)(a.SelectingScore(Pane.Target, po.Position) * 1000)) , out var loop)) { loop.DoFirstTime(() => { if (link.SelectingScore(Pane.Target, po.Position) <= 1.0f) { link.State = PartsJitProcessLink.States.HOVER; } else { link.State = PartsJitProcessLink.States.LINE; } }); loop.DoSecondTimesAndSubsequent(() => { link.State = PartsJitProcessLink.States.LINE; }); } }
public void OnPointerMoved(PointerState po) { if (DataHot.IsPartsMoving.GetValueOrDefault(this) == false || moving is null) { return; } if (isTrigger(po) == false) { OnPointerReleased(po); return; } var tokenParts = new List <IMovableParts>(); foreach (var pt in moving) { if (po.PositionDelta.Width != 0 || po.PositionDelta.Height != 0) { pt.Move(Pane.Target, po.PositionDelta); tokenParts.Add(pt); } } if (tokenParts.Count > 0) { Token.Link(po, new EventTokenPartsMovingTrigger { TokenID = TokensGeneral.PartsMoving, PartsSet = tokenParts, Sender = this, Remarks = "PartsMoving@FeatureMoveSelectedParts", }); Redraw(); } }
public void CancelDraggedCard(Card card) { pointerState = PointerState.MouseOver; foreach (CardDeck slot in cardSlots) { slot.ToggleReplaceIndicator(false); foreach (CardContainer container in slot.containers) { if (container != null) { container.ToggleReplaceIndicator(false); } } } if (mouseOverSlot != null) { mouseOverSlot.EndFocus(); mouseOverSlot = null; } if (mouseOverContainer != null) { mouseOverContainer.EndFocus(); mouseOverContainer = null; } }
public static void notifyPointerUp(EventSystem eventSystem, PointerEventData eventData, GameObject target) { PointerState pointerStat = PointerState.UP; notifyfuncs(eventSystem, eventData, target, pointerStat); }
private bool GetFirst2ActiveTouch(out PointerState p0, out PointerState p1) { int len = mPointerStates.Count; int count = 0; p0 = null; p1 = null; for (int i = TOUCH_MOUSE_OFFSET; i < len; i++) { PointerState state = mPointerStates[i]; if (!state.Active || state.DoubleClick == 2) { continue; } count++; if (count == 1) { p0 = state; } else { p1 = state; } if (count >= 2) { break; } } return(count >= 2); }
public virtual void EnableAllInput(PointerState state) { //TODO: Change to enable physics by default EnableMovement(); EnableJumping(); switch (state) { case PointerState.PhysicsPointer: SetPhysicsPointer(); break; case PointerState.RATS: SetRATS(); break; case PointerState.CanvasPointer: SetUIPointer(); break; case PointerState.Disabled: DisablePointer(); break; } }
private void DraggingMessage(PointerState po, string tokenid) { if (Dragging == null) { return; } Token.AddNew(new EventTokenTriggerToolDragging { TokenID = tokenid, Name = Dragging.Name, ToolButtonType = Dragging.GetType(), Pointer = po, Sender = this, }); if (tokenid == TokenIdFinished || tokenid == TokenIdCancelling) { Dragging = null; Status["IsEnableSelectingBox"].ValueB = true; } else { Status["IsEnableSelectingBox"].ValueB = false; } }
public virtual bool Unload() { if (PointerState != PointerState.ASSIGNED || Object == null) { return(false); } try { using (Stream stream = File.Open(filePath, FileMode.Create)) { this.getFormatter().Serialize(stream, Object); } return(true); } catch (Exception e) { return(false); } finally { PointerState = PointerState.OBJECT_UNLOADED; lock (locker) { Object = null; } lastAccess = 0; } }
internal void HandlePointerEvents(int pointerId, Vector2 newPosition, PointerState pState, PointerType pointerType = PointerType.Touch) { lock (pointerEvents) { if (!PointerInfos.ContainsKey(pointerId)) { PointerInfos[pointerId] = new PointerInfo(); } var pointerInfo = PointerInfos[pointerId]; if (pState == PointerState.Down) { pointerInfo.LastPosition = newPosition; pointerInfo.PointerClock.Restart(); } var pointerEvent = PointerEvent.GetOrCreatePointerEvent(); pointerEvent.PointerId = pointerId; pointerEvent.Position = newPosition; pointerEvent.DeltaPosition = newPosition - pointerInfo.LastPosition; pointerEvent.DeltaTime = pointerInfo.PointerClock.Elapsed; pointerEvent.State = pState; pointerEvent.PointerType = pointerType; pointerEvent.IsPrimary = pointerId == 0; lock (pointerEvents) pointerEvents.Add(pointerEvent); pointerInfo.LastPosition = newPosition; pointerInfo.PointerClock.Restart(); } }
private void DrawAt(Vector2 position, PointerEventData.InputButton button) { if (brush == null) { return; } PointerState pointerState = this.pointerState[(int)button]; Vector2 vector = UIEx.Unpivot(rectTransform, position); if (pointerState.isDown) { Vector2 vector2 = pointerState.lastPos - vector; Vector2 normalized = vector2.normalized; for (float num = 0f; num < vector2.magnitude; num += Mathf.Max(brush.spacing, 1f) * Mathf.Max(spacingScale, 0.1f)) { onDrawing.Invoke(vector + num * normalized, brush); } pointerState.lastPos = vector; } else { onDrawing.Invoke(vector, brush); pointerState.lastPos = vector; } }
internal void RaiseGazePointerEvent(PointerState state, TimeSpan elapsedTime) { if (state == PointerState.Dwell) { Invoke(); } }
public void OnDrag(PointerEventData eventData) { int index = eventData.pointerId + TOUCH_MOUSE_OFFSET; if (mPointerStates.Count <= index) { return; } PointerState state = mPointerStates[index]; if (!state.Active) { return; } bool firstDrag = !state.Dragging; state.Dragging = true; Vector2 pos = GetPosition(eventData); Vector2 delta = pos - state.PrevPos; state.PrevPos = pos; PointerState p0, p1; if (GetFirst2ActiveTouch(out p0, out p1) && (p0 == state || p1 == state)) { p0.Dragging = true; p1.Dragging = true; mOnMultiTouchDrag.Invoke(p0.DownPos, p1.DownPos, p0.PrevPos, p1.PrevPos); return; } ePointerType pt = ePointerType.Touch; if (eventData.pointerId < 0) { pt = eventData.pointerId == -2 ? ePointerType.Right : ePointerType.Left; } if (state.DoubleClick == 2) { pt = ePointerType.LeftAndRight; } if (firstDrag) { if (state.DoubleClick > 0) { (state.LongPress == 1 ? mOnDoubleClickLongPressDragStart : mOnDoubleClickDragStart).Invoke(state.DownPos, pt); } else { (state.LongPress == 1 ? mOnLongPressDragStart : mOnDragStart).Invoke(state.DownPos, pt); } } if (state.DoubleClick > 0) { (state.LongPress == 1 ? mOnDoubleClickLongPressDragging : mOnDoubleClickDragging).Invoke(state.DownPos, delta, pt); } else { (state.LongPress == 1 ? mOnLongPressDragging : mOnDragging).Invoke(state.DownPos, delta, pt); } }
//MOVEMENT IEnumerator MovePlayer(int dir) { pointerState = PointerState.MOVING; Vector2 incrementVector = new Vector2(0, 0); float fraction = 0; if (dir > 0) { incrementVector = new Vector2(0, MOVE_DIST); } if (dir < 0) { incrementVector = new Vector2(0, -MOVE_DIST); } //POS INIT Vector2 startPos = new Vector2(transform.position.x, transform.position.y); Vector2 targetPos = startPos + incrementVector; do { fraction += Time.deltaTime * POINTER_SPEED; transform.position = Vector2.Lerp(startPos, targetPos, fraction); yield return(null); }while (fraction < 1 && pointerState == PointerState.MOVING); pointerState = PointerState.IDLE; yield return(new WaitForSeconds(0.25f)); }
private void OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { pointerState = PointerState.Pressed; lastPosition = e.GetPosition(this); interactionControl.CaptureMouse(); }
public void OnPointerMoved(PointerState po) { if (isTrigger(po)) { var pts = from sp in Parts.GetParts <ISelectableParts>(TargetLayer) let score = sp.SelectingScore(Pane.Target, po.Position) where score >= 0.0f orderby score select sp; foreach (var sp in LoopUtil <ISelectableParts> .From(pts, out var lu)) { lu.DoFirstTime(() => { var score = sp.SelectingScore(Pane.Target, po.Position); sp.IsSelected = score <= 1.0f; }); lu.DoSecondTimesAndSubsequent(() => { sp.IsSelected = false; }); } Redraw(); } }
/// <summary> /// save pointer state from ManipulationCompletedRoutedEventArgs /// </summary> /// <param name="e"></param> /// <returns></returns> public static PointerState _(Windows.UI.Xaml.Input.ManipulationCompletedRoutedEventArgs e, object sender, string remarks) { var ret = new PointerState { Sender = sender, Remarks = remarks, Position = ScreenPos.From(e.Position.X, e.Position.Y), IsInContact = false, Scale = e.Cumulative.Scale, Rotation = Angle.FromDeg(e.Cumulative.Rotation), Time = DateTime.Now, }; switch (e.PointerDeviceType) { case PointerDeviceType.Pen: ret.DeviceType = PointerState.DeviceTypes.Pen; break; case PointerDeviceType.Touch: ret.DeviceType = PointerState.DeviceTypes.Touch; break; case PointerDeviceType.Mouse: ret.DeviceType = PointerState.DeviceTypes.Mouse; break; } return(ret); }
public void OnPointerMoved(PointerState po) { if (isTriggered && po.PositionDelta.Length > 4) { isTriggered = false; } }
/// <summary> /// save pointer state from PointerEventArgs /// </summary> /// <param name="e"></param> /// <returns></returns> public static PointerState _(Windows.UI.Core.PointerEventArgs e, object sender, string remarks) { var ret = new PointerState { Sender = sender, Remarks = remarks, Position = ScreenPos.From(e.CurrentPoint.Position.X, e.CurrentPoint.Position.Y), WheelDelta = e.CurrentPoint.Properties.MouseWheelDelta, Time = DateTime.Now, IsInContact = e.CurrentPoint.IsInContact, IsKeyControl = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Control) != 0, IsKeyMenu = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Menu) != 0, IsKeyShift = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Shift) != 0, IsKeyWindows = (e.KeyModifiers & Windows.System.VirtualKeyModifiers.Windows) != 0, }; switch (e.CurrentPoint.PointerDevice.PointerDeviceType) { case PointerDeviceType.Mouse: ret.DeviceType = PointerState.DeviceTypes.Mouse; break; case PointerDeviceType.Pen: ret.DeviceType = PointerState.DeviceTypes.Pen; break; default: ret.DeviceType = PointerState.DeviceTypes.Touch; break; } return(ret); }
/// <summary> /// [DONW-2] On Pointer Pressed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <remarks> /// by Finger / Click /// </remarks> private void OnPointerPressed(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.PointerEventArgs e) { var po = _(e, this, "OnPointerPressed"); FingerCount++; po.FingerCount = FingerCount; Move = po.Clone(); //Debug.WriteLine(___(po)); if (po.DeviceType == PointerState.DeviceTypes.Mouse) { StartPosition = po.Position; po.PositionOrigin = StartPosition; KickPointerEvent("OnPointerPressed", fc => fc.OnPointerPressed(po)); } else { if (IsOnManipulationStarted) { IsWaitingManipulationDelta = true; _2ndFingerLostFollow?.Stop(); _2ndFingerLostFollow = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100), }; _2ndFingerLostFollow.Tick += _2ndFingerLostFollow_Tick; StateAtPressed = po.Clone(); _2ndFingerLostFollow.Start(); } } IsOnPointerPressed = true; }
public MainPage() { #region initialization this.InitializeComponent(); _model = new Model(); _presentationModel = new PresentationModel.PresentationModel(_model); _interfaceGraphics = new WindowsStoreGraphicsAdaptor(_canvas); // prepare buttons _shapeButtons = new List <Button>(); _shapeButtons.Add(_rectangle); _shapeButtons.Add(_line); _shapeButtons.Add(_hexagon); // prepare events _canvas.PointerPressed += HandleCanvasPressed; _canvas.PointerReleased += HandleCanvasReleased; _canvas.PointerMoved += HandleCanvasMoved; _clear.Click += HandleClearButtonClick; _rectangle.Click += HandleRectangleButtonClick; _line.Click += HandleLineButtonClick; _hexagon.Click += HandleHexagonButtonClick; _undo.Click += UndoHandler; _redo.Click += RedoHandler; _model._modelChanged += HandleModelChanged; _model._modelChanged += RefreshUserInterface; // prepare state _drawingState = new DrawingState(_model); _pointerState = new PointerState(_model); _model.CurrentState = _pointerState; #endregion }
private static void notifyfuncs(EventSystem eventSystem, PointerEventData eventData, GameObject target, PointerState pointerStat) { //////////////////////Call the int parameter////////////////////// PointerCounterEventData eventParam1 = new PointerCounterEventData( eventSystem, eventData.pointerId, pointerStat); ExecuteEvents.Execute <IPointerCounterHandler>( target, eventParam1, PointerCounterEventData.counterChangedV1Delegate); //////////////////////Call the PointerCounterEventData parameter////////////////////// PointerCounterEventData eventParam2 = new PointerCounterEventData( eventSystem, eventData, pointerStat, target); ExecuteEvents.Execute <IPointerCounterHandler>( target, eventParam2, PointerCounterEventData.counterChangedV2Delegate); }
public override TimeSpan GetElementStateDelay(PointerState pointerState, TimeSpan defaultValue) { var property = GetProperty(pointerState); var value = GetElementStateDelay(property, defaultValue); return(value); }
private void DetailUpdate() { if (!cardDetail.IsOpen()) { pointerState = PointerState.MouseOver; } }
void processTouches(PointerState pointerStat, int tempTouchId, PointerEventData touchCountData, CallBackType cbType) { if (pointerStat == PointerState.DOWN) { //Check If PointerId exist, if it doesn't add to list if (touchID.Contains(tempTouchId)) { //eventData.eventData return; //Exit if PointerId exist } //PointerId does not exist, add it to the list then increment touchCount touchID.Add(tempTouchId); touchCount++; } if (pointerStat == PointerState.UP) { //Check If PointerId exist, if it exist remove it from list then decrement touchCount if (touchID.Contains(tempTouchId)) { touchID.Remove(tempTouchId); touchCount--; return; } } }
void Update() { if (curState != PointerState.Idle) { if (zoomTimer >= zoomDetectTime) { if (curState == PointerState.Entering) { curZoomState = ZoomState.ZoomedIn; } else { curZoomState = ZoomState.ZoomedOut; } curState = PointerState.Idle; zoomTimer = 0; if (curZoomState == ZoomState.ZoomedIn) { CameraManager.Instance.ControlRoomCam.transform.position = camZoomPos; Debug.Log("Zoomed in"); } else { //zoom out CameraManager.Instance.ControlRoomCam.transform.position = Vector3.zero; Debug.Log("Zoomed out"); } } zoomTimer += Time.deltaTime; } }
public void OnPointerReleased(PointerState po) { if (po.DeviceType == PointerState.DeviceTypes.Touch || po.DeviceType == PointerState.DeviceTypes.Pen) { checkSelect(po); } DraggingMessage(po, Pane.Target.Rect.IsIn(po.Position) ? TokenIdCancelling : TokenIdFinished); }
public void Init(TextSettings _textSettings, Action <int> _clickAction, int _code) { GetComponent <RectTransform>().localPosition = Vector2.zero; mTextSetting = _textSettings; clickAction = _clickAction; code = _code; currentPointerState = PointerState.None; }
public void OnPress(GameObject go, PointerEventData eventData) { currentPointerState = PointerState.Click; foreach (var x in textLinks) { x.color = mTextSetting.hyperPressColor; } }
void Update() { if (pointerState != lastState) { lastState = pointerState; UpdateState(); } }
protected UserInterfaceManager(IServiceRegistry services) { Contract.Requires <ArgumentNullException>(services != null, "services"); this.services = services; pointerManager = new PointerManager(services); recentEvents = new Queue <PointerEventArgs>(); pointerState = new PointerState(); }
/// <summary> /// Initializes a new instance of the <see cref="PointerEvent" /> class. /// </summary> /// <param name="pointerId">The pointer id.</param> /// <param name="position">The position.</param> /// <param name="deltaPosition">The delta position.</param> /// <param name="deltaTime">The delta time.</param> /// <param name="state">The state.</param> /// <param name="pointerType">Type of the pointer.</param> /// <param name="isPrimary">if set to <c>true</c> [is primary].</param> internal PointerEvent(int pointerId, Vector2 position, Vector2 deltaPosition, TimeSpan deltaTime, PointerState state, PointerType pointerType, bool isPrimary) { PointerId = pointerId; Position = position; DeltaPosition = deltaPosition; DeltaTime = deltaTime; State = state; PointerType = pointerType; IsPrimary = isPrimary; }
protected override void SetPointerState(PointerState value) { base.SetPointerState(value); if (_icon == null) return; int state = (int) PointerState; _icon.Alpha = AlphaState[state]; _icon.Position = _iconPosition + OriginState[state]; }
protected PointerEvent CreatePointerEvent(PointerState state, Vector2 position) { if (state == PointerState.Down) lastTouchPosition = position; var pointerEvent = new PointerEvent(0, position, position - lastTouchPosition, new TimeSpan(), state, PointerType.Touch, true); lastTouchPosition = position; return pointerEvent; }
private void HandlePointerEventFrameworkElement(FrameworkElement uiElement, PointerRoutedEventArgs pointerRoutedEventArgs, PointerState pointerState) { HandlePointerEvent(pointerRoutedEventArgs.GetCurrentPoint(uiElement), pointerState); pointerRoutedEventArgs.Handled = true; }
private void HandlePointerEventCoreWindow(PointerEventArgs args, PointerState pointerState) { HandlePointerEvent(args.CurrentPoint, pointerState); args.Handled = true; }
private void OnMouseLeftButtonUp(object sender, MouseButtonEventArgs e) { Mouse.Capture(null); if (pointerState == PointerState.Pressed) { IsValueEditing = true; } pointerState = PointerState.Idle; }
private void OnMouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { pointerState = PointerState.Moved; Point InstancePosition = e.GetPosition(this); Vector translate = new Vector(InstancePosition.X - lastPosition.X, -(InstancePosition.Y - lastPosition.Y)); OffsetValue(translate); lastPosition = InstancePosition; } }
void HandlePointerEvent(WinRTPointerPoint p, PointerState ptrState) { var pointerType = ConvertPointerDeviceType(p.PointerDevice.PointerDeviceType); var isMouse = pointerType == PointerType.Mouse; var position = NormalizeScreenPosition(PointToVector2(p.Position)); if (isMouse) { if (ptrState == PointerState.Cancel || ptrState == PointerState.Out) { // invalidate mouse and current pointers LostFocus = true; for (int i = 0; i < MouseButtonCurrentlyDown.Length; i++) { if (MouseButtonCurrentlyDown[i]) { HandlePointerEvents(i, position, PointerState.Out, pointerType); MouseButtonCurrentlyDown[i] = false; } } } else // down/up/move { // Note: The problem here is that the PointerPressed event is not triggered twice when two button are pressed together. // That is why we are forced to continuously keep the state of all buttons of the mouse. MouseInputEvent mouseEvent; // Trigger mouse button and pointer Down events for newly pressed buttons. foreach (MouseButton button in Enum.GetValues(typeof(MouseButton))) { var buttonId = (int)button; if (!MouseButtonCurrentlyDown[buttonId] && MouseButtonIsPressed(p.Properties, button)) { lock (MouseInputEvents) { mouseEvent = new MouseInputEvent { Type = InputEventType.Down, MouseButton = button }; MouseInputEvents.Add(mouseEvent); } HandlePointerEvents(buttonId, position, PointerState.Down, pointerType); MouseButtonCurrentlyDown[buttonId] = true; } } // Trigger Move events to pointer that have changed position if (CurrentMousePosition != position) { foreach (MouseButton button in Enum.GetValues(typeof(MouseButton))) { var buttonId = (int)button; if (MouseButtonCurrentlyDown[buttonId]) HandlePointerEvents(buttonId, position, PointerState.Move, pointerType); } } // Trigger mouse button and pointer Up events for newly released buttons. foreach (MouseButton button in Enum.GetValues(typeof(MouseButton))) { var buttonId = (int)button; if (MouseButtonCurrentlyDown[buttonId] && !MouseButtonIsPressed(p.Properties, button)) { lock (MouseInputEvents) { mouseEvent = new MouseInputEvent { Type = InputEventType.Up, MouseButton = button }; MouseInputEvents.Add(mouseEvent); } HandlePointerEvents(buttonId, position, PointerState.Up, pointerType); MouseButtonCurrentlyDown[buttonId] = false; } } // Trigger mouse wheel events if (Math.Abs(p.Properties.MouseWheelDelta) > MathUtil.ZeroTolerance) { lock (MouseInputEvents) { mouseEvent = new MouseInputEvent { Type = InputEventType.Wheel, MouseButton = MouseButton.Middle, Value = p.Properties.MouseWheelDelta }; MouseInputEvents.Add(mouseEvent); } } } // Update mouse cursor position CurrentMousePosition = position; } else { HandlePointerEvents((int)p.PointerId, position, ptrState, pointerType); } }
protected virtual void SetPointerState(PointerState value) { _pointerState = value; switch (_pointerState) { case PointerState.Default: Frame = _defaultFrame; break; case PointerState.Hover: Frame = _hoverFrame; break; case PointerState.Down: Frame = _downFrame; break; } }
/// <summary> /// Updates this instance. /// </summary> public override void Update() { isTouched = false; hasGesture = false; SiliconStudio.Xenko.Input.InputManager manager = XenkoInputDevice.NativeInputManager; if (manager.PointerEvents.Count > 0) { var pointerEvent = manager.PointerEvents[0]; if (pointerEvent.PointerType != PointerType.Touch) { isTouched = false; return; } id = pointerEvent.PointerId; isTouched = true; normalizedX = pointerEvent.Position.X; normalizedY = pointerEvent.Position.Y; previousState = pointerEvent.State; previousLocation = pointerEvent.Position; switch (pointerEvent.State) { case PointerState.Cancel: action = TouchAction.None; break; case PointerState.Down: action = TouchAction.Pressed; break; case PointerState.Move: action = TouchAction.Moved; break; case PointerState.Out: action = TouchAction.None; break; case PointerState.Up: action = TouchAction.Released; break; default: break; } } else if (previousState == PointerState.Move) { previousState = PointerState.Out; action = TouchAction.Released; normalizedX = previousLocation.X; normalizedY = previousLocation.Y; isTouched = true; } if (manager.GestureEvents.Count > 0) { hasGesture = true; var gestureEvent = manager.GestureEvents[0]; switch (gestureEvent.Type) { case GestureType.Composite: gesture = TouchGestures.MoveRotateAndScale; var compositeEvent = gestureEvent as GestureEventComposite; normalizedX = compositeEvent.CenterCurrentPosition.X; normalizedY = compositeEvent.CenterCurrentPosition.Y; moveX = compositeEvent.DeltaTranslation.X; moveY = compositeEvent.DeltaTranslation.Y; break; case GestureType.Drag: gesture = TouchGestures.FreeDrag; var dragGestureEvent = gestureEvent as GestureEventDrag; normalizedX = dragGestureEvent.CurrentPosition.X; normalizedY = dragGestureEvent.CurrentPosition.Y; moveX = dragGestureEvent.DeltaTranslation.X; moveY = dragGestureEvent.DeltaTranslation.Y; break; case GestureType.Flick: gesture = TouchGestures.Flick; var flickEvent = gestureEvent as GestureEventFlick; normalizedX = flickEvent.CurrentPosition.X; normalizedY = flickEvent.CurrentPosition.Y; moveX = flickEvent.DeltaTranslation.X; moveY = flickEvent.DeltaTranslation.Y; break; case GestureType.LongPress: gesture = TouchGestures.Hold; var longPressEvent = gestureEvent as GestureEventLongPress; normalizedX = longPressEvent.Position.X; normalizedY = longPressEvent.Position.Y; moveX = moveY = 0; break; case GestureType.Tap: gesture = TouchGestures.Tap; var tapEvent = gestureEvent as GestureEventTap; normalizedX = tapEvent.TapPosition.X; normalizedY = tapEvent.TapPosition.Y; moveX = moveY = 0; break; default: break; } } }