X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fcontrols%2Fview%2Fview-impl.cpp;h=3b2ff0bfc10861918bbc3056676f8ae04639d7dd;hp=a1d0c09beacf322417b68297d91e1d278b74cc1f;hb=4b347781c8761d2909b235ded2e98d272fa9ac16;hpb=834ddf7832598a57fc18c282371554a1ed8f0a78 diff --git a/dali-toolkit/internal/controls/view/view-impl.cpp b/dali-toolkit/internal/controls/view/view-impl.cpp index a1d0c09..3b2ff0b 100644 --- a/dali-toolkit/internal/controls/view/view-impl.cpp +++ b/dali-toolkit/internal/controls/view/view-impl.cpp @@ -19,6 +19,7 @@ #include "view-impl.h" // EXTERNAL INCLUDES +#include // for strcmp #include #include #include @@ -152,7 +153,8 @@ void View::SetBackground( ImageActor backgroundImage ) } backgroundImage.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION ); - backgroundImage.SetRelayoutEnabled( false ); // We will scale its size manually + backgroundImage.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS ); + backgroundImage.SetSizeScalePolicy( FILL_WITH_ASPECT_RATIO ); mBackgroundLayer.Add( backgroundImage ); RelayoutRequest(); @@ -168,6 +170,8 @@ void View::SetOrientationFunction( Degree portrait, Degree landscale, Degree por void View::OrientationChanged( Dali::Orientation orientation ) { + Actor self = Self(); + // Nothing to do if orientation doesn't really change. if ( orientation.GetDegrees() == mOrientation || !mAutoRotateEnabled ) { @@ -178,13 +182,13 @@ void View::OrientationChanged( Dali::Orientation orientation ) // has parent so we expect it to be on stage mRotateAnimation = Animation::New( ROTATION_ANIMATION_DURATION ); - mRotateAnimation.RotateTo( Self(), Degree( -orientation.GetDegrees() ), Vector3::ZAXIS, AlphaFunctions::EaseOut ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::ORIENTATION ), Quaternion( -orientation.GetRadians(), Vector3::ZAXIS ), AlphaFunctions::EaseOut ); // Resize the view if( mFullScreen ) { const Vector2& stageSize( Stage::GetCurrent().GetSize() ); - const Vector3& currentSize( Self().GetCurrentSize() ); + const Vector3& currentSize( self.GetCurrentSize() ); float minSize = std::min( stageSize.width, stageSize.height ); float maxSize = std::max( stageSize.width, stageSize.height ); @@ -214,15 +218,15 @@ void View::OrientationChanged( Dali::Orientation orientation ) { // width grows, shrink height faster Vector3 shrink( currentSize );shrink.height = targetSize.height; - mRotateAnimation.Resize( Self(), shrink, AlphaFunctions::EaseOut, 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ); - mRotateAnimation.Resize( Self(), targetSize, AlphaFunctions::EaseIn, 0.0f, ROTATION_ANIMATION_DURATION ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), shrink, AlphaFunctions::EaseOut, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ) ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), targetSize, AlphaFunctions::EaseIn, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION ) ); } else { // height grows, shrink width faster Vector3 shrink( currentSize );shrink.width = targetSize.width; - mRotateAnimation.Resize( Self(), shrink, AlphaFunctions::EaseOut, 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ); - mRotateAnimation.Resize( Self(), targetSize, AlphaFunctions::EaseIn, 0.0f, ROTATION_ANIMATION_DURATION ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), shrink, AlphaFunctions::EaseOut, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION * 0.5f ) ); + mRotateAnimation.AnimateTo( Property( self, Actor::Property::SIZE ), targetSize, AlphaFunctions::EaseIn, TimePeriod( 0.0f, ROTATION_ANIMATION_DURATION ) ); } } @@ -292,18 +296,6 @@ void View::OnInitialize() } } -void View::OnRelayout( const Vector2& size, RelayoutContainer& container ) -{ - if( mBackgroundLayer ) - { - if( mBackgroundLayer && mBackgroundLayer.GetChildCount() > 0 ) - { - Actor background = mBackgroundLayer.GetChildAt(0); - background.SetScale( FillXYKeepAspectRatio( Vector3( size.width, size.height, 1.0f ), background.GetTargetSize() ) ); - } - } -} - View::Orientation View::DegreeToViewOrientation( Degree degree ) { View::Orientation orientation = PORTRAIT;