If the height is small even if scrolling is enabled, it should be elide. 15/192915/5
authorJoogab Yun <joogab.yun@samsung.com>
Mon, 12 Nov 2018 07:42:09 +0000 (16:42 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Sat, 17 Nov 2018 00:56:13 +0000 (09:56 +0900)
If you do not want to elide, you can use the TextLabel :: Property ::
ELLIPSIS property.
ex) textLabel.SetProperty(TextLabel::Property::ELLIPSIS, false);

sample)
    TextLabel textLabel;
    textLabel = TextLabel::New( "The certificates can be created,
edited, removed, and set as active. The active certificates are used
when packaging your application.");

    textLabel.SetSize( 400, 31 );
    textLabel.SetPosition(10, 390);
    textLabel.SetParentOrigin(ParentOrigin::TOP_LEFT);
    textLabel.SetAnchorPoint(AnchorPoint::TOP_LEFT);
    textLabel.SetProperty(TextLabel::Property::ENABLE_AUTO_SCROLL,
true);
    textLabel.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_COUNT,
0);
    textLabel.SetProperty(TextLabel::Property::AUTO_SCROLL_GAP, 50);
    textLabel.SetProperty(TextLabel::Property::AUTO_SCROLL_SPEED, 50);
    textLabel.SetProperty(TextLabel::Property::AUTO_SCROLL_LOOP_DELAY,
1);
    textLabel.SetProperty(TextLabel::Property::POINT_SIZE, 30);
    textLabel.SetProperty( TextLabel::Property::TEXT_COLOR, Color::RED
);

Change-Id: I1b685226cb24aa1d1f1d0ee490db52439f49ccb3

automated-tests/src/dali-toolkit-internal/dali-toolkit-test-utils/toolkit-text-utils.cpp
automated-tests/src/dali-toolkit-internal/utc-Dali-Text-Layout.cpp
automated-tests/src/dali-toolkit/utc-Dali-TextLabel.cpp
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/text/layouts/layout-engine.cpp
dali-toolkit/internal/text/layouts/layout-engine.h
dali-toolkit/internal/text/text-controller.cpp

index ccd24b5..84df087 100755 (executable)
@@ -323,11 +323,13 @@ void CreateTextModel( const std::string& text,
   layoutParameters.startLineIndex = 0u;
   layoutParameters.estimatedNumberOfLines = logicalModel->mParagraphInfo.Count();
 
+  bool isAutoScroll = false;
   layoutEngine.LayoutText( layoutParameters,
                            glyphPositions,
                            lines,
                            layoutSize,
-                           false );
+                           false,
+                           isAutoScroll );
 
   // 10) Reorder the lines
   if( 0u != bidirectionalInfo.Count() )
index b9278e3..8b9bffd 100755 (executable)
@@ -187,11 +187,13 @@ bool LayoutTextTest( const LayoutTextData& data )
 
   layoutSize = Vector2::ZERO;
 
+  bool isAutoScroll = false;
   const bool updated = engine.LayoutText( layoutParameters,
                                           glyphPositions,
                                           lines,
                                           layoutSize,
-                                          data.ellipsis );
+                                          data.ellipsis,
+                                          isAutoScroll );
 
   // 4) Compare the results.
 
