Revert "[Tizen] Not execute the remove callback"
[platform/core/uifw/dali-core.git] / dali / internal / event / events / gesture-processor.cpp
index 53bc5e4..1cf4b26 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -61,6 +61,11 @@ struct GestureHitTestCheck : public HitTestAlgorithm::HitTestInterface
     return layer->IsTouchConsumed();
   }
 
+  bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp) override
+  {
+    return actor->EmitHitTestResultSignal(point, hitPointLocal, timeStamp);
+  }
+
   GestureType::Value mType;
 };
 
@@ -71,6 +76,8 @@ GestureProcessor::GestureProcessor(GestureType::Value type)
   mNeedsUpdate(false),
   mType(type),
   mCurrentGesturedActor(nullptr),
+  mPoint(),
+  mEventTime(0u),
   mGesturedActorDisconnected(false)
 {
 }
@@ -84,6 +91,11 @@ void GestureProcessor::ProcessTouch(Scene& scene, const Integration::TouchEvent&
 {
   if(mGestureRecognizer)
   {
+    if(!event.points.empty())
+    {
+      mPoint     = event.points[0];
+      mEventTime = event.time;
+    }
     mGestureRecognizer->SendEvent(scene, event);
   }
 }
@@ -143,7 +155,12 @@ void GestureProcessor::ProcessAndEmit(HitTestAlgorithm::Results& hitTestResults)
         {
           // Our gesture detector's attached actor WAS the hit actor so we can can emit the signal.
           EmitGestureSignal(actor, gestureDetectors, hitTestResults.actorCoordinates);
-          break; // We have found AND emitted a signal on the gestured actor, break out.
+          // If NeedGesturePropagation is true, it passes the gesture to the parent.
+          if(!actor->NeedGesturePropagation())
+          {
+            break; // We have found AND emitted a signal on the gestured actor, break out.
+          }
+          actor->SetNeedGesturePropagation(false);
         }
         else
         {
@@ -162,7 +179,12 @@ void GestureProcessor::ProcessAndEmit(HitTestAlgorithm::Results& hitTestResults)
                 {
                   // One of the parents was the gestured actor so we can emit the signal for that actor.
                   EmitGestureSignal(actor, gestureDetectors, hitPointLocal);
-                  break; // We have found AND emitted a signal on the gestured actor, break out.
+                  // If NeedGesturePropagation is true, it passes the gesture to the parent.
+                  if(!actor->NeedGesturePropagation())
+                  {
+                    break; // We have found AND emitted a signal on the gestured actor, break out.
+                  }
+                  actor->SetNeedGesturePropagation(false);
                 }
               }
             }
@@ -182,6 +204,8 @@ void GestureProcessor::ProcessAndEmit(HitTestAlgorithm::Results& hitTestResults)
 bool GestureProcessor::HitTest(Scene& scene, Vector2 screenCoordinates, HitTestAlgorithm::Results& hitTestResults)
 {
   GestureHitTestCheck hitCheck(mType);
+  hitTestResults.point     = mPoint;
+  hitTestResults.eventTime = mEventTime;
   HitTestAlgorithm::HitTest(scene.GetSize(), scene.GetRenderTaskList(), scene.GetLayerList(), screenCoordinates, hitTestResults, hitCheck);
   return hitTestResults.renderTask && hitTestResults.actor;
 }