+/**
+ * @brief Parses the primary touch point by performing a hit-test if necessary
+ *
+ * @param[out] hitTestResults The hit test results are put into this variable
+ * @param[in/out] capturingTouchActorObserver The observer for the capturing touch actor member
+ * @param[in] lastRenderTask The last render task member
+ * @param[in] currentPoint The current point information
+ * @param[in] scene The scene that this touch is related to
+ */
+void ParsePrimaryTouchPoint(
+ HitTestAlgorithm::Results& hitTestResults,
+ ActorObserver& capturingTouchActorObserver,
+ const RenderTaskPtr& lastRenderTask,
+ const Integration::Point& currentPoint,
+ const Internal::Scene& scene)
+{
+ Actor* capturingTouchActor = capturingTouchActorObserver.GetActor();
+
+ // We only set the capturing touch actor when the first touch-started actor captures all touch so if it's set, just use it
+ if(capturingTouchActor && lastRenderTask)
+ {
+ hitTestResults.actor = Dali::Actor(capturingTouchActor);
+ hitTestResults.renderTask = lastRenderTask;
+ const Vector2& screenPosition = currentPoint.GetScreenPosition();
+ capturingTouchActor->ScreenToLocal(*lastRenderTask, hitTestResults.actorCoordinates.x, hitTestResults.actorCoordinates.y, screenPosition.x, screenPosition.y);
+ }
+ else
+ {
+ HitTestAlgorithm::HitTest(scene.GetSize(), scene.GetRenderTaskList(), scene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults);
+
+ if(currentPoint.GetState() == PointState::STARTED && hitTestResults.actor)
+ {
+ // If we've just started touch, then check whether the actor has requested to capture all touch events
+ Actor* hitActor = &GetImplementation(hitTestResults.actor);
+ if(hitActor->CapturesAllTouchAfterStart())
+ {
+ capturingTouchActorObserver.SetActor(hitActor);
+ }
+ }
+ }
+}
+