Created
April 20, 2016 05:53
-
-
Save fljot/616a9ce77ee415bef7fd584f5ef21789 to your computer and use it in GitHub Desktop.
StarlingTouchHitTester for Starling 2 (Starling Framework http://gamua.com/starling/ https://github.com/Gamua/Starling-Framework)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package org.gestouch.extensions.starling | |
{ | |
import flash.geom.Point; | |
import org.gestouch.core.ITouchHitTester; | |
import starling.core.Starling; | |
import starling.display.DisplayObject; | |
/** | |
* @author Pavel fljot | |
*/ | |
public class Starling2TouchHitTester implements ITouchHitTester | |
{ | |
public function hitTest(point:Point, possibleTarget:Object = null):Object | |
{ | |
if (possibleTarget && possibleTarget is starling.display.DisplayObject) | |
{ | |
return possibleTarget; | |
} | |
var currStarling:Starling = Starling.current; | |
if (!currStarling) | |
{ | |
return null; | |
} | |
point = StarlingUtils.adjustGlobalPoint(currStarling, point); | |
return currStarling.stage.hitTest(point) || currStarling.nativeStage; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment