From: joogab.yun Date: Wed, 22 May 2024 05:07:38 +0000 (+0900) Subject: [Tizen] Even when multi-touching, the captured actor is used without a hittest every... X-Git-Tag: accepted/tizen/8.0/unified/20240612.161755~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d78a0d56280a84296f11db832d546ff5270040d;p=platform%2Fcore%2Fuifw%2Fdali-core.git [Tizen] Even when multi-touching, the captured actor is used without a hittest every time. Change-Id: Ib934b4b5626747a9ed7036d7489f82c94e7b4b16 --- diff --git a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp index 23d1081..8b68383 100644 --- a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp @@ -267,6 +267,26 @@ Integration::TouchEvent GenerateSingleTouch(PointState::Type state, const Vector return touchEvent; } +Integration::TouchEvent GenerateDoubleTouch(PointState::Type stateA, const Vector2& screenPositionA, PointState::Type stateB, const Vector2& screenPositionB, uint32_t time) +{ + Integration::TouchEvent touchEvent; + Integration::Point point; + point.SetState(stateA); + point.SetDeviceId(4); + point.SetScreenPosition(screenPositionA); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); + point.SetScreenPosition(screenPositionB); + point.SetState(stateB); + point.SetDeviceId(7); + point.SetDeviceClass(Device::Class::TOUCH); + point.SetDeviceSubclass(Device::Subclass::NONE); + touchEvent.points.push_back(point); + touchEvent.time = time; + return touchEvent; +} + } // namespace /////////////////////////////////////////////////////////////////////////////// @@ -2108,6 +2128,46 @@ int UtcDaliTouchEventCapturePropertySet(void) END_TEST; } +int UtcDaliTouchEventCapturePropertySetWithMultiTouch(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 touched signal + SignalData data; + TouchEventFunctor functor(data); + actor.TouchedSignal().Connect(&application, functor); + + // Now set the capture property + actor.SetProperty(DevelActor::Property::CAPTURE_ALL_TOUCH_AFTER_START, true); + + // Emit a down signal + application.ProcessEvent(GenerateDoubleTouch(PointState::STARTED, Vector2(10.0f, 10.0f), PointState::STARTED, Vector2(15.0f, 15.0f), 200)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + data.Reset(); + + // Now motion outside of actor, we now SHOULD receive the event + application.ProcessEvent(GenerateDoubleTouch(PointState::MOTION, Vector2(110.0f, 110.0f), PointState::MOTION, Vector2(115.0f, 115.0f), 210)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + data.Reset(); + + // Up event, we should receive it again, but as ended rather than interrupted + application.ProcessEvent(GenerateDoubleTouch(PointState::FINISHED, Vector2(110.0f, 110.0f), PointState::FINISHED, Vector2(115.0f, 115.0f), 220)); + DALI_TEST_EQUALS(true, data.functorCalled, TEST_LOCATION); + DALI_TEST_EQUALS(data.receivedTouch.GetPoint(0).state, PointState::FINISHED, TEST_LOCATION); + DALI_TEST_EQUALS(data.receivedTouch.GetPoint(1).state, PointState::FINISHED, TEST_LOCATION); + + END_TEST; +} + int UtcDaliTouchEventIntegNewTouchEvent(void) { uint32_t timestamp = 92858u; diff --git a/dali/internal/event/events/touch-event-processor.cpp b/dali/internal/event/events/touch-event-processor.cpp index 5b27902..0c35355 100644 --- a/dali/internal/event/events/touch-event-processor.cpp +++ b/dali/internal/event/events/touch-event-processor.cpp @@ -880,7 +880,18 @@ bool TouchEventProcessor::ProcessTouchEvent(const Integration::TouchEvent& event } else { - HitTestAlgorithm::HitTest(mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, nullptr, localVars.isGeometry); + Actor* capturingTouchActor = mCapturingTouchActor.GetActor(); + if(capturingTouchActor && mLastRenderTask) + { + hitTestResults.actor = Dali::Actor(capturingTouchActor); + hitTestResults.renderTask = mLastRenderTask; + const Vector2& screenPosition = currentPoint.GetScreenPosition(); + capturingTouchActor->ScreenToLocal(*mLastRenderTask, hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y, screenPosition.x, screenPosition.y); + } + else + { + HitTestAlgorithm::HitTest(mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, nullptr, localVars.isGeometry); + } } Integration::Point newPoint(currentPoint);