From 63a75802b362f787f4331567cbbc137b9ecde652 Mon Sep 17 00:00:00 2001 From: Heeyong Song Date: Tue, 24 Oct 2017 11:35:17 +0900 Subject: [PATCH] Fix SCREEN_POSITION error Change-Id: I07e7104e14b30c330c7266b44a6a20b28accff23 --- automated-tests/src/dali/utc-Dali-Actor.cpp | 20 ++++++++++++++++++++ dali/internal/event/actors/actor-impl.cpp | 2 +- 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 8bd0e6c..57e4757 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.cpp @@ -5742,6 +5742,26 @@ int UtcDaliActorGetScreenPosition(void) tet_printf( "Actor World Position ( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0\n", actorWorldPosition.x, actorWorldPosition.y ); tet_printf( "Actor Screen Position( %f %f ) AnchorPoint::BOTTOM_RIGHT Position x=30 y = 420.0 \n", actorScreenPosition.x, actorScreenPosition.y ); + tet_infoline( "UtcDaliActorGetScreenPosition Scale parent and check child's screen position \n" ); + + actorA.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + actorA.SetPosition( 30.0, 30.0 ); + + Actor actorB = Actor::New(); + actorB.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + actorB.SetSize( size2 ); + actorB.SetPosition( 10.f, 10.f ); + actorA.Add( actorB ); + + actorA.SetScale( 2.0f ); + + application.SendNotification(); + application.Render(); + + actorScreenPosition = actorB.GetProperty( DevelActor::Property::SCREEN_POSITION).Get< Vector2 >(); + + DALI_TEST_EQUALS( actorScreenPosition.x, 50lu , TEST_LOCATION ); + DALI_TEST_EQUALS( actorScreenPosition.y, 50lu , TEST_LOCATION ); END_TEST; } diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index 4e5d866..d36e103 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -818,7 +818,7 @@ const Vector2 Actor::GetCurrentScreenPosition() const { StagePtr stage = Stage::GetCurrent(); Vector3 worldPosition = mNode->GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); - Vector3 actorSize = GetCurrentSize() * GetCurrentScale(); + Vector3 actorSize = GetCurrentSize() * GetCurrentWorldScale(); Vector2 halfStageSize( stage->GetSize() * 0.5f ); // World position origin is center of stage Vector3 halfActorSize( actorSize * 0.5f ); Vector3 anchorPointOffSet = halfActorSize - actorSize * ( mPositionUsesAnchorPoint ? GetCurrentAnchorPoint() : AnchorPoint::TOP_LEFT ); -- 2.7.4