Fixed initial offset calculation for PanGesture

This commit is contained in:
Pavel fljot 2012-04-02 17:17:48 +03:00
parent 696b6367f2
commit 62fa492d66

View file

@ -136,6 +136,10 @@ package org.gestouch.gestures
if (state == GestureState.POSSIBLE) if (state == GestureState.POSSIBLE)
{ {
prevLocationX = _location.x;
prevLocationY = _location.y;
updateLocation();
// Check if finger moved enough for gesture to be recognized // Check if finger moved enough for gesture to be recognized
var locationOffset:Point = touch.locationOffset; var locationOffset:Point = touch.locationOffset;
if (direction == PanGestureDirection.VERTICAL) if (direction == PanGestureDirection.VERTICAL)
@ -149,9 +153,6 @@ package org.gestouch.gestures
if (locationOffset.length > slop || slop != slop)//faster isNaN(slop) if (locationOffset.length > slop || slop != slop)//faster isNaN(slop)
{ {
prevLocationX = _location.x;
prevLocationY = _location.y;
updateLocation();
offsetX = _location.x - prevLocationX; offsetX = _location.x - prevLocationX;
offsetY = _location.y - prevLocationY; offsetY = _location.y - prevLocationY;
// acummulate begin offsets for the case when this gesture recognition is delayed by requireGestureToFail // acummulate begin offsets for the case when this gesture recognition is delayed by requireGestureToFail