index ffa0a61..b1ae269 100755 (executable)
@@ -553,9 +553,9 @@ int UtcDaliToolkitTextLabelSetPropertyP(void)
   DALI_TEST_EQUALS( label.GetProperty<float>( TextLabel::Property::PIXEL_SIZE ), 20.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
 
   // Check the ellipsis property
-  DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
-  label.SetProperty( TextLabel::Property::ELLIPSIS, true );
   DALI_TEST_CHECK( label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
+  label.SetProperty( TextLabel::Property::ELLIPSIS, false );
+  DALI_TEST_CHECK( !label.GetProperty<bool>( TextLabel::Property::ELLIPSIS ) );
 
   // Check the layout direction property
   label.SetProperty( Actor::Property::LAYOUT_DIRECTION, LayoutDirection::RIGHT_TO_LEFT );
index 376709a..79dc2cb 100755 (executable)
@@ -363,7 +363,6 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr
              // If request is enable (true) then start autoscroll as not already running
              else
              {
-               impl.mController->SetTextElideEnabled( false );
                impl.mController->SetAutoScrollEnabled( enableAutoScroll );
              }
           }
index 4f9876c..f97a8ea 100755 (executable)
@@ -555,6 +555,7 @@ struct Engine::Impl
    * @param[in,out] numberOfLines The number of laid-out lines.
    * @param[in] penY The vertical layout position.
    * @param[in] currentParagraphDirection The current paragraph's direction.
+   * @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
    *
    * return Whether the line is ellipsized.
    */
@@ -565,14 +566,17 @@ struct Engine::Impl
                      Vector2* glyphPositionsBuffer,
                      Length& numberOfLines,
                      float penY,
-                     CharacterDirection currentParagraphDirection )
+                     CharacterDirection currentParagraphDirection,
+                     bool& isAutoScrollEnabled )
   {
-    const bool ellipsis = ( ( penY - layout.descender > layoutParameters.boundingBox.height ) ||
-                            ( ( mLayout == SINGLE_LINE_BOX ) &&
-                              ( layout.extraBearing + layout.length + layout.extraWidth > layoutParameters.boundingBox.width ) ) );
+    const bool ellipsis = isAutoScrollEnabled ? ( penY - layout.descender > layoutParameters.boundingBox.height ) :
+                                                ( ( penY - layout.descender > layoutParameters.boundingBox.height ) ||
+                                                  ( ( mLayout == SINGLE_LINE_BOX ) &&
+                                                  ( layout.extraBearing + layout.length + layout.extraWidth > layoutParameters.boundingBox.width ) ) );
 
     if( ellipsis )
     {
+      isAutoScrollEnabled = false;
       // Do not layout more lines if ellipsis is enabled.
 
       // The last line needs to be completely filled with characters.
@@ -791,7 +795,8 @@ struct Engine::Impl
                    Vector<Vector2>& glyphPositions,
                    Vector<LineRun>& lines,
                    Size& layoutSize,
-                   bool elideTextEnabled )
+                   bool elideTextEnabled,
+                   bool& isAutoScrollEnabled )
   {
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "-->LayoutText\n" );
     DALI_LOG_INFO( gLogFilter, Debug::Verbose, "  box size %f, %f\n", layoutParameters.boundingBox.width, layoutParameters.boundingBox.height );
@@ -925,7 +930,8 @@ struct Engine::Impl
                                  glyphPositionsBuffer,
                                  numberOfLines,
                                  penY,
-                                 currentParagraphDirection );
+                                 currentParagraphDirection,
+                                 isAutoScrollEnabled );
       }
 
       if( ellipsis )
@@ -1291,13 +1297,15 @@ bool Engine::LayoutText( const Parameters& layoutParameters,
                          Vector<Vector2>& glyphPositions,
                          Vector<LineRun>& lines,
                          Size& layoutSize,
-                         bool elideTextEnabled )
+                         bool elideTextEnabled,
+                         bool& isAutoScrollEnabled )
 {
   return mImpl->LayoutText( layoutParameters,
                             glyphPositions,
                             lines,
                             layoutSize,
-                            elideTextEnabled );
+                            elideTextEnabled,
+                            isAutoScrollEnabled );
 }
 
 void Engine::ReLayoutRightToLeftLines( const Parameters& layoutParameters,
index 5e80d8c..58466a9 100755 (executable)
@@ -108,6 +108,7 @@ public:
    * @param[out] lines The laid-out lines.
    * @param[out] layoutSize The size of the text after it has been laid-out.
    * @param[in] elideTextEnabled Whether the text elide is enabled.
+   * @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
    *
    * @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
    */
@@ -115,7 +116,8 @@ public:
                    Vector<Vector2>& glyphPositions,
                    Vector<LineRun>& lines,
                    Size& layoutSize,
-                   bool elideTextEnabled );
+                   bool elideTextEnabled,
+                   bool& isAutoScrollEnabled );
 
   /**
    * @brief Re-lays out those lines with right to left characters.
index 6c1bf75..13d0ab2 100755 (executable)
@@ -2328,6 +2328,7 @@ Controller::UpdateTextType Controller::Relayout( const Size& size, Dali::LayoutD
                         mImpl->mOperationsPending,
                         layoutSize ) || updated;
 
+
   if( updated )
   {
     updateTextType = MODEL_UPDATED;
@@ -3601,12 +3602,15 @@ bool Controller::DoRelayout( const Size& size,
     }
 
     // Update the visual model.
+    bool isAutoScrollEnabled = mImpl->mIsAutoScrollEnabled;
     Size newLayoutSize;
     viewUpdated = mImpl->mLayoutEngine.LayoutText( layoutParameters,
                                                    glyphPositions,
                                                    mImpl->mModel->mVisualModel->mLines,
                                                    newLayoutSize,
-                                                   elideTextEnabled );
+                                                   elideTextEnabled,
+                                                   isAutoScrollEnabled );
+    mImpl->mIsAutoScrollEnabled = isAutoScrollEnabled;
 
     viewUpdated = viewUpdated || ( newLayoutSize != layoutSize );