X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=optional%2Fdali-toolkit%2Finternal%2Fcontrols%2Fview%2Fview-impl.cpp;h=6c374c08aab6383a67180622d329a9d0c88e153b;hp=82b91b724352753cfecac4cdb318b49e66725c39;hb=4c9e3c8180e813f24d7514b275abd0d79c155405;hpb=e5f2603c45d9423cd45e4708a969eb05b982bfd9 diff --git a/optional/dali-toolkit/internal/controls/view/view-impl.cpp b/optional/dali-toolkit/internal/controls/view/view-impl.cpp index 82b91b7..6c374c0 100644 --- a/optional/dali-toolkit/internal/controls/view/view-impl.cpp +++ b/optional/dali-toolkit/internal/controls/view/view-impl.cpp @@ -136,7 +136,7 @@ void View::SetBackground( ImageActor backgroundImage ) mBackgroundLayer = Layer::New(); mBackgroundLayer.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); - mBackgroundLayer.ApplyConstraint( Constraint::New( Actor::SIZE, ParentSource( Actor::SIZE ), EqualToConstraint() ) ); + mBackgroundLayer.SetSize( mViewSize ); // Add background layer to custom actor. Self().Add( mBackgroundLayer ); @@ -156,12 +156,7 @@ void View::SetBackground( ImageActor backgroundImage ) } backgroundImage.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); - Constraint constraint = Constraint::New( - Actor::SCALE, - LocalSource( Actor::SIZE ), - ParentSource( Actor::SIZE ), - ScaleToFillXYKeepAspectRatioConstraint() ); - backgroundImage.ApplyConstraint( constraint ); + backgroundImage.SetScale( FillXYKeepAspectRatio( mViewSize, backgroundImage.GetSize() ) ); mBackgroundLayer.Add( backgroundImage ); } @@ -299,6 +294,20 @@ void View::OnInitialize() } } +void View::OnControlSizeSet( const Vector3& targetSize ) +{ + mViewSize = targetSize; + if( mBackgroundLayer ) + { + mBackgroundLayer.SetSize( mViewSize ); + if( mBackgroundLayer.GetChildCount() > 0 ) + { + Actor background = mBackgroundLayer.GetChildAt(0); + background.SetScale( FillXYKeepAspectRatio( mViewSize, background.GetSize() ) ); + } + } +} + View::Orientation View::DegreeToViewOrientation( Degree degree ) { View::Orientation orientation = PORTRAIT;