Fix SCREEN_POSITION error 41/157241/1
authorHeeyong Song <heeyong.song@samsung.com>
Tue, 24 Oct 2017 02:35:17 +0000 (11:35 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Tue, 24 Oct 2017 02:35:45 +0000 (11:35 +0900)
Change-Id: I07e7104e14b30c330c7266b44a6a20b28accff23

automated-tests/src/dali/utc-Dali-Actor.cpp
dali/internal/event/actors/actor-impl.cpp

index 8bd0e6c..57e4757 100644 (file)
@@ -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;
 }
index 4e5d866..d36e103 100644 (file)
@@ -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 );