From b6b6084f70d5e79c42cdb86cc0cad13c8566c0fe Mon Sep 17 00:00:00 2001 From: Joogab Yun Date: Sun, 12 Jan 2020 07:37:02 +0900 Subject: [PATCH] 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 --- dali-toolkit/internal/text/text-controller.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 9d56a0e..0b0e9cf 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -2143,7 +2143,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; -- 2.7.4