mirror of
https://github.com/scratchfoundation/Gestouch.git
synced 2024-11-23 07:47:59 -05:00
Updating target on touch release
This commit is contained in:
parent
16c24d5e29
commit
319c6a2602
2 changed files with 32 additions and 2 deletions
|
@ -177,6 +177,36 @@ package org.gestouch.core
|
||||||
if (!touch)
|
if (!touch)
|
||||||
return;// touch with specified ID isn't registered
|
return;// touch with specified ID isn't registered
|
||||||
|
|
||||||
|
var target:Object;
|
||||||
|
var altTarget:Object;
|
||||||
|
var location:Point = new Point(x, y);
|
||||||
|
for each (var hitTester:ITouchHitTester in _hitTesters)
|
||||||
|
{
|
||||||
|
target = hitTester.hitTest(location);
|
||||||
|
if (target)
|
||||||
|
{
|
||||||
|
if ((target is Stage))
|
||||||
|
{
|
||||||
|
// NB! Target is flash.display::Stage is a special case. If it is true, we want
|
||||||
|
// to give a try to a lower-priority (Stage3D) hit-testers.
|
||||||
|
altTarget = target;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// We found a target.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!target && !altTarget)
|
||||||
|
{
|
||||||
|
throw new Error("Not touch target found (hit test)." +
|
||||||
|
"Something is wrong, at least flash.display::Stage should be found." +
|
||||||
|
"See Gestouch#addTouchHitTester() and Gestouch#inputAdapter.");
|
||||||
|
}
|
||||||
|
|
||||||
|
touch.target = target || altTarget;
|
||||||
touch.updateLocation(x, y, getTimer());
|
touch.updateLocation(x, y, getTimer());
|
||||||
|
|
||||||
delete _touchesMap[touchID];
|
delete _touchesMap[touchID];
|
||||||
|
|
Loading…
Reference in a new issue