mirror of
https://github.com/scratchfoundation/Gestouch.git
synced 2025-03-22 10:15:17 -04:00
Fixed touch/mouse event handling condition in StarlingInputAdapter
This commit is contained in:
parent
86439e7627
commit
0adfac4c5d
1 changed files with 7 additions and 12 deletions
|
@ -1,12 +1,14 @@
|
|||
package org.gestouch.extensions.starling
|
||||
{
|
||||
import starling.core.Starling;
|
||||
|
||||
import org.gestouch.input.AbstractInputAdapter;
|
||||
|
||||
import flash.events.EventPhase;
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.TouchEvent;
|
||||
import flash.geom.Point;
|
||||
import flash.ui.Mouse;
|
||||
import org.gestouch.input.AbstractInputAdapter;
|
||||
import starling.core.Starling;
|
||||
import flash.ui.Multitouch;
|
||||
|
||||
|
||||
|
||||
|
@ -33,19 +35,12 @@ package org.gestouch.extensions.starling
|
|||
}
|
||||
|
||||
|
||||
protected function get supportsTouchEvents():Boolean
|
||||
{
|
||||
// just like in Starling (starling.core::Starling)
|
||||
return !(Mouse.supportsCursor || !Starling.multitouchEnabled);
|
||||
}
|
||||
|
||||
|
||||
override public function init():void
|
||||
{
|
||||
// We want to begin tracking only those touches that happen on Stage3D layer,
|
||||
// e.g. event.target == nativeStage. That's we don't listen for touch begin
|
||||
// in capture phase (as we do for native display list).
|
||||
if (supportsTouchEvents)
|
||||
if (Multitouch.supportsTouchEvents)
|
||||
{
|
||||
_starling.nativeStage.addEventListener(TouchEvent.TOUCH_BEGIN, touchBeginHandler);
|
||||
}
|
||||
|
@ -70,7 +65,7 @@ package org.gestouch.extensions.starling
|
|||
protected function installStageListeners():void
|
||||
{
|
||||
// Maximum priority to prevent event hijacking
|
||||
if (supportsTouchEvents)
|
||||
if (Multitouch.supportsTouchEvents)
|
||||
{
|
||||
_starling.nativeStage.addEventListener(TouchEvent.TOUCH_MOVE, touchMoveHandler, true, int.MAX_VALUE);
|
||||
_starling.nativeStage.addEventListener(TouchEvent.TOUCH_MOVE, touchMoveHandler, false, int.MAX_VALUE);
|
||||
|
|
Loading…
Reference in a new issue