Changed flex container to selectively modify resize policy 76/103876/1
authorDavid Steele <david.steele@samsung.com>
Fri, 9 Dec 2016 16:38:58 +0000 (16:38 +0000)
committerDavid Steele <david.steele@samsung.com>
Fri, 9 Dec 2016 16:51:03 +0000 (16:51 +0000)
Flex container currently sets the resize policy of all it's children to USE_ASSIGNED_SIZE, regardless of whether they are using flex child property or not.

Modified to only change resize policy when the flex child property is set.

Change-Id: Ifc6dce3022e48aef2b446b4e6cecde7b82ab73dc
Signed-off-by: David Steele <david.steele@samsung.com>
dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp

index c520ede..1ccd840 100644 (file)
@@ -527,13 +527,18 @@ void FlexContainer::OnRelayout( const Vector2& size, RelayoutContainer& containe
     Actor child = mChildrenNodes[i].actor.GetHandle();
     if( child )
     {
     Actor child = mChildrenNodes[i].actor.GetHandle();
     if( child )
     {
-      if( child.GetResizePolicy( Dimension::WIDTH ) != ResizePolicy::USE_ASSIGNED_SIZE )
+      if( child.GetPropertyType( Toolkit::FlexContainer::ChildProperty::FLEX ) != Property::NONE )
       {
       {
-        child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::WIDTH );
-      }
-      if( child.GetResizePolicy( Dimension::HEIGHT ) != ResizePolicy::USE_ASSIGNED_SIZE )
-      {
-        child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::HEIGHT );
+        // Only Set to USE_ASSIGNED_SIZE if the child actor is flexible.
+
+        if( child.GetResizePolicy( Dimension::WIDTH ) != ResizePolicy::USE_ASSIGNED_SIZE )
+        {
+          child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::WIDTH );
+        }
+        if( child.GetResizePolicy( Dimension::HEIGHT ) != ResizePolicy::USE_ASSIGNED_SIZE )
+        {
+          child.SetResizePolicy( ResizePolicy::USE_ASSIGNED_SIZE, Dimension::HEIGHT );
+        }
       }
 
       container.Add( child, Vector2(mChildrenNodes[i].node->layout.dimensions[CSS_WIDTH], mChildrenNodes[i].node->layout.dimensions[CSS_HEIGHT] ) );
       }
 
       container.Add( child, Vector2(mChildrenNodes[i].node->layout.dimensions[CSS_WIDTH], mChildrenNodes[i].node->layout.dimensions[CSS_HEIGHT] ) );