TouchKit icon indicating copy to clipboard operation
TouchKit copied to clipboard

TKSwipeRecognizer also needs gestureCompleteEvent

Open qria opened this issue 8 years ago • 2 comments

TKSwipeRecognizer also needs to fire gestureCompleteEvent when the finger is lifted if the swipe was recognized. This will be very useful in games where swipe is the main control, where you can implement long presses with this. Without this functionality, players have to swipe constantly to move. which is cumbersome to say the least.

I will try to implement it by myself and will make a pull request after finishing it.

qria avatar Nov 22 '16 05:11 qria

It was a pretty simple fix since the code is very readable but I have one problem.

I've changed TKSwipeRecognizer to set TKGestureRecognizerState.RecognizedAndStillRecognizing instead of TKGestureRecognizerState.Recognized to wait for TKSwipeRecognizer.touchesEnded(), and it works, but changing the state to TKGestureRecognizerState.Recognized after the press ends fires the gestureRecognizedEvent again. So I set it to TKGestureRecognizerState.FailedOrEnded to not trigger the event again. Is this okay?

qria avatar Nov 22 '16 06:11 qria

That sounds like it will work just fine. The FailedOrEnded state is there for just such occassions.

prime31 avatar Nov 22 '16 16:11 prime31