From 17e885c9a9f952e9b4ef006904aea374ab161c96 Mon Sep 17 00:00:00 2001 From: Nick Holland Date: Tue, 21 Feb 2017 10:54:26 +0000 Subject: [PATCH] Remove redundant call to ResourceImage::GetImageSize() Change-Id: I6fd663fad743bd52f1667108492cd92c3c150ad3 --- examples/text-field/text-field-example.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/examples/text-field/text-field-example.cpp b/examples/text-field/text-field-example.cpp index 5e025b1..944cb71 100644 --- a/examples/text-field/text-field-example.cpp +++ b/examples/text-field/text-field-example.cpp @@ -43,7 +43,7 @@ namespace const float BORDER_WIDTH = 4.0f; - const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.0, 0.25, 0.0 ); + const Vector3 POPUP_SIZE_FACTOR_TO_PARENT = Vector3( 0.8, 0.25, 0.0 ); } // unnamed namespace @@ -90,10 +90,6 @@ public: button.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, FOLDER_ICON_IMAGE ); button.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, FOLDER_OPEN_ICON_IMAGE ); button.SetAnchorPoint( AnchorPoint::TOP_LEFT ); - button.SetResizePolicy( ResizePolicy::FIXED, Dimension::ALL_DIMENSIONS ); - ImageDimensions imageSize = ResourceImage::GetImageSize( FOLDER_ICON_IMAGE ); - button.SetSize( imageSize.GetWidth(), imageSize.GetHeight() ); - return button; } @@ -107,7 +103,7 @@ public: // Launch a pop-up containing TextField mField = CreateTextField( stageSize, mButtonLabel ); - mPopup = CreatePopup( stageSize.width * 0.8f ); + mPopup = CreatePopup(); mPopup.Add( mField ); mPopup.OutsideTouchedSignal().Connect( this, &TextFieldExample::OnPopupOutsideTouched ); stage.Add( mPopup ); @@ -132,13 +128,12 @@ public: return field; } - Popup CreatePopup( float width ) + Popup CreatePopup() { Popup popup = Popup::New(); popup.SetParentOrigin( ParentOrigin::CENTER ); popup.SetAnchorPoint( AnchorPoint::CENTER ); - popup.SetSize( width, 0.0f ); - popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::HEIGHT ); + popup.SetResizePolicy( ResizePolicy::SIZE_RELATIVE_TO_PARENT, Dimension::ALL_DIMENSIONS ); popup.SetSizeModeFactor( POPUP_SIZE_FACTOR_TO_PARENT ); popup.TouchSignal().Connect( this, &TextFieldExample::OnPopupTouched ); -- 2.7.4