From: Heeyong Song Date: Fri, 15 Dec 2017 05:54:13 +0000 (+0900) Subject: [4.0] Fix screen position calulation in Actor X-Git-Tag: accepted/tizen/4.0/unified/20171219.072151~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F164186%2F2;p=platform%2Fcore%2Fuifw%2Fdali-core.git [4.0] Fix screen position calulation in Actor Change-Id: Id8f153a670e72e35bb254426d0db030b457f1913 --- diff --git a/dali/internal/event/actors/actor-impl.cpp b/dali/internal/event/actors/actor-impl.cpp index d36e103..c83cb0c 100644 --- a/dali/internal/event/actors/actor-impl.cpp +++ b/dali/internal/event/actors/actor-impl.cpp @@ -814,10 +814,13 @@ const Vector3& Actor::GetCurrentWorldPosition() const const Vector2 Actor::GetCurrentScreenPosition() const { - if( OnStage() && NULL != mNode ) + StagePtr stage = Stage::GetCurrent(); + if( stage && OnStage() && NULL != mNode ) { - StagePtr stage = Stage::GetCurrent(); Vector3 worldPosition = mNode->GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); + Vector3 cameraPosition = stage->GetDefaultCameraActor().mNode->GetWorldPosition( GetEventThreadServices().GetEventBufferIndex() ); + worldPosition -= cameraPosition; + Vector3 actorSize = GetCurrentSize() * GetCurrentWorldScale(); Vector2 halfStageSize( stage->GetSize() * 0.5f ); // World position origin is center of stage Vector3 halfActorSize( actorSize * 0.5f );