Add gesture recognizers - pinching, panning, swiping, rotating, long press

Hi all!

I’ve recently been looking around for a pinch gesture recognizer. It seems there are some existing contributions from other Corona developers (thank you!), but they can be buggy and it takes time to figure out how to integrate them as well as adding their library code.

It would be GREAT if Corona would provide APIs for common gestures:

* Pinching in and out (for zooming a view) 
* Panning or dragging 
* Swiping (in any direction) 
* Rotating (fingers moving in opposite directions) 
* Long press (also known as “touch and hold”) 
* Tapping (any number of taps)

 

This type of input recognition is exactly the type of thing that should be in the SDK. From what I’ve seen poking around the forums, each developer is having to reinvent the wheel trying to bake their own implementations with varying degrees of success. It’s a shame we have to bungle around trying to cook up our own gesture recognizers.

 

Corona, if you guys put this in you could claim 15x faster app development.

 

Here’s a link to the feature suggestion if you care to vote: http://feedback.coronalabs.com/forums/188732-corona-sdk-feature-requests-feedback/suggestions/6306349-add-gesture-recognizers-pinching-panning-swipi

All of the above aren’t crazy hard to implement on your own:

There’s already a tutorial for pinch-zoom-rotate on the Corona blog, so that’s handled. Swiping it super easy, as it’s just dragging without an object. A long press is easily handled with a timer in your touch listener, and there is already a tap API. 

Maybe you can let us know which of these are giving you the most trouble, and we can help with possible solutions?

I was trying to do a pinch/zoom and finally got it working. I think it would save developers a lot of time if gesture recognizers were part of the Corona API and everyone didn’t have to try to cook their own up.

I have to agree, implementing handlers to deal with pinch and zoom seems unnecessarily painful. I appreciate there is a tutorial to do it, but I suspect this is going to take a few hours to implement which could have been spent doing more worthwhile stuff.

All of the above aren’t crazy hard to implement on your own:

There’s already a tutorial for pinch-zoom-rotate on the Corona blog, so that’s handled. Swiping it super easy, as it’s just dragging without an object. A long press is easily handled with a timer in your touch listener, and there is already a tap API. 

Maybe you can let us know which of these are giving you the most trouble, and we can help with possible solutions?

I was trying to do a pinch/zoom and finally got it working. I think it would save developers a lot of time if gesture recognizers were part of the Corona API and everyone didn’t have to try to cook their own up.

I have to agree, implementing handlers to deal with pinch and zoom seems unnecessarily painful. I appreciate there is a tutorial to do it, but I suspect this is going to take a few hours to implement which could have been spent doing more worthwhile stuff.

hey all,

i have been working on a gesture recognizer library and used the iOS Gesture Recognizer API as a guideline.

currently the available gestures are: Tap, Pan, Scale. of course, the others are on their way. :stuck_out_tongue:

Here’s some code from one of the available examples, showing several gestures “stacked” on the same view:
 

pan = Gesture.newPanGesture( view, { touches=2, id="2 pan" } ) pan:addEventListener( pan.EVENT, gestureEvent\_handler ) pan = Gesture.newPanGesture( view, { touches=3, id="3 pan" } ) pan:addEventListener( pan.EVENT, gestureEvent\_handler ) tap = Gesture.newTapGesture( view, { id="1 tch 1 tap" } ) tap:addEventListener( tap.EVENT, gestureEvent\_handler ) tap = Gesture.newTapGesture( view, { touches=2, taps=2, id="2 tch 2 tap" } ) tap:addEventListener( tap.EVENT, gestureEvent\_handler )

code, docs/api, examples can be found at the following:

* https://github.com/dmccuskey/dmc-gestures
* http://docs.davidmccuskey.com/dmc-gestures

testers are welcomed ! :slight_smile:

cheers, dmc

hey all,

i have been working on a gesture recognizer library and used the iOS Gesture Recognizer API as a guideline.

currently the available gestures are: Tap, Pan, Scale. of course, the others are on their way. :stuck_out_tongue:

Here’s some code from one of the available examples, showing several gestures “stacked” on the same view:
 

pan = Gesture.newPanGesture( view, { touches=2, id="2 pan" } ) pan:addEventListener( pan.EVENT, gestureEvent\_handler ) pan = Gesture.newPanGesture( view, { touches=3, id="3 pan" } ) pan:addEventListener( pan.EVENT, gestureEvent\_handler ) tap = Gesture.newTapGesture( view, { id="1 tch 1 tap" } ) tap:addEventListener( tap.EVENT, gestureEvent\_handler ) tap = Gesture.newTapGesture( view, { touches=2, taps=2, id="2 tch 2 tap" } ) tap:addEventListener( tap.EVENT, gestureEvent\_handler )

code, docs/api, examples can be found at the following:

* https://github.com/dmccuskey/dmc-gestures
* http://docs.davidmccuskey.com/dmc-gestures

testers are welcomed ! :slight_smile:

cheers, dmc