Skip to content

Instantly share code, notes, and snippets.

@fljot
Created April 20, 2016 05:53
Show Gist options
  • Save fljot/616a9ce77ee415bef7fd584f5ef21789 to your computer and use it in GitHub Desktop.
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)
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