Commit 17e885c9a9f952e9b4ef006904aea374ab161c96
Committed by
Paul Wisbey
1 parent
84aee878
Remove redundant call to ResourceImage::GetImageSize()
Change-Id: I6fd663fad743bd52f1667108492cd92c3c150ad3
Showing
1 changed file
with
4 additions
and
9 deletions
examples/text-field/text-field-example.cpp
| ... | ... | @@ -43,7 +43,7 @@ namespace |
| 43 | 43 | |
| 44 | 44 | const float BORDER_WIDTH = 4.0f; |
| 45 | 45 | |
| 46 | - const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.0, 0.25, 0.0 ); | |
| 46 | + const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.8, 0.25, 0.0 ); | |
| 47 | 47 | |
| 48 | 48 | } // unnamed namespace |
| 49 | 49 | |
| ... | ... | @@ -90,10 +90,6 @@ public: |
| 90 | 90 | button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE ); |
| 91 | 91 | button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE ); |
| 92 | 92 | button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); |
| 93 | - button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); | |
| 94 | - ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE ); | |
| 95 | - button.SetSize( imageSize.GetWidth(), imageSize.GetHeight() ); | |
| 96 | - | |
| 97 | 93 | return button; |
| 98 | 94 | } |
| 99 | 95 | |
| ... | ... | @@ -107,7 +103,7 @@ public: |
| 107 | 103 | |
| 108 | 104 | // Launch a pop-up containing TextField |
| 109 | 105 | mField = CreateTextField( stageSize, mButtonLabel ); |
| 110 | - mPopup = CreatePopup( stageSize.width * 0.8f ); | |
| 106 | + mPopup = CreatePopup(); | |
| 111 | 107 | mPopup.Add( mField ); |
| 112 | 108 | mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched ); |
| 113 | 109 | stage.Add( mPopup ); |
| ... | ... | @@ -132,13 +128,12 @@ public: |
| 132 | 128 | return field; |
| 133 | 129 | } |
| 134 | 130 | |
| 135 | - Popup CreatePopup( float width ) | |
| 131 | + Popup CreatePopup() | |
| 136 | 132 | { |
| 137 | 133 | Popup popup = Popup::New(); |
| 138 | 134 | popup.SetParentOrigin( ParentOrigin::CENTER ); |
| 139 | 135 | popup.SetAnchorPoint( AnchorPoint::CENTER ); |
| 140 | - popup.SetSize( width, 0.0f ); | |
| 141 | - popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); | |
| 136 | + popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); | |
| 142 | 137 | popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); |
| 143 | 138 | popup.TouchSignal().Connect( this, &TextFieldExample::OnPopupTouched ); |
| 144 | 139 | ... | ... |