mBackgroundLayer = Layer::New();
mBackgroundLayer.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
- mBackgroundLayer.SetSize( mViewSize );
+ mBackgroundLayer.SetResizePolicy( FILL_TO_PARENT, ALL_DIMENSIONS );
// Add background layer to custom actor.
Self().Add( mBackgroundLayer );
}
backgroundImage.SetPositionInheritanceMode( Dali::USE_PARENT_POSITION );
- backgroundImage.SetScale( FillXYKeepAspectRatio( mViewSize, backgroundImage.GetSize() ) );
+ backgroundImage.SetRelayoutEnabled( false ); // We will scale its size manually
mBackgroundLayer.Add( backgroundImage );
+
+ RelayoutRequest();
}
void View::SetOrientationFunction( Degree portrait, Degree landscale, Degree portraitInverse, Degree landscapeInverse )
}
}
-void View::OnControlSizeSet( const Vector3& targetSize )
+void View::OnRelayout( const Vector2& size, RelayoutContainer& container )
{
- mViewSize = targetSize;
if( mBackgroundLayer )
{
- mBackgroundLayer.SetSize( mViewSize );
- if( mBackgroundLayer.GetChildCount() > 0 )
+ if( mBackgroundLayer && mBackgroundLayer.GetChildCount() > 0 )
{
Actor background = mBackgroundLayer.GetChildAt(0);
- background.SetScale( FillXYKeepAspectRatio( mViewSize, background.GetSize() ) );
+ background.SetScale( FillXYKeepAspectRatio( Vector3( size.width, size.height, 1.0f ), background.GetTargetSize() ) );
}
}
}