From 319c6a2602c833964f4b3a4decd0e374ddced69d Mon Sep 17 00:00:00 2001 From: "Shane M. Clements" Date: Mon, 21 Sep 2015 14:28:53 -0600 Subject: [PATCH] Updating target on touch release --- src/org/gestouch/core/TouchesManager.as | 32 ++++++++++++++++++++++++- src/org/gestouch/gestures/TapGesture.as | 2 +- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/org/gestouch/core/TouchesManager.as b/src/org/gestouch/core/TouchesManager.as index 28ed99f..54dc34c 100644 --- a/src/org/gestouch/core/TouchesManager.as +++ b/src/org/gestouch/core/TouchesManager.as @@ -176,7 +176,37 @@ package org.gestouch.core const touch:Touch = _touchesMap[touchID] as Touch; if (!touch) 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()); delete _touchesMap[touchID]; diff --git a/src/org/gestouch/gestures/TapGesture.as b/src/org/gestouch/gestures/TapGesture.as index b36b56c..9c8d6f3 100644 --- a/src/org/gestouch/gestures/TapGesture.as +++ b/src/org/gestouch/gestures/TapGesture.as @@ -163,7 +163,7 @@ package org.gestouch.gestures { // reset flag for the next "full press" cycle _numTouchesRequiredReached = false; - + _tapCounter++; _timer.reset();