PARENT events are propagated to parents in the traditional way.
GEOMETRY is a new way in which events are propagated based on geometry.
Change-Id: I3a717d5433e73f22e835ed3e6cd384a337160688
// Perform a hit-test at the given screen coordinates
Dali::HitTestAlgorithm::Results results;
- Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction, true);
+ Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor != actor);
actor.SetProperty(Actor::Property::NAME, "HittableActor");
results.actorCoordinates = Vector2::ZERO;
// Perform a hit-test at the given screen coordinates
- Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction, true);
+ Dali::HitTestAlgorithm::HitTest(stage, screenCoordinates, results, IsActorHittableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == actor);
DALI_TEST_EQUALS(localCoordinates, results.actorCoordinates, 0.1f, TEST_LOCATION);
END_TEST;
application.Render(10);
HitTestAlgorithm::Results results;
- HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == green);
DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 1.0f / 6.0f, TEST_LOCATION);
- HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == blue);
DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION);
- HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == green);
DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION);
END_TEST;
{
HitTestAlgorithm::Results results;
- HitTest(stage, Vector2(240.0f, 400.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(240.0f, 400.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == green);
DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.6f, 0.01f, TEST_LOCATION);
}
{
HitTestAlgorithm::Results results;
- HitTest(stage, Vector2(0.001f, 0.001f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(0.001f, 0.001f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == blue);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(0.001f, 0.001f), 0.001f, TEST_LOCATION);
}
{
HitTestAlgorithm::Results results;
- HitTest(stage, stageSize, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(!results.actor);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2::ZERO, TEST_LOCATION);
}
// Just inside green
{
HitTestAlgorithm::Results results;
- HitTest(stage, stageSize * 0.69f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize * 0.69f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == green);
DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.98f, 0.01f, TEST_LOCATION);
}
// Hit within clippingActor and childActor.
HitTestAlgorithm::Results results;
- HitTest(stage, Vector2(10.0f, 10.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(10.0f, 10.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == childActor);
tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty<std::string>(Actor::Property::NAME).c_str() : "NULL"));
// Hit within childActor but outside of clippingActor, should hit the root-layer instead.
- HitTest(stage, Vector2(60.0f, 60.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(60.0f, 60.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == rootLayer);
tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty<std::string>(Actor::Property::NAME).c_str() : "NULL"));
// Hit within clippingActor and latestActor.
HitTestAlgorithm::Results results;
- HitTest(stage, Vector2(201.0f, 201.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(201.0f, 201.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty<std::string>(Actor::Property::NAME).c_str() : "NULL"));
DALI_TEST_CHECK(results.actor == latestActor);
// Hit within childActor but outside of clippingActor, should hit the root-layer instead.
- HitTest(stage, Vector2(221.0f, 221.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(221.0f, 221.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("Hit: %s\n", (results.actor ? results.actor.GetProperty<std::string>(Actor::Property::NAME).c_str() : "NULL"));
DALI_TEST_CHECK(results.actor == rootLayer);
HitTestAlgorithm::Results results;
//Hit in the intersection. Should pick the blue actor since it is an overlay.
- HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == blue);
DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 5.0f / 6.0f, TEST_LOCATION);
//Hit in the blue actor
- HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == blue);
DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION);
//Hit in the green actor
- HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize * 2.0f / 3.0f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == green);
DALI_TEST_EQUALS(results.actorCoordinates, actorSize * 0.5f, TEST_LOCATION);
application.Render(10);
//Hit in the intersection red, green, blue. Should pick the red actor since it is an child of overlay.
- HitTest(stage, Vector2(stageSize.x * 13.0f / 24.0f, stageSize.y * 11.0f / 24.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(stageSize.x * 13.0f / 24.0f, stageSize.y * 11.0f / 24.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("%d %d %d , %f %f\n", results.actor == red ? 1 : 0, results.actor == green ? 1 : 0, results.actor == blue ? 1 : 0, results.actorCoordinates.x, results.actorCoordinates.y);
DALI_TEST_CHECK(results.actor == red);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(actorSize.x * 1.0f / 12.0f, actorSize.y * 11.0f / 12.0f), TEST_LOCATION);
//Hit in the intersection red, blue. Should pick the red actor since it is an child of blue.
- HitTest(stage, Vector2(stageSize.x * 13.0f / 24.0f, stageSize.y * 9.0f / 24.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(stageSize.x * 13.0f / 24.0f, stageSize.y * 9.0f / 24.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("%d %d %d , %f %f\n", results.actor == red ? 1 : 0, results.actor == green ? 1 : 0, results.actor == blue ? 1 : 0, results.actorCoordinates.x, results.actorCoordinates.y);
DALI_TEST_CHECK(results.actor == red);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(actorSize.x * 1.0f / 12.0f, actorSize.y * 9.0f / 12.0f), TEST_LOCATION);
//Hit in the intersection red, green. Should pick the red actor since it is an child of overlay.
- HitTest(stage, Vector2(stageSize.x * 15.0f / 24.0f, stageSize.y * 11.0f / 24.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(stageSize.x * 15.0f / 24.0f, stageSize.y * 11.0f / 24.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("%d %d %d , %f %f\n", results.actor == red ? 1 : 0, results.actor == green ? 1 : 0, results.actor == blue ? 1 : 0, results.actorCoordinates.x, results.actorCoordinates.y);
DALI_TEST_CHECK(results.actor == red);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(actorSize.x * 3.0f / 12.0f, actorSize.y * 11.0f / 12.0f), TEST_LOCATION);
//Hit in the intersection blue, green. Should pick the blue actor since it is an overlay.
- HitTest(stage, Vector2(stageSize.x * 11.0f / 24.0f, stageSize.y * 13.0f / 24.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(stageSize.x * 11.0f / 24.0f, stageSize.y * 13.0f / 24.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("%d %d %d , %f %f\n", results.actor == red ? 1 : 0, results.actor == green ? 1 : 0, results.actor == blue ? 1 : 0, results.actorCoordinates.x, results.actorCoordinates.y);
DALI_TEST_CHECK(results.actor == blue);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(actorSize.x * 9.0f / 12.0f, actorSize.y * 11.0f / 12.0f), TEST_LOCATION);
application.Render(10);
//Hit in the intersection red, green, blue. Should pick the green actor since it is latest ordered actor.
- HitTest(stage, Vector2(stageSize.x * 13.0f / 24.0f, stageSize.y * 11.0f / 24.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(stageSize.x * 13.0f / 24.0f, stageSize.y * 11.0f / 24.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("%d %d %d , %f %f\n", results.actor == red ? 1 : 0, results.actor == green ? 1 : 0, results.actor == blue ? 1 : 0, results.actorCoordinates.x, results.actorCoordinates.y);
DALI_TEST_CHECK(results.actor == green);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(actorSize.x * 3.0f / 12.0f, actorSize.y * 1.0f / 12.0f), TEST_LOCATION);
//Hit in the intersection red, blue. Should pick the red actor since it is an child of blue.
- HitTest(stage, Vector2(stageSize.x * 13.0f / 24.0f, stageSize.y * 9.0f / 24.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(stageSize.x * 13.0f / 24.0f, stageSize.y * 9.0f / 24.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("%d %d %d , %f %f\n", results.actor == red ? 1 : 0, results.actor == green ? 1 : 0, results.actor == blue ? 1 : 0, results.actorCoordinates.x, results.actorCoordinates.y);
DALI_TEST_CHECK(results.actor == red);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(actorSize.x * 1.0f / 12.0f, actorSize.y * 9.0f / 12.0f), TEST_LOCATION);
//Hit in the intersection red, green. Should pick the green actor since it is latest ordered actor.
- HitTest(stage, Vector2(stageSize.x * 15.0f / 24.0f, stageSize.y * 11.0f / 24.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(stageSize.x * 15.0f / 24.0f, stageSize.y * 11.0f / 24.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("%d %d %d , %f %f\n", results.actor == red ? 1 : 0, results.actor == green ? 1 : 0, results.actor == blue ? 1 : 0, results.actorCoordinates.x, results.actorCoordinates.y);
DALI_TEST_CHECK(results.actor == green);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(actorSize.x * 5.0f / 12.0f, actorSize.y * 1.0f / 12.0f), TEST_LOCATION);
//Hit in the intersection blue, green. Should pick the green actor since it is latest ordered actor.
- HitTest(stage, Vector2(stageSize.x * 11.0f / 24.0f, stageSize.y * 13.0f / 24.0f), results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, Vector2(stageSize.x * 11.0f / 24.0f, stageSize.y * 13.0f / 24.0f), results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
tet_printf("%d %d %d , %f %f\n", results.actor == red ? 1 : 0, results.actor == green ? 1 : 0, results.actor == blue ? 1 : 0, results.actorCoordinates.x, results.actorCoordinates.y);
DALI_TEST_CHECK(results.actor == green);
DALI_TEST_EQUALS(results.actorCoordinates, Vector2(actorSize.x * 1.0f / 12.0f, actorSize.y * 3.0f / 12.0f), TEST_LOCATION);
application.Render(10);
HitTestAlgorithm::Results results;
- HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == green);
END_TEST;
application.Render(10);
HitTestAlgorithm::Results results;
- HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction, true);
+ HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction, Integration::Scene::TouchPropagationType::GEOMETRY);
DALI_TEST_CHECK(results.actor == green);
END_TEST;
TestApplication application;
Dali::Integration::Scene scene = application.GetScene();
DALI_TEST_EQUALS(scene.IsGeometryHittestEnabled(), false, TEST_LOCATION);
+ DALI_TEST_EQUALS(scene.GetTouchPropagationType(), Dali::Integration::Scene::TouchPropagationType::PARENT, TEST_LOCATION);
TouchedSignalData data;
TouchFunctor functor(data);
scene.SetGeometryHittestEnabled(true);
DALI_TEST_EQUALS(scene.IsGeometryHittestEnabled(), true, TEST_LOCATION);
+ DALI_TEST_EQUALS(scene.GetTouchPropagationType(), Dali::Integration::Scene::TouchPropagationType::GEOMETRY, TEST_LOCATION);
{
GenerateTouch(application, PointState::DOWN, Vector2(10.0f, 10.0f));
{
namespace HitTestAlgorithm
{
-bool HitTest(Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func, bool isGeometry)
+bool HitTest(Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func, const Integration::Scene::TouchPropagationType propagationType)
{
Internal::Stage& stageImpl = GetImplementation(stage);
- return Internal::HitTestAlgorithm::HitTest(stageImpl.GetSize(), stageImpl.GetRenderTaskList(), stageImpl.GetLayerList(), screenCoordinates, results, func, isGeometry);
+ return Internal::HitTestAlgorithm::HitTest(stageImpl.GetSize(), stageImpl.GetRenderTaskList(), stageImpl.GetLayerList(), screenCoordinates, results, func, propagationType);
}
bool BuildPickingRay(RenderTask renderTask, const Vector2& screenCoordinates, Vector3& origin, Vector3& direction)
* @param[in] screenCoordinates The screen coordinates.
* @param[out] results The results of the hit-test, only modified if something is hit
* @param[in] func The function to use in the hit-test algorithm.
- * @param[in] isGeometry If true, hittest works in a geometry way.
+ * @param[in] propagationType If Integration::Scene::TouchPropagationType::GEOMETRY, hittest works in a geometry way.
* @return true if something was hit
*/
-DALI_CORE_API bool HitTest(Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func, bool isGeometry = false);
+DALI_CORE_API bool HitTest(Stage stage, const Vector2& screenCoordinates, Results& results, HitTestFunction func, const Integration::Scene::TouchPropagationType propagationType = Integration::Scene::TouchPropagationType::PARENT);
/**
* @brief Given screen coordinates, this method returns the camera origin in world coordinates and the direction of the picking ray in world-space.
return GetImplementation(*this).IsGeometryHittestEnabled();
}
+Scene::TouchPropagationType Scene::GetTouchPropagationType()
+{
+ return GetImplementation(*this).GetTouchPropagationType();
+}
+
void Scene::SetNativeId(int32_t nativeId)
{
return GetImplementation(*this).SetNativeId(nativeId);
*/
class DALI_CORE_API Scene : public BaseHandle
{
+
public:
+
+ /**
+ * @brief Touch event propagation way
+ */
+ enum TouchPropagationType
+ {
+ PARENT, ///< events are propagated to parents in the traditional way
+ GEOMETRY ///< events are propagated based on geometry.
+ };
+
using EventProcessingFinishedSignalType = Signal<void()>; ///< Event Processing finished signal type
using KeyEventSignalType = Signal<void(const Dali::KeyEvent&)>; ///< Key event signal type
using KeyEventGeneratedSignalType = Signal<bool(const Dali::KeyEvent&)>; ///< key event generated signal type
bool IsGeometryHittestEnabled();
/**
+ * @brief Get the Touch Propagation Type
+ *
+ * @return TouchPropagationType
+ */
+ TouchPropagationType GetTouchPropagationType();
+
+ /**
* @brief Sets the native window id
*
* @param nativeId The native window id
return mGeometryHittest;
}
+Dali::Integration::Scene::TouchPropagationType Scene::GetTouchPropagationType() const
+{
+ return mGeometryHittest ? Dali::Integration::Scene::TouchPropagationType::GEOMETRY : Dali::Integration::Scene::TouchPropagationType::PARENT;
+}
+
void Scene::SetNativeId(int32_t nativeId)
{
mNativeId = nativeId;
bool IsGeometryHittestEnabled() const;
/**
+ * @copydoc Dali::Integration::Scene::GetTouchPropagationType
+ */
+ Dali::Integration::Scene::TouchPropagationType GetTouchPropagationType() const;
+
+ /**
* @copydoc Dali::Integration::Scene::SetNativeId
*/
void SetNativeId(int32_t nativeId);
{
Integration::TouchEvent& touchEvent = static_cast<Integration::TouchEvent&>(*event);
- if(mScene.IsGeometryHittestEnabled())
+ if(mScene.GetTouchPropagationType() == Integration::Scene::TouchPropagationType::GEOMETRY)
{
DALI_ASSERT_ALWAYS(!touchEvent.points.empty() && "Empty TouchEvent sent from Integration\n");
hitTestResults.point = touchEvent.GetPoint(i);
hitTestResults.eventTime = touchEvent.time;
- HitTestAlgorithm::HitTest(mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), touchEvent.GetPoint(i).GetScreenPosition(), hitTestResults, nullptr, false);
+ HitTestAlgorithm::HitTest(mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), touchEvent.GetPoint(i).GetScreenPosition(), hitTestResults, nullptr, Integration::Scene::TouchPropagationType::GEOMETRY);
if(hitTestResults.actor)
{
return layer->IsTouchConsumed();
}
- bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, bool isGeometry) override
+ bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, const Integration::Scene::TouchPropagationType propagationType) override
{
return actor->EmitHitTestResultSignal(point, hitPointLocal, timeStamp);
}
return false;
}
- bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, bool isGeometry) override
+ bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, const Integration::Scene::TouchPropagationType propagationType) override
{
// Geometry way does not require Hittest from the client.
- if(!isGeometry)
+ if(propagationType == Integration::Scene::TouchPropagationType::PARENT)
{
return actor->EmitHitTestResultSignal(point, hitPointLocal, timeStamp);
}
return layer->IsTouchConsumed();
}
- bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, bool isGeometry) override
+ bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, const Integration::Scene::TouchPropagationType propagationType) override
{
// The Geometry way behaves like AllowedOnlyOwnTouch is enabled.
- if(point.GetState() != PointState::STARTED && (isGeometry || actor->IsAllowedOnlyOwnTouch()) && ownActor != actor)
+ if(point.GetState() != PointState::STARTED && (propagationType == Integration::Scene::TouchPropagationType::GEOMETRY || actor->IsAllowedOnlyOwnTouch()) && ownActor != actor)
{
return false;
}
// Geometry way does not require Hittest from the client.
- if(!isGeometry)
+ if(propagationType == Integration::Scene::TouchPropagationType::PARENT)
{
return actor->EmitHitTestResultSignal(point, hitPointLocal, timeStamp);
}
/**
* Hit tests the given actor and updates the in/out variables appropriately
*/
-bool HitTestActor(const RenderTask& renderTask,
- const Vector4& rayOrigin,
- const Vector4& rayDir,
- const float& nearClippingPlane,
- const float& farClippingPlane,
- HitTestInterface& hitCheck,
- const RayTest& rayTest,
- const Integration::Point& point,
- const uint32_t eventTime,
- bool clippingActor,
- bool overlayedActor,
- Actor& actor,
- bool& overlayHit,
- HitActor& hit,
- bool isGeometry)
+bool HitTestActor(const RenderTask& renderTask,
+ const Vector4& rayOrigin,
+ const Vector4& rayDir,
+ const float& nearClippingPlane,
+ const float& farClippingPlane,
+ HitTestInterface& hitCheck,
+ const RayTest& rayTest,
+ const Integration::Point& point,
+ const uint32_t eventTime,
+ bool clippingActor,
+ bool overlayedActor,
+ Actor& actor,
+ bool& overlayHit,
+ HitActor& hit,
+ const Integration::Scene::TouchPropagationType propagationType)
{
bool isClippingOrHittable = clippingActor || hitCheck.IsActorHittable(&actor);
+ bool isGeometry = propagationType == Integration::Scene::TouchPropagationType::GEOMETRY;
if(isClippingOrHittable || isGeometry)
{
Vector3 size(actor.GetCurrentSize());
}
// If the hit actor does not want to hit, the hit-test continues.
- if(isClippingOrHittable && hitCheck.ActorRequiresHitResultCheck(&actor, point, hitPointLocal, eventTime, isGeometry))
+ if(isClippingOrHittable && hitCheck.ActorRequiresHitResultCheck(&actor, point, hitPointLocal, eventTime, propagationType))
{
hit.actor = &actor;
hit.hitPosition = hitPointLocal;
* - When comparing against renderable parents, if Actor is the same distance
* or closer than it's renderable parent, then it takes priority.
*/
-HitActor HitTestWithinLayer(Actor& actor,
- const RenderTask& renderTask,
- const RenderTaskList::ExclusivesContainer& exclusives,
- const Vector4& rayOrigin,
- const Vector4& rayDir,
- const float& nearClippingPlane,
- const float& farClippingPlane,
- HitTestInterface& hitCheck,
- const bool& overlayed,
- bool& overlayHit,
- bool layerIs3d,
- const RayTest& rayTest,
- const Integration::Point& point,
- const uint32_t eventTime,
- std::list<Dali::Internal::Actor*>& actorLists,
- bool isGeometry)
+HitActor HitTestWithinLayer(Actor& actor,
+ const RenderTask& renderTask,
+ const RenderTaskList::ExclusivesContainer& exclusives,
+ const Vector4& rayOrigin,
+ const Vector4& rayDir,
+ const float& nearClippingPlane,
+ const float& farClippingPlane,
+ HitTestInterface& hitCheck,
+ const bool& overlayed,
+ bool& overlayHit,
+ bool layerIs3d,
+ const RayTest& rayTest,
+ const Integration::Point& point,
+ const uint32_t eventTime,
+ std::list<Dali::Internal::Actor*>& actorLists,
+ const Integration::Scene::TouchPropagationType propagationType)
{
HitActor hit;
bool overlayedActor = overlayed || actor.IsOverlay();
// If we are a clipping actor or hittable...
- if(!HitTestActor(renderTask, rayOrigin, rayDir, nearClippingPlane, farClippingPlane, hitCheck, rayTest, point, eventTime, clippingActor, overlayedActor, actor, overlayHit, hit, isGeometry))
+ if(!HitTestActor(renderTask, rayOrigin, rayDir, nearClippingPlane, farClippingPlane, hitCheck, rayTest, point, eventTime, clippingActor, overlayedActor, actor, overlayHit, hit, propagationType))
{
return hit;
}
{
return hit;
}
- else if(isGeometry && hit.actor)
+ else if(propagationType == Integration::Scene::TouchPropagationType::GEOMETRY && hit.actor)
{
// Saves the actors that can be hit as a list
actorLists.push_back(hit.actor);
point,
eventTime,
actorLists,
- isGeometry));
+ propagationType));
// Make sure the set hit actor is actually hittable. This is usually required when we have some
// clipping as we need to hit-test all actors as we descend the tree regardless of whether they
// are hittable or not.
results.point,
results.eventTime,
results.actorLists,
- true);
+ Integration::Scene::TouchPropagationType::GEOMETRY);
}
else if(IsWithinSourceActors(*sourceActor, *layer))
{
results.point,
results.eventTime,
results.actorLists,
- true);
+ Integration::Scene::TouchPropagationType::GEOMETRY);
}
}
results.point,
results.eventTime,
results.actorLists,
- false);
+ Integration::Scene::TouchPropagationType::PARENT);
}
else if(IsWithinSourceActors(*sourceActor, *layer))
{
results.point,
results.eventTime,
results.actorLists,
- false);
+ Integration::Scene::TouchPropagationType::PARENT);
}
// If this layer is set to consume the hit, then do not check any layers behind it
* @param[in] taskList The list of render tasks
* @param[out] results Ray information calculated by the camera
* @param[in] hitCheck The hit testing interface object to use
- * @param[in] isGeometry Whether the scene using geometry event propagation touch and hover events.
+ * @param[in] propagationType Whether the scene using geometry event propagation touch and hover events.
* @return True if we have a hit, false otherwise
*/
-bool HitTestRenderTaskList(const Vector2& sceneSize,
- LayerList& layers,
- RenderTaskList& taskList,
- const Vector2& screenCoordinates,
- Results& results,
- HitTestInterface& hitCheck,
- bool isGeometry)
+bool HitTestRenderTaskList(const Vector2& sceneSize,
+ LayerList& layers,
+ RenderTaskList& taskList,
+ const Vector2& screenCoordinates,
+ Results& results,
+ HitTestInterface& hitCheck,
+ const Integration::Scene::TouchPropagationType propagationType)
{
- if(isGeometry)
+ if(propagationType == Integration::Scene::TouchPropagationType::GEOMETRY)
{
RenderTaskList::RenderTaskContainer& tasks = taskList.GetTasks();
RenderTaskList::RenderTaskContainer::iterator endIter = tasks.end();
* @param[in] taskList The list of render tasks
* @param[out] results Ray information calculated by the camera
* @param[in] hitCheck The hit testing interface object to use
- * @param[in] isGeometry Whether the scene using geometry event propagation touch and hover events.
+ * @param[in] propagationType Whether the scene using geometry event propagation touch and hover events.
* @return True if we have a hit, false otherwise
*/
-bool HitTestForEachRenderTask(const Vector2& sceneSize,
- LayerList& layers,
- RenderTaskList& taskList,
- const Vector2& screenCoordinates,
- Results& results,
- HitTestInterface& hitCheck,
- bool isGeometry)
+bool HitTestForEachRenderTask(const Vector2& sceneSize,
+ LayerList& layers,
+ RenderTaskList& taskList,
+ const Vector2& screenCoordinates,
+ Results& results,
+ HitTestInterface& hitCheck,
+ const Integration::Scene::TouchPropagationType propagationType)
{
bool result = false;
- if(HitTestRenderTaskList(sceneSize, layers, taskList, screenCoordinates, results, hitCheck, isGeometry))
+ if(HitTestRenderTaskList(sceneSize, layers, taskList, screenCoordinates, results, hitCheck, propagationType))
{
// Found hit.
result = true;
HitTestInterface::~HitTestInterface() = default;
-bool HitTest(const Vector2& sceneSize, RenderTaskList& taskList, LayerList& layerList, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func, bool isGeometry)
+bool HitTest(const Vector2& sceneSize, RenderTaskList& taskList, LayerList& layerList, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func, const Integration::Scene::TouchPropagationType propagationType)
{
bool wasHit(false);
// Hit-test the regular on-scene actors
Results hitTestResults;
HitTestFunctionWrapper hitTestFunctionWrapper(func);
- if(HitTestForEachRenderTask(sceneSize, layerList, taskList, screenCoordinates, hitTestResults, hitTestFunctionWrapper, isGeometry))
+ if(HitTestForEachRenderTask(sceneSize, layerList, taskList, screenCoordinates, hitTestResults, hitTestFunctionWrapper, propagationType))
{
results.actor = hitTestResults.actor;
results.actorCoordinates = hitTestResults.actorCoordinates;
return wasHit;
}
-bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface, bool isGeometry)
+bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface, const Integration::Scene::TouchPropagationType propagationType)
{
bool wasHit(false);
// Hit-test the regular on-scene actors
if(!wasHit)
{
- wasHit = HitTestForEachRenderTask(sceneSize, layerList, renderTaskList, screenCoordinates, results, hitTestInterface, isGeometry);
+ wasHit = HitTestForEachRenderTask(sceneSize, layerList, renderTaskList, screenCoordinates, results, hitTestInterface, propagationType);
}
return wasHit;
}
-bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, const Actor* ownActor, bool isGeometry)
+bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, const Actor* ownActor, const Integration::Scene::TouchPropagationType propagationType)
{
ActorTouchableCheck actorTouchableCheck;
actorTouchableCheck.SetOwnActor(ownActor);
- return HitTest(sceneSize, renderTaskList, layerList, screenCoordinates, results, actorTouchableCheck, isGeometry);
+ return HitTest(sceneSize, renderTaskList, layerList, screenCoordinates, results, actorTouchableCheck, propagationType);
}
} // namespace Dali::Internal::HitTestAlgorithm
* @param[in] point The point of event touched.
* @param[in] hitPointLocal The hit point in the Actor's local reference system.
* @param[in] timeStamp The time the event occurred.
- * @param[in] isGeometry If true, hittest works in a geometry way.
+ * @param[in] propagationType If Integration::Scene::TouchPropagationType::GEOMETRY, hittest works in a geometry way.
*
* @return true if the actor should be the hit, false otherwise.
*/
- virtual bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, bool isGeometry) = 0;
+ virtual bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, const Integration::Scene::TouchPropagationType propagationType) = 0;
protected:
/**
* @param[in] screenCoordinates The screen coordinates.
* @param[out] results The results of the hit-test.
* @param[in] func The function to use in the hit-test algorithm.
- * @param[in] isGeometry If true, hittest works in a geometry way.
+ * @param[in] propagationType If Integration::Scene::TouchPropagationType::GEOMETRY, hittest works in a geometry way.
* @return true if something was hit
*
* @see HitTest(Stage&, const Vector2&, Results&, HitTestInterface&)
*/
-bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func, bool isGeometry = false);
+bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Dali::HitTestAlgorithm::Results& results, Dali::HitTestAlgorithm::HitTestFunction func, const Integration::Scene::TouchPropagationType propagationType = Integration::Scene::TouchPropagationType::PARENT);
/**
* Given screen coordinates, this method returns the hit actor & the local coordinates relative to the actor etc.
* @param[in] screenCoordinates The screen coordinates.
* @param[out] results The results of the hit-test.
* @param[in] hitTestInterface Used to determine whether the actor is hit or whether we walk down its hierarchy
- * @param[in] isGeometry If true, hittest works in a geometry way.
+ * @param[in] propagationType If Integration::Scene::TouchPropagationType::GEOMETRY, hittest works in a geometry way.
* @return true if something was hit
*
* <h3>Hit Test Algorithm:</h3>
* @note Currently, we prefer a child hit over a parent (regardless of the distance from the
* camera) unless the parent is a RenderableActor but this is subject to change.
*/
-bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface, bool isGeometry = false);
+bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, HitTestInterface& hitTestInterface, const Integration::Scene::TouchPropagationType propagationType = Integration::Scene::TouchPropagationType::PARENT);
/**
* Default HitTest where we check if a touch is required.
* @param[in] screenCoordinates The screen coordinates.
* @param[out] results The results of the hit-test.
* @param[in] ownActor The actor from which the touch down was started.
- * @param[in] isGeometry If true, hittest works in a geometry way.
+ * @param[in] propagationType If Integration::Scene::TouchPropagationType::GEOMETRY, hittest works in a geometry way.
* @return true if something was hit
*
* @see HitTest(Stage&, const Vector2&, Results&, HitTestInterface&)
*/
-bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, const Actor* ownActor = nullptr, bool isGeometry = false);
+bool HitTest(const Vector2& sceneSize, RenderTaskList& renderTaskList, LayerList& layerList, const Vector2& screenCoordinates, Results& results, const Actor* ownActor = nullptr, const Integration::Scene::TouchPropagationType propagationType = Integration::Scene::TouchPropagationType::PARENT);
} // namespace HitTestAlgorithm
return layer->IsHoverConsumed();
}
- bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, bool isGeometry) override
+ bool ActorRequiresHitResultCheck(Actor* actor, Integration::Point point, Vector2 hitPointLocal, uint32_t timeStamp, const Integration::Scene::TouchPropagationType propagationType) override
{
// Hover event is always hit.
return true;
HitTestAlgorithm::Results hitTestResults;
hitTestResults.eventTime = event.time;
ActorHoverableCheck actorHoverableCheck;
- HitTestAlgorithm::HitTest(processor.mScene.GetSize(), processor.mScene.GetRenderTaskList(), processor.mScene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, actorHoverableCheck, localVars.isGeometry);
+ HitTestAlgorithm::HitTest(processor.mScene.GetSize(), processor.mScene.GetRenderTaskList(), processor.mScene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, actorHoverableCheck, localVars.isGeometry ? Integration::Scene::TouchPropagationType::GEOMETRY : Integration::Scene::TouchPropagationType::PARENT);
Integration::Point newPoint(currentPoint);
newPoint.SetHitActor(hitTestResults.actor);
Integration::Point point;
point.SetState(PointState::INTERRUPTED);
point.SetHitActor(Dali::Actor(actor));
- if(mScene.IsGeometryHittestEnabled())
+ if(mScene.GetTouchPropagationType() == Integration::Scene::TouchPropagationType::GEOMETRY)
{
std::list<Dali::Internal::Actor*> actorLists;
actorLists.push_back(actor);
else
{
Actor* ownTouchActor = ownTouchActorObserver.GetActor();
- HitTestAlgorithm::HitTest(scene.GetSize(), scene.GetRenderTaskList(), scene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, ownTouchActor, scene.IsGeometryHittestEnabled());
+ HitTestAlgorithm::HitTest(scene.GetSize(), scene.GetRenderTaskList(), scene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, ownTouchActor, scene.GetTouchPropagationType());
if(currentPoint.GetState() == PointState::STARTED && hitTestResults.actor)
{
}
else
{
- HitTestAlgorithm::HitTest(mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, nullptr, localVars.isGeometry);
+ HitTestAlgorithm::HitTest(mScene.GetSize(), mScene.GetRenderTaskList(), mScene.GetLayerList(), currentPoint.GetScreenPosition(), hitTestResults, nullptr, localVars.isGeometry ? Integration::Scene::TouchPropagationType::GEOMETRY : Integration::Scene::TouchPropagationType::PARENT);
}
}