Permalink
Browse files

Refactor dirty gestures reset

  • Loading branch information...
1 parent eab6cb4 commit 7278e863d46d69756970f9b9f3fa26e6234a7d2d @fljot committed Jul 20, 2012
Showing with 4 additions and 19 deletions.
  1. +4 −19 src/org/gestouch/core/GesturesManager.as
@@ -53,7 +53,7 @@ package org.gestouch.core
protected function resetDirtyGestures():void
{
- for (var gesture:* in _dirtyGesturesMap)
+ for (var gesture:Object in _dirtyGesturesMap)
{
(gesture as Gesture).reset();
}
@@ -193,11 +193,6 @@ package org.gestouch.core
gestouch_internal function onTouchBegin(touch:Touch):void
{
- if (_dirtyGesturesCount > 0)
- {
- resetDirtyGestures();
- }
-
var gesture:Gesture;
var i:uint;
@@ -261,7 +256,7 @@ package org.gestouch.core
{
gesture = gesturesForTouch[i];
// Check for state because previous (i+1) gesture may already abort current (i) one
- if (gesture.state != GestureState.FAILED)
+ if (!_dirtyGesturesMap[gesture])
{
gesture.touchBeginHandler(touch);
}
@@ -275,19 +270,14 @@ package org.gestouch.core
gestouch_internal function onTouchMove(touch:Touch):void
{
- if (_dirtyGesturesCount > 0)
- {
- resetDirtyGestures();
- }
-
var gesturesForTouch:Vector.<Gesture> = _gesturesForTouchMap[touch] as Vector.<Gesture>;
var gesture:Gesture;
var i:int = gesturesForTouch.length;
while (i-- > 0)
{
gesture = gesturesForTouch[i];
- if (gesture.state != GestureState.FAILED && gesture.isTrackingTouch(touch.id))
+ if (!_dirtyGesturesMap[gesture] && gesture.isTrackingTouch(touch.id))
{
gesture.touchMoveHandler(touch);
}
@@ -302,19 +292,14 @@ package org.gestouch.core
gestouch_internal function onTouchEnd(touch:Touch):void
{
- if (_dirtyGesturesCount > 0)
- {
- resetDirtyGestures();
- }
-
var gesturesForTouch:Vector.<Gesture> = _gesturesForTouchMap[touch] as Vector.<Gesture>;
var gesture:Gesture;
var i:int = gesturesForTouch.length;
while (i-- > 0)
{
gesture = gesturesForTouch[i];
- if (gesture.state != GestureState.FAILED && gesture.isTrackingTouch(touch.id))
+ if (!_dirtyGesturesMap[gesture] && gesture.isTrackingTouch(touch.id))
{
gesture.touchEndHandler(touch);
}

0 comments on commit 7278e86

Please sign in to comment.