Change-Id: Ia601bcd0f9c30106eaab1ed3ebc32711ae9e70e3
application.Render(10);
HitTestAlgorithm::Results results;
application.Render(10);
HitTestAlgorithm::Results results;
- HitTest(stage, Vector2( 240.0f, 400.0f ), results, &DefaultIsActorTouchableFunction);
- DALI_TEST_CHECK( results.actor == blue );
- DALI_TEST_EQUALS( results.actorCoordinates, actorSize * 5.0f/6.0f, TEST_LOCATION );
+ HitTest(stage, stageSize / 2.0f, results, &DefaultIsActorTouchableFunction);
+ 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);
DALI_TEST_CHECK( results.actor == blue );
HitTest(stage, stageSize / 3.0f, results, &DefaultIsActorTouchableFunction);
DALI_TEST_CHECK( results.actor == blue );
hit.x = hitPointLocal.x;
hit.y = hitPointLocal.y;
hit.distance = distance;
hit.x = hitPointLocal.x;
hit.y = hitPointLocal.y;
hit.distance = distance;
+ hit.depth = actor.GetHierarchyDepth() * Dali::Layer::TREE_DEPTH_MULTIPLIER;
// Is this actor an Image Actor or contains a renderer?
if ( ImageActor* imageActor = dynamic_cast< ImageActor* >( &actor ) )
{
// Is this actor an Image Actor or contains a renderer?
if ( ImageActor* imageActor = dynamic_cast< ImageActor* >( &actor ) )
{
- hit.depth = imageActor->GetDepthIndex();
+ hit.depth += imageActor->GetDepthIndex();
+ else if ( actor.GetRendererCount() )
- if ( actor.GetRendererCount() )
- {
- hit.depth = actor.GetHierarchyDepth() * Dali::Layer::TREE_DEPTH_MULTIPLIER + actor.GetRendererAt( 0 ).GetDepthIndex();
- }
- else
- {
- hit.depth = 0;
- }
+ hit.depth += actor.GetRendererAt( 0 ).GetDepthIndex();
layerIs3d) );
bool updateChildHit = false;
layerIs3d) );
bool updateChildHit = false;
- // If our ray casting hit, then check then if the hit actor's depth is greater that the favorite, it will be preferred
if ( currentHit.distance >= 0.0f )
{
if ( currentHit.distance >= 0.0f )
{
- if ( currentHit.depth > childHit.depth )
+ updateChildHit = ( ( currentHit.depth > childHit.depth ) ||
+ ( ( currentHit.depth == childHit.depth ) && ( currentHit.distance < childHit.distance ) ) );
-
- // In a 3D layer, if the hit actor's depth is equal to current favorite, then we check the distance and prefer the closer
- else if ( layerIs3d && currentHit.depth == childHit.depth )
- if ( currentHit.distance < childHit.distance )
- {
- updateChildHit = true;
- }
+ updateChildHit = currentHit.depth >= childHit.depth;