TextFit : modified it to work even if you change the text or multi-line attributes. 26/209326/5
authorJoogab Yun <joogab.yun@samsung.com>
Fri, 5 Jul 2019 01:51:23 +0000 (10:51 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Tue, 9 Jul 2019 04:26:02 +0000 (13:26 +0900)
commit3537fc83b28f77434b64af64299b1bc67f61fb45
tree96db10d822973fe4667aefdaad6530647a7aa684
parentd8b52fede008a48f35867f059f3385dbde63bf22
TextFit : modified it to work even if you change the text or multi-line attributes.

    // 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"] = 100.f;
    textFitMap["stepSize"] = 1.f;
    textFitMap["fontSizeType"] = "pointSize";

    textFit = TextLabel::New(  "This is a Text Fit sample text " );
    textFit.SetSize( 750, 100 );
    textFit.SetParentOrigin(ParentOrigin::TOP_LEFT);
    textFit.SetAnchorPoint(AnchorPoint::TOP_LEFT);
    textFit.SetPosition( 100.f, 100.f);
    textFit.SetProperty( Toolkit::DevelTextLabel::Property::TEXT_FIT, textFitMap );
    textFit.SetProperty( Toolkit::DevelTextLabel::Property::BACKGROUND, backgroundMap );
    stage.Add( textFit );

    stage.GetRootLayer().TouchSignal().Connect( this, &HelloWorldController::OnTextFitTouch );

  bool OnTextFitTouch( Actor actor, const TouchData& touch )
  {

    textFit.SetProperty( TextLabel::Property::TEXT, "Long enough message for TextLabel!! ");
    textFit.SetProperty( TextLabel::Property::MULTI_LINE, true );

    return true;
  }

Change-Id: I81927d70db58211892fc98592eadfccf5a69d374
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/text/text-controller.cpp