[4.0] Fix text scroll start position issue 90/164990/2
authorminho.sun <minho.sun@samsung.com>
Fri, 22 Dec 2017 04:40:58 +0000 (13:40 +0900)
committerminho.sun <minho.sun@samsung.com>
Thu, 28 Dec 2017 01:37:11 +0000 (10:37 +0900)
When user sets textlabel auto scroll, it starts after aligning.
It makes long text start its scrolling at the odd position when
horizontal alignment is not begin.

Makes long text always start its scrolling at the begin position even if
horizontal alignment is set.

Change-Id: Ie54bbb570fdce4d92b1178614e2e64951a77dba9

dali-toolkit/internal/text/text-scroller.cpp

index be83736..afe7005 100644 (file)
@@ -295,7 +295,17 @@ void TextScroller::SetParameters( Actor scrollingTextActor, Renderer renderer, T
 
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters wrapGap[%f]\n", wrapGap );
 
-  const float horizontalAlign = HORIZONTAL_ALIGNMENT_TABLE[ horizontalAlignment ][ direction ];
+  float horizontalAlign;
+
+  if( textureSize.x > controlSize.x )
+  {
+    // if Text is elided, scroll should start at the begin of text.
+    horizontalAlign = HORIZONTAL_ALIGNMENT_TABLE[HorizontalAlignment::BEGIN][ direction ];
+  }
+  else
+  {
+    horizontalAlign = HORIZONTAL_ALIGNMENT_TABLE[ horizontalAlignment ][ direction ];
+  }
   const float verticalAlign = VERTICAL_ALIGNMENT_TABLE[ verticalAlignment ];
   DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetParameters horizontalAlign[%f], verticalAlign[%f]\n", horizontalAlign, verticalAlign );