Add hasTouchHitTesterOfType() check
This commit is contained in:
parent
ca3488b948
commit
51ebd1c4fb
3 changed files with 31 additions and 1 deletions
|
@ -65,6 +65,19 @@ package org.gestouch.core
|
|||
|
||||
_displayListAdaptersMap[targetClass] = adapter;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Checks whether touch hit-tester of specified type is registered.
|
||||
* NB! Checks against type (class) without considering subclasses.
|
||||
*
|
||||
* @param type The touch hit-tester class
|
||||
* @return Boolean
|
||||
*/
|
||||
public static function hasTouchHitTesterOfType(type:Class):Boolean
|
||||
{
|
||||
return touchesManager.gestouch_internal::hasTouchHitTesterOfType(type);
|
||||
}
|
||||
|
||||
|
||||
public static function addTouchHitTester(hitTester:ITouchHitTester, priority:int = 0):void
|
||||
|
|
|
@ -52,7 +52,10 @@ package org.gestouch.core
|
|||
{
|
||||
Gestouch.inputAdapter = new NativeInputAdapter(stage);
|
||||
}
|
||||
Gestouch.addTouchHitTester(new NativeTouchHitTester(stage));
|
||||
if (!Gestouch.hasTouchHitTesterOfType(NativeTouchHitTester))
|
||||
{
|
||||
Gestouch.addTouchHitTester(new NativeTouchHitTester(stage));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -69,6 +69,20 @@ package org.gestouch.core
|
|||
// Sort hit testers using their priorities
|
||||
_hitTesters.sort(hitTestersSorter);
|
||||
}
|
||||
|
||||
|
||||
gestouch_internal function hasTouchHitTesterOfType(type:Class):Boolean
|
||||
{
|
||||
for each (var hitTester:ITouchHitTester in _hitTesters)
|
||||
{
|
||||
if ((hitTester as Object).constructor == type)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
gestouch_internal function removeTouchHitTester(touchHitTester:ITouchHitTester):void
|
||||
|
|
Reference in a new issue