From 1201f66e40f62448c7c7cf9bfd84d6fdef9d93e5 Mon Sep 17 00:00:00 2001 From: "Jinho, Lee" Date: Tue, 23 May 2017 18:52:46 +0900 Subject: [PATCH] Text scroll animation bug fix 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 | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dali-toolkit/internal/text/text-scroller.cpp b/dali-toolkit/internal/text/text-scroller.cpp index 7d9933d..3419e99 100644 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -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 ) -- 2.7.4