[GestureDetector] NeedGesturePropagation is a value that is set after the event is... 27/324627/3
authorjoogab.yun <joogab.yun@samsung.com>
Thu, 22 May 2025 01:06:58 +0000 (10:06 +0900)
committerjoogab.yun <joogab.yun@samsung.com>
Thu, 22 May 2025 04:04:01 +0000 (13:04 +0900)
Change-Id: I9c2bbc749895503103a7c5920b785a8720bf1d68

automated-tests/src/dali/utc-Dali-LongPressGestureDetector.cpp
automated-tests/src/dali/utc-Dali-PanGestureDetector.cpp
automated-tests/src/dali/utc-Dali-PinchGestureDetector.cpp
automated-tests/src/dali/utc-Dali-RotationGestureDetector.cpp
automated-tests/src/dali/utc-Dali-TapGestureDetector.cpp
dali/internal/event/events/gesture-processor.cpp

index 31262cfb0b84c2c18fb4a34a3b35a4ebedae7211..a771b56a3404e6a10a61b1f25b52922481045aa9 100644 (file)
@@ -51,6 +51,7 @@ struct SignalData
   SignalData()
   : functorCalled(false),
     voidFunctorCalled(false),
+    needGesturePropagation(false),
     receivedGesture(),
     pressedActor()
   {
@@ -60,7 +61,7 @@ struct SignalData
   {
     functorCalled     = false;
     voidFunctorCalled = false;
-
+    needGesturePropagation = false;
     receivedGesture.Reset();
 
     pressedActor.Reset();
@@ -68,6 +69,7 @@ struct SignalData
 
   bool             functorCalled;
   bool             voidFunctorCalled;
+  bool             needGesturePropagation;
   LongPressGesture receivedGesture;
   Actor            pressedActor;
 };
@@ -85,6 +87,10 @@ struct GestureReceivedFunctor
     signalData.functorCalled   = true;
     signalData.receivedGesture = longPress;
     signalData.pressedActor    = actor;
+    if (signalData.needGesturePropagation)
+    {
+      Dali::DevelActor::SetNeedGesturePropagation(actor, true);
+    }
   }
 
   void operator()()
@@ -1125,7 +1131,7 @@ int UtcDaliLongPressGestureWhenGesturePropargation(void)
   pData.Reset();
 
   // If GesturePropargation is set, a gesture event is to pass over to the parent.
-  Dali::DevelActor::SetNeedGesturePropagation(childActor, true);
+  cData.needGesturePropagation = true;
 
   // So now the parent got the gesture event.
   TestGenerateLongPress(application, 50.0f, 50.0f);
index 3c8314ccf33f59b42857134805187ecfafa41a0b..f24b8204228eebdede4ca1d3543eb914efbaca73 100644 (file)
@@ -56,6 +56,7 @@ struct SignalData
   SignalData()
   : functorCalled(false),
     voidFunctorCalled(false),
+    needGesturePropagation(false),
     receivedGesture()
   {
   }
@@ -64,7 +65,7 @@ struct SignalData
   {
     functorCalled     = false;
     voidFunctorCalled = false;
-
+    needGesturePropagation = false;
     receivedGesture.Reset();
 
     pannedActor.Reset();
@@ -72,6 +73,7 @@ struct SignalData
 
   bool       functorCalled;
   bool       voidFunctorCalled;
+  bool       needGesturePropagation;
   PanGesture receivedGesture;
   Actor      pannedActor;
 };
@@ -89,6 +91,10 @@ struct GestureReceivedFunctor
     signalData.functorCalled   = true;
     signalData.receivedGesture = pan;
     signalData.pannedActor     = actor;
+    if (signalData.needGesturePropagation)
+    {
+      Dali::DevelActor::SetNeedGesturePropagation(actor, true);
+    }
   }
 
   void operator()()
@@ -3048,7 +3054,7 @@ int UtcDaliPanGestureWhenGesturePropargation(void)
   pData.Reset();
 
   // If GesturePropargation is set, a gesture event is to pass over to the parent.
-  Dali::DevelActor::SetNeedGesturePropagation(childActor, true);
+  cData.needGesturePropagation = true;
 
   // So now the parent got the gesture event.
   TestStartPan(application, Vector2(10.0f, 20.0f), Vector2(26.0f, 20.0f), time);
index a6215f2971d08a7161590718485ee80fb55fbd3f..f17196548892a38d2ef57dc9b3d950e4296ce26b 100644 (file)
@@ -49,6 +49,7 @@ struct SignalData
   SignalData()
   : functorCalled(false),
     voidFunctorCalled(false),
+    needGesturePropagation(false),
     receivedGesture()
   {
   }
@@ -57,7 +58,7 @@ struct SignalData
   {
     functorCalled     = false;
     voidFunctorCalled = false;
-
+    needGesturePropagation = false;
     receivedGesture.Reset();
 
     pinchedActor.Reset();
@@ -65,6 +66,7 @@ struct SignalData
 
   bool         functorCalled;
   bool         voidFunctorCalled;
+  bool         needGesturePropagation;
   PinchGesture receivedGesture;
   Actor        pinchedActor;
 };
@@ -82,6 +84,10 @@ struct GestureReceivedFunctor
     signalData.functorCalled   = true;
     signalData.receivedGesture = pinch;
     signalData.pinchedActor    = actor;
+    if (signalData.needGesturePropagation)
+    {
+      Dali::DevelActor::SetNeedGesturePropagation(actor, true);
+    }
   }
 
   void operator()()
@@ -1202,7 +1208,7 @@ int UtcDaliPinchGestureWhenGesturePropargation(void)
   pData.Reset();
 
   // If GesturePropargation is set, a gesture event is to pass over to the parent.
-  Dali::DevelActor::SetNeedGesturePropagation(childActor, true);
+  cData.needGesturePropagation = true;
 
   // So now the parent got the gesture event.
   TestStartPinch(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 700);
index f474ff7d7082d8666c065c79f9cc849718ddfeb5..94a94d38b1a7509507afb8727abfe334181b9ff6 100644 (file)
@@ -49,6 +49,7 @@ struct SignalData
   SignalData()
   : functorCalled(false),
     voidFunctorCalled(false),
+    needGesturePropagation(false),
     receivedGesture()
   {
   }
@@ -57,7 +58,7 @@ struct SignalData
   {
     functorCalled     = false;
     voidFunctorCalled = false;
-
+    needGesturePropagation = false;
     receivedGesture.Reset();
 
     rotatedActor.Reset();
@@ -65,6 +66,7 @@ struct SignalData
 
   bool            functorCalled;
   bool            voidFunctorCalled;
+  bool            needGesturePropagation;
   RotationGesture receivedGesture;
   Actor           rotatedActor;
 };
@@ -82,6 +84,10 @@ struct GestureReceivedFunctor
     signalData.functorCalled   = true;
     signalData.receivedGesture = rotation;
     signalData.rotatedActor    = actor;
+    if (signalData.needGesturePropagation)
+    {
+      Dali::DevelActor::SetNeedGesturePropagation(actor, true);
+    }
   }
 
   void operator()()
@@ -1178,7 +1184,7 @@ int UtcDaliRotationGestureWhenGesturePropargation(void)
   pData.Reset();
 
   // If GesturePropargation is set, a gesture event is to pass over to the parent.
-  Dali::DevelActor::SetNeedGesturePropagation(childActor, true);
+  cData.needGesturePropagation = true;
 
   // So now the parent got the gesture event.
   TestStartRotation(application, Vector2(2.0f, 20.0f), Vector2(38.0f, 20.0f), Vector2(10.0f, 20.0f), Vector2(30.0f, 20.0f), 700);
index d09d3f6e1ee86129a3e4a642777de73983892405..927c060ae6883d906fab8d43eb63a8369ee3b89d 100644 (file)
@@ -55,7 +55,8 @@ struct SignalData
 {
   SignalData()
   : functorCalled(false),
-    voidFunctorCalled(false)
+    voidFunctorCalled(false),
+    needGesturePropagation(false)
   {
   }
 
@@ -63,7 +64,7 @@ struct SignalData
   {
     functorCalled     = false;
     voidFunctorCalled = false;
-
+    needGesturePropagation = false;
     receivedGesture.Reset();
 
     tappedActor.Reset();
@@ -71,6 +72,7 @@ struct SignalData
 
   bool       functorCalled;
   bool       voidFunctorCalled;
+  bool       needGesturePropagation;
   TapGesture receivedGesture;
   Actor      tappedActor;
 };
@@ -88,6 +90,10 @@ struct GestureReceivedFunctor
     signalData.functorCalled   = true;
     signalData.receivedGesture = tap;
     signalData.tappedActor     = actor;
+    if (signalData.needGesturePropagation)
+    {
+      Dali::DevelActor::SetNeedGesturePropagation(actor, true);
+    }
   }
 
   void operator()()
@@ -1066,7 +1072,7 @@ int UtcDaliTapGestureWhenGesturePropargation(void)
   pData.Reset();
 
   // If GesturePropargation is set, a gesture event is delivered to the parent.
-  Dali::DevelActor::SetNeedGesturePropagation(childActor, true);
+  cData.needGesturePropagation = true;
 
   // So now the parent got the gesture event.
   TestGenerateTap(application, 50.0f, 50.0f, 700);
index 4a6b247f7303a088c56563bde6e6c9659ef1d1cc..f7538c33aec6467119353be3d2ebbaa28f7b38a6 100644 (file)
@@ -152,6 +152,7 @@ void GestureProcessor::ProcessAndEmit(HitTestAlgorithm::Results& hitTestResults)
 
         if(actor == hitTestActor)
         {
+          actor->SetNeedGesturePropagation(false);
           // Our gesture detector's attached actor WAS the hit actor so we can can emit the signal.
           EmitGestureSignal(actor, gestureDetectors, hitTestResults.actorCoordinates);
           // If NeedGesturePropagation is true, it passes the gesture to the parent.
@@ -159,7 +160,6 @@ void GestureProcessor::ProcessAndEmit(HitTestAlgorithm::Results& hitTestResults)
           {
             break; // We have found AND emitted a signal on the gestured actor, break out.
           }
-          actor->SetNeedGesturePropagation(false);
         }
         else
         {
@@ -176,6 +176,7 @@ void GestureProcessor::ProcessAndEmit(HitTestAlgorithm::Results& hitTestResults)
                 float   distance(0.0f);
                 if(RayTest::ActorTest(*actor, hitTestResults.rayOrigin, hitTestResults.rayDirection, hitPointLocal, distance))
                 {
+                  actor->SetNeedGesturePropagation(false);
                   // One of the parents was the gestured actor so we can emit the signal for that actor.
                   EmitGestureSignal(actor, gestureDetectors, hitPointLocal);
                   // If NeedGesturePropagation is true, it passes the gesture to the parent.
@@ -183,7 +184,6 @@ void GestureProcessor::ProcessAndEmit(HitTestAlgorithm::Results& hitTestResults)
                   {
                     break; // We have found AND emitted a signal on the gestured actor, break out.
                   }
-                  actor->SetNeedGesturePropagation(false);
                 }
               }
             }