From 5a0d4bcc95d9456a5bb948950da126e802a541b5 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Tue, 7 Mar 2017 12:25:20 +0000 Subject: [PATCH] Layout containers won't change anchor-point if the position does not use it Change-Id: I87274ca3356e12ca4eb4c7caac5f0b238704fc0f --- .../internal/controls/flex-container/flex-container-impl.cpp | 12 ++++++++---- .../internal/controls/table-view/table-view-impl.cpp | 6 +++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp index 03d4583..650e5cf 100644 --- a/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp +++ b/dali-toolkit/internal/controls/flex-container/flex-container-impl.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -465,10 +466,6 @@ Property::Value FlexContainer::GetProperty( BaseObject* object, Property::Index void FlexContainer::OnChildAdd( Actor& child ) { - // Anchor actor to top left of the container - child.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - child.SetParentOrigin( ParentOrigin::TOP_LEFT ); - // Create a new node for the child. FlexItemNode childNode; childNode.actor = child; @@ -505,6 +502,13 @@ void FlexContainer::OnRelayout( const Vector2& size, RelayoutContainer& containe Actor child = mChildrenNodes[i].actor.GetHandle(); if( child ) { + // Anchor actor to top left of the container + if( child.GetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >() ) + { + child.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + } + child.SetParentOrigin( ParentOrigin::TOP_LEFT ); + float negotiatedWidth = child.GetRelayoutSize(Dimension::WIDTH); float negotiatedHeight = child.GetRelayoutSize(Dimension::HEIGHT); diff --git a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp index b683987..43c9307 100644 --- a/dali-toolkit/internal/controls/table-view/table-view-impl.cpp +++ b/dali-toolkit/internal/controls/table-view/table-view-impl.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -816,7 +817,10 @@ void TableView::OnRelayout( const Vector2& size, RelayoutContainer& container ) if( actor && position.rowIndex == row && position.columnIndex == column ) { // Anchor actor to top left of the cell - actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + if( actor.GetProperty( DevelActor::Property::POSITION_USES_ANCHOR_POINT ).Get< bool >() ) + { + actor.SetAnchorPoint( AnchorPoint::TOP_LEFT ); + } actor.SetParentOrigin( ParentOrigin::TOP_LEFT ); Padding padding; -- 2.7.4