Skip to content

Commit 2429667

Browse files
committed
New gesture state
1 parent 4d5bef0 commit 2429667

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

src/org/gestouch/core/GestureState.as

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,13 @@ package org.gestouch.core
55
*/
66
public class GestureState
77
{
8-
public static const POSSIBLE:uint = 1 << 0;//1
9-
public static const BEGAN:uint = 1 << 1;//2
10-
public static const CHANGED:uint = 1 << 2;//4
11-
public static const ENDED:uint = 1 << 3;//8
12-
public static const CANCELLED:uint = 1 << 4;//16
13-
public static const FAILED:uint = 1 << 5;//32
14-
public static const RECOGNIZED:uint = 1 << 6;//64
8+
public static const IDLE:uint = 1 << 0;//1
9+
public static const POSSIBLE:uint = 1 << 1;//2
10+
public static const RECOGNIZED:uint = 1 << 2;//4
11+
public static const BEGAN:uint = 1 << 3;//8
12+
public static const CHANGED:uint = 1 << 4;//16
13+
public static const ENDED:uint = 1 << 5;//32
14+
public static const CANCELLED:uint = 1 << 6;//64
15+
public static const FAILED:uint = 1 << 7;//128
1516
}
1617
}

src/org/gestouch/gestures/Gesture.as

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,15 +105,15 @@ package org.gestouch.gestures
105105

106106
_enabled = value;
107107
//TODO
108-
if (!_enabled && touchesCount > 0)
108+
if (!_enabled && state != GestureState.IDLE)
109109
{
110110
setState(GestureState.CANCELLED);
111111
reset();
112112
}
113113
}
114114

115115

116-
protected var _state:uint = GestureState.POSSIBLE;
116+
protected var _state:uint = GestureState.IDLE;
117117
public function get state():uint
118118
{
119119
return _state;
@@ -184,7 +184,7 @@ package org.gestouch.gestures
184184
_touchesMap = {};
185185
_touchesCount = 0;
186186

187-
setState(GestureState.POSSIBLE);
187+
setState(GestureState.IDLE);
188188
}
189189

190190

@@ -396,6 +396,11 @@ package org.gestouch.gestures
396396
_touchesCount++;
397397

398398
onTouchBegin(touch);
399+
400+
if (_touchesCount == 1 && state == GestureState.IDLE)
401+
{
402+
setState(GestureState.POSSIBLE);
403+
}
399404
}
400405

401406

0 commit comments

Comments
 (0)