/// <summary> /// Triggers the bound pointer up action /// </summary> public virtual void OnPointerUp(PointerEventData data) { if (Time.frameCount == _lastPointerUpAt) { return; } _destination = Input.mousePosition; _deltaSwipe = _destination - _firstTouchPosition; _length = _deltaSwipe.magnitude; // if the swipe has been long enough if (_length > MinimalSwipeLength) { _angle = MMMaths.AngleBetween(_deltaSwipe, Vector2.right); _swipeDirection = AngleToSwipeDirection(_angle); _swipeEndedAt = Time.unscaledTime; Swipe(); } // if it's just a press if (_deltaSwipe.magnitude < MaximumPressLength) { Press(); } _lastPointerUpAt = Time.frameCount; }
/// <summary> /// Triggers the bound pointer up action /// </summary> public virtual void OnPointerUp(PointerEventData data) { _destination = Input.mousePosition; _deltaSwipe = _destination - _firstTouchPosition; _length = _deltaSwipe.magnitude; // if the swipe has been long enough if (_length > MinimalSwipeLength) { _angle = MMMaths.AngleBetween(_deltaSwipe, Vector2.right); _swipeDirection = AngleToSwipeDirection(_angle); Swipe(); } // if it's just a press if (_deltaSwipe.magnitude < MaximumPressLength) { Press(); } }