From dc489ba55def4dc912d0d164f03a0cfeb6ead44a Mon Sep 17 00:00:00 2001 From: Pavel fljot Date: Thu, 20 Oct 2011 19:29:24 +0300 Subject: [PATCH] DoubleTapGesture condition refactored to get rid of code duplication --- src/org/gestouch/gestures/DoubleTapGesture.as | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/org/gestouch/gestures/DoubleTapGesture.as b/src/org/gestouch/gestures/DoubleTapGesture.as index 839e5e0..abe78f8 100644 --- a/src/org/gestouch/gestures/DoubleTapGesture.as +++ b/src/org/gestouch/gestures/DoubleTapGesture.as @@ -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)); }