DoubleTapGesture condition refactored

to get rid of code duplication
This commit is contained in:
Pavel fljot 2011-10-20 19:29:24 +03:00
parent 3e74d2883a
commit dc489ba55d

View file

@ -170,17 +170,9 @@ package org.gestouch.gestures
{
// double tap combo recognized
if (moveThreshold > 0)
{
if (_lastCentralPoint.subtract(_prevCentralPoint).length < moveThreshold)
{
_reset();
_dispatch(new DoubleTapGestureEvent(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, true, false, GesturePhase.ALL, _lastLocalCentralPoint.x, _lastLocalCentralPoint.y));
}
}
else
if ((moveThreshold > 0 && _lastCentralPoint.subtract(_prevCentralPoint).length < moveThreshold)
|| isNaN(moveThreshold) || moveThreshold <= 0)
{
// no moveThreshold defined
_reset();
_dispatch(new DoubleTapGestureEvent(DoubleTapGestureEvent.GESTURE_DOUBLE_TAP, true, false, GesturePhase.ALL, _lastLocalCentralPoint.x, _lastLocalCentralPoint.y));
}