mirror of
https://github.com/scratchfoundation/Gestouch.git
synced 2025-02-16 23:40:14 -05:00
New gesture state
This commit is contained in:
parent
4d5bef0252
commit
242966790a
2 changed files with 16 additions and 10 deletions
|
@ -5,12 +5,13 @@ package org.gestouch.core
|
|||
*/
|
||||
public class GestureState
|
||||
{
|
||||
public static const POSSIBLE:uint = 1 << 0;//1
|
||||
public static const BEGAN:uint = 1 << 1;//2
|
||||
public static const CHANGED:uint = 1 << 2;//4
|
||||
public static const ENDED:uint = 1 << 3;//8
|
||||
public static const CANCELLED:uint = 1 << 4;//16
|
||||
public static const FAILED:uint = 1 << 5;//32
|
||||
public static const RECOGNIZED:uint = 1 << 6;//64
|
||||
public static const IDLE:uint = 1 << 0;//1
|
||||
public static const POSSIBLE:uint = 1 << 1;//2
|
||||
public static const RECOGNIZED:uint = 1 << 2;//4
|
||||
public static const BEGAN:uint = 1 << 3;//8
|
||||
public static const CHANGED:uint = 1 << 4;//16
|
||||
public static const ENDED:uint = 1 << 5;//32
|
||||
public static const CANCELLED:uint = 1 << 6;//64
|
||||
public static const FAILED:uint = 1 << 7;//128
|
||||
}
|
||||
}
|
|
@ -105,7 +105,7 @@ package org.gestouch.gestures
|
|||
|
||||
_enabled = value;
|
||||
//TODO
|
||||
if (!_enabled && touchesCount > 0)
|
||||
if (!_enabled && state != GestureState.IDLE)
|
||||
{
|
||||
setState(GestureState.CANCELLED);
|
||||
reset();
|
||||
|
@ -113,7 +113,7 @@ package org.gestouch.gestures
|
|||
}
|
||||
|
||||
|
||||
protected var _state:uint = GestureState.POSSIBLE;
|
||||
protected var _state:uint = GestureState.IDLE;
|
||||
public function get state():uint
|
||||
{
|
||||
return _state;
|
||||
|
@ -184,7 +184,7 @@ package org.gestouch.gestures
|
|||
_touchesMap = {};
|
||||
_touchesCount = 0;
|
||||
|
||||
setState(GestureState.POSSIBLE);
|
||||
setState(GestureState.IDLE);
|
||||
}
|
||||
|
||||
|
||||
|
@ -396,6 +396,11 @@ package org.gestouch.gestures
|
|||
_touchesCount++;
|
||||
|
||||
onTouchBegin(touch);
|
||||
|
||||
if (_touchesCount == 1 && state == GestureState.IDLE)
|
||||
{
|
||||
setState(GestureState.POSSIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue