From: joogab.yun Date: Thu, 30 Dec 2021 08:21:49 +0000 (+0900) Subject: Even if only InterceptTouchEvent is registered, it is hittable X-Git-Tag: dali_2.1.6~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6c5b858d3327f46aee2a4a9c2afc23e12f826da;hp=526704fa2ba73d9312b17b97949dda1fab5df6a4;p=platform%2Fcore%2Fuifw%2Fdali-core.git Even if only InterceptTouchEvent is registered, it is hittable Change-Id: I724c3bae0741a3ca8537e48474254c3f460deab1 --- diff --git a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp index eddbe46..26e4aa5 100644 --- a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp @@ -2087,7 +2087,38 @@ int UtcDaliTouchEventIntegNewTouchEvent(void) END_TEST; } -int UtcDaliTouchEventIntercept(void) +int UtcDaliTouchEventIntercept01(void) +{ + TestApplication application; + + Actor actor = Actor::New(); + actor.SetProperty(Actor::Property::SIZE, Vector2(100.0f, 100.0f)); + actor.SetProperty(Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT); + application.GetScene().Add(actor); + + // Render and notify + application.SendNotification(); + application.Render(); + + // Connect to actor's intercept touched signal + SignalData data; + TouchEventFunctor functor(data, false /* Do not consume */); + Dali::DevelActor::InterceptTouchedSignal(actor).Connect(&application, functor); + + // Emit a down signal + application.ProcessEvent(GenerateSingleTouch(PointState::DOWN, Vector2(10.0f, 10.0f))); + + // It should be able to receive touch events by registering only InterceptTouchEvent. + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(PointState::DOWN, data.receivedTouch.points[0].state, TEST_LOCATION); + DALI_TEST_CHECK(actor == data.receivedTouch.points[0].hitActor); + DALI_TEST_CHECK(actor == data.touchedActor); + data.Reset(); + + END_TEST; +} + +int UtcDaliTouchEventIntercept02(void) { TestApplication application; diff --git a/dali/internal/event/events/hit-test-algorithm-impl.cpp b/dali/internal/event/events/hit-test-algorithm-impl.cpp index 397f2c5..ec5cc7c 100644 --- a/dali/internal/event/events/hit-test-algorithm-impl.cpp +++ b/dali/internal/event/events/hit-test-algorithm-impl.cpp @@ -100,8 +100,8 @@ struct ActorTouchableCheck : public HitTestInterface { bool IsActorHittable(Actor* actor) override { - return (actor->GetTouchRequired() || actor->IsTouchFocusable()) && // Does the Application or derived actor type require a touch event? or focusable by touch? - actor->IsHittable(); // Is actor sensitive, visible and on the scene? + return (actor->GetTouchRequired() || actor->GetInterceptTouchRequired() || actor->IsTouchFocusable()) && // Does the Application or derived actor type require a touch event or a intercept touch event? or focusable by touch? + actor->IsHittable(); // Is actor sensitive, visible and on the scene? } bool DescendActorHierarchy(Actor* actor) override @@ -194,8 +194,8 @@ HitActor HitTestWithinLayer(Actor& actor, if(rayTest.ActorTest(actor, rayOrigin, rayDir, hitPointLocal, distance)) { // Calculate z coordinate value in Camera Space. - const Matrix& viewMatrix = renderTask.GetCameraActor()->GetViewMatrix(); - const Vector4& hitDir = Vector4(rayDir.x * distance, rayDir.y * distance, rayDir.z * distance, 0.0f); + const Matrix& viewMatrix = renderTask.GetCameraActor()->GetViewMatrix(); + const Vector4& hitDir = Vector4(rayDir.x * distance, rayDir.y * distance, rayDir.z * distance, 0.0f); const float cameraDepthDistance = (viewMatrix * hitDir).z; // Check if cameraDepthDistance is between clipping plane