Commit c99d36a5a70d669a68ea4a6a960d8aef6e5cb738
1 parent
020cc515
Fix for text-label.example and text-label-multilanguage.example
* In both demos: set the size of the text-label control,
otherwise the size negotiation sets the natural size.
* In the multilanguage demo: change the parent origin and anchor point of the labels.
Change-Id: I38ccd60fff826e293ee83f4aae88ab615feab1cf
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
Showing
3 changed files
with
12 additions
and
4 deletions
examples/text-label-multi-language/text-label-multi-language-example.cpp
| ... | ... | @@ -72,7 +72,8 @@ public: |
| 72 | 72 | const Language& language = LANGUAGES[index]; |
| 73 | 73 | |
| 74 | 74 | TextLabel label = TextLabel::New(); |
| 75 | - label.SetParentOrigin( ParentOrigin::CENTER ); | |
| 75 | + label.SetParentOrigin( ParentOrigin::TOP_CENTER ); | |
| 76 | + label.SetAnchorPoint( AnchorPoint::TOP_CENTER ); | |
| 76 | 77 | |
| 77 | 78 | label.SetProperty( TextLabel::Property::MULTI_LINE, true ); |
| 78 | 79 | ... | ... |
examples/text-label-multi-language/vertical-layout-impl.cpp
| ... | ... | @@ -113,16 +113,20 @@ void VerticalLayout::OnRelayout( const Vector2& size, ActorSizeContainer& contai |
| 113 | 113 | Vector3 position; |
| 114 | 114 | for( unsigned int index = 0u, count = self.GetChildCount(); index < count; ++index ) |
| 115 | 115 | { |
| 116 | + Size childSize = size; | |
| 116 | 117 | Toolkit::TextLabel label = Toolkit::TextLabel::DownCast( self.GetChildAt( index ) ); |
| 117 | 118 | |
| 118 | 119 | if( label ) |
| 119 | 120 | { |
| 120 | 121 | label.SetPosition( position ); |
| 121 | 122 | |
| 122 | - position.height += label.GetHeightForWidth( size.width ); | |
| 123 | + childSize.height = label.GetHeightForWidth( size.width ); | |
| 124 | + position.height += childSize.height; | |
| 125 | + | |
| 126 | + label.SetSize( childSize ); | |
| 123 | 127 | } |
| 124 | 128 | |
| 125 | - container.push_back( ActorSizePair( label, size ) ); | |
| 129 | + container.push_back( ActorSizePair( label, childSize ) ); | |
| 126 | 130 | } |
| 127 | 131 | } |
| 128 | 132 | ... | ... |
examples/text-label/center-layout-impl.cpp
| ... | ... | @@ -106,7 +106,10 @@ void CenterLayout::OnRelayout( const Vector2& size, ActorSizeContainer& containe |
| 106 | 106 | |
| 107 | 107 | float height = child.GetHeightForWidth( size.width ); |
| 108 | 108 | |
| 109 | - container.push_back( ActorSizePair( child, Vector2( size.width, std::min(height, size.height) ) ) ); | |
| 109 | + const Size childSize( size.width, std::min( height, size.height ) ); | |
| 110 | + child.SetSize( childSize ); | |
| 111 | + | |
| 112 | + container.push_back( ActorSizePair( child, childSize ) ); | |
| 110 | 113 | } |
| 111 | 114 | } |
| 112 | 115 | } | ... | ... |