mirror of
https://github.com/scratchfoundation/Gestouch.git
synced 2024-11-30 03:05:39 -05:00
Catch all the Touch/Mouse events in capture phase
GesturesManager now captures TOUCH_BEGIN or MOUSE_DOWN from the stage in capture phase to be able to prevent their propagation at the target without affecting the gesture regoznition.
This commit is contained in:
parent
9d9fcd20ba
commit
d950550d16
1 changed files with 7 additions and 6 deletions
|
@ -182,25 +182,26 @@ package org.gestouch.core
|
||||||
|
|
||||||
if (Multitouch.supportsTouchEvents)
|
if (Multitouch.supportsTouchEvents)
|
||||||
{
|
{
|
||||||
stage.addEventListener(TouchEvent.TOUCH_BEGIN, touchBeginHandler);
|
stage.addEventListener(TouchEvent.TOUCH_BEGIN, touchBeginHandler, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
|
stage.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function installStageListeners():void
|
protected function installStageListeners():void
|
||||||
{
|
{
|
||||||
|
//TODO: maximum priority to prevent event hijacking?
|
||||||
if (Multitouch.supportsTouchEvents)
|
if (Multitouch.supportsTouchEvents)
|
||||||
{
|
{
|
||||||
_stage.addEventListener(TouchEvent.TOUCH_MOVE, touchMoveHandler);
|
_stage.addEventListener(TouchEvent.TOUCH_MOVE, touchMoveHandler, true);
|
||||||
_stage.addEventListener(TouchEvent.TOUCH_END, touchEndHandler, true);
|
_stage.addEventListener(TouchEvent.TOUCH_END, touchEndHandler, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
|
_stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, true);
|
||||||
_stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true);
|
_stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,12 +211,12 @@ package org.gestouch.core
|
||||||
{
|
{
|
||||||
if (Multitouch.supportsTouchEvents)
|
if (Multitouch.supportsTouchEvents)
|
||||||
{
|
{
|
||||||
_stage.removeEventListener(TouchEvent.TOUCH_MOVE, touchMoveHandler);
|
_stage.removeEventListener(TouchEvent.TOUCH_MOVE, touchMoveHandler, true);
|
||||||
_stage.removeEventListener(TouchEvent.TOUCH_END, touchEndHandler, true);
|
_stage.removeEventListener(TouchEvent.TOUCH_END, touchEndHandler, true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
|
_stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler, true);
|
||||||
_stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true);
|
_stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue