Text scroll animation bug fix 91/130691/6
authorJinho, Lee <jeano.lee@samsung.com>
Tue, 23 May 2017 09:52:46 +0000 (18:52 +0900)
committerJinho, Lee <jeano.lee@samsung.com>
Fri, 2 Jun 2017 06:59:21 +0000 (15:59 +0900)
Text scroll animations continue to play even if TextLabel called SetProperty.
Text scroll animations don't be played if TextLabel called SetProperty after setting stop.

Change-Id: I9ecae3c4aea50cf1032d4ee0135b9d7d41701d04

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

index 7d9933d..3419e99 100644 (file)
@@ -310,6 +310,8 @@ void TextScroller::StopScrolling()
       case DevelTextLabel::AutoScrollStopMode::IMMEDIATE:
       {
         mScrollAnimation.Stop();
+        CleanUp();
+        mScrollerInterface.ScrollingFinished();
         break;
       }
       case DevelTextLabel::AutoScrollStopMode::FINISH_LOOP:
@@ -319,7 +321,7 @@ void TextScroller::StopScrolling()
       }
       default:
       {
-          DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" );
+        DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" );
       }
     }
   }
@@ -363,8 +365,20 @@ void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, co
 
   CleanUp(); //  If already scrolling then restart with new parameters
 
+  float animationProgress = 0.0f;
+  int   remainedLoop = mLoopCount;
   if ( mScrollAnimation )
   {
+    if( mScrollAnimation.GetState() == Animation::PLAYING )
+    {
+      animationProgress = mScrollAnimation.GetCurrentProgress();
+
+      if( mLoopCount > 0 ) // If not a ininity loop, then calculate remained loop
+      {
+        remainedLoop = mLoopCount - ( mScrollAnimation.GetCurrentLoop() );
+        remainedLoop = ( remainedLoop <= 0 ? 1 : remainedLoop );
+      }
+    }
     mScrollAnimation.Clear();
   }
 
@@ -439,7 +453,8 @@ void TextScroller::SetParameters( Actor sourceActor, const Size& controlSize, co
      scrollAmount = -scrollAmount; // reverse direction of scrollung
   }
 
-  StartScrolling( scrollAmount, scrollDuration, mLoopCount );
+  StartScrolling( scrollAmount, scrollDuration, remainedLoop );
+  mScrollAnimation.SetCurrentProgress(animationProgress);
 }
 
 void TextScroller::AutoScrollAnimationFinished( Dali::Animation& animation )