From: Joogab Yun Date: Sat, 11 Jan 2020 22:37:02 +0000 (+0900) Subject: [Tizen] TextFit : modified it work even if you change the size X-Git-Tag: accepted/tizen/5.5/unified/20200121.041230~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=645ae6b5c8ac12b29954c980cc4ca4a307b5768e;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git [Tizen] TextFit : modified it work even if you change the size // text fit test Property::Map backgroundMap; backgroundMap["color"] = Color::RED; backgroundMap["enable"] = true; Property::Map textFitMap; textFitMap["enable"] = true; textFitMap["minSize"] = 10.f; textFitMap["maxSize"] = 60.f; textFitMap["stepSize"] = 4.f; textFitMap["fontSizeType"] = "pointSize"; width = 700; height = 100; textFit = TextLabel::New( "Long enough message for TextLabel!! This is a Text Fit sample text " ); textFit.SetSize( width, height ); textFit.SetParentOrigin(ParentOrigin::TOP_LEFT); textFit.SetAnchorPoint(AnchorPoint::TOP_LEFT); textFit.SetPosition( 100.f, 300.f); textFit.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMap ); textFit.SetProperty( Toolkit::DevelTextLabel::Property::BACKGROUND, backgroundMap ); stage.Add( textFit ); stage.KeyEventSignal().Connect( this, &HelloWorldController::OnKeyEvent ); } void OnKeyEvent( const KeyEvent& event ) { if( event.state == KeyEvent::Down ) { width -= 40; textFit.SetSize( width, height ); } } Change-Id: Ie7f3cd5cc5e0fa581f8e4912ccb5e88049499f31 --- diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index d8247bd..9d02e11 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -2145,7 +2145,7 @@ bool Controller::CheckForTextFit( float pointSize, Size& layoutSize ) void Controller::FitPointSizeforLayout( Size layoutSize ) { const OperationsMask operations = mImpl->mOperationsPending; - if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) ) + if( NO_OPERATION != ( UPDATE_LAYOUT_SIZE & operations ) || mImpl->mTextFitContentSize != layoutSize ) { bool actualellipsis = mImpl->mModel->mElideEnabled; float minPointSize = mImpl->mTextFitMinSize;