HaxePunk/HaxePunk — pull request #297 by bendmorris (2014-05-24 23:28:04+00:00)
Title: Adding basic gesture controls for multitouch-enabled devices.

Gestures!

To use, first do this:

import com.haxepunk.utils.Gesture;

Gesture.enable();

Then you can track gestures using an API similar to other controls:

var pinching = Gesture.check(Gesture.PINCH);
var doubleTap = Gesture.pressed(Gesture.DOUBLE_TAP);
var moveFinished = Gesture.released(Gesture.MOVE);

You can get information about a touch in progress or just started/completed like this:

if (Gesture.check(Gesture.PINCH))
{
var pinch:GestureType = Gesture.get(Gesture.PINCH);
trace(pinch.magnitude) // <1 for zoom out, >1 for zoom in
trace(pinch.x + "," + pinch.y);
trace(pinch.time);
}

Currently supports the following gestures: single tap, double tap, tap and hold, tap and move, pinch to zoom in/out, and two-finger tap.