From df8aa451cddeafb67f08cce86b07206d07ca9bc3 Mon Sep 17 00:00:00 2001 From: "Jinho, Lee" Date: Tue, 23 May 2017 11:26:15 +0900 Subject: [PATCH] Fixed for infinity loop mode StopScrolling logic have been seperated from SetLoopCount Change-Id: Iddfd0ce5a79d08b7005d4ca3f9121ce3ace8eb55 --- .../controls/text-controls/text-label-impl.cpp | 2 +- dali-toolkit/internal/text/text-scroller.cpp | 50 +++++++++++----------- dali-toolkit/internal/text/text-scroller.h | 5 +++ 3 files changed, 31 insertions(+), 26 deletions(-) diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index b1c031c..e4f9efd 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -349,7 +349,7 @@ void TextLabel::SetProperty( BaseObject* object, Property::Index index, const Pr { if( impl.mTextScroller ) { - impl.mTextScroller->SetLoopCount( 0 ); // Causes the current animation to finish playing (0) + impl.mTextScroller->StopScrolling(); } } // If request is enable (true) then start autoscroll as not already running diff --git a/dali-toolkit/internal/text/text-scroller.cpp b/dali-toolkit/internal/text/text-scroller.cpp index c80cf7d..4afd765 100644 --- a/dali-toolkit/internal/text/text-scroller.cpp +++ b/dali-toolkit/internal/text/text-scroller.cpp @@ -224,35 +224,11 @@ int TextScroller::GetSpeed() const void TextScroller::SetLoopCount( int loopCount ) { - if ( loopCount > 0 ) + if ( loopCount >= 0 ) { mLoopCount = loopCount; } - if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING ) - { - if ( loopCount == 0 ) // Request to stop looping - { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount Single loop forced\n" ); - switch( mStopMode ) - { - case DevelTextLabel::AutoScrollStopMode::IMMEDIATE: - { - mScrollAnimation.Stop(); - break; - } - case DevelTextLabel::AutoScrollStopMode::FINISH_LOOP: - { - mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way - break; - } - default: - { - DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" ); - } - } - } - } DALI_LOG_INFO( gLogFilter, Debug::Verbose, "TextScroller::SetLoopCount [%d] Status[%s]\n", mLoopCount, (loopCount)?"looping":"stop" ); } @@ -277,6 +253,30 @@ void TextScroller::SetStopMode( DevelTextLabel::AutoScrollStopMode::Type stopMod mStopMode = stopMode; } +void TextScroller::StopScrolling() +{ + if ( mScrollAnimation && mScrollAnimation.GetState() == Animation::PLAYING ) + { + switch( mStopMode ) + { + case DevelTextLabel::AutoScrollStopMode::IMMEDIATE: + { + mScrollAnimation.Stop(); + break; + } + case DevelTextLabel::AutoScrollStopMode::FINISH_LOOP: + { + mScrollAnimation.SetLoopCount( 1 ); // As animation already playing this allows the current animation to finish instead of trying to stop mid-way + break; + } + default: + { + DALI_LOG_INFO( gLogFilter, Debug::Verbose, "Undifined AutoScrollStopMode\n" ); + } + } + } +} + DevelTextLabel::AutoScrollStopMode::Type TextScroller::GetStopMode() const { return mStopMode; diff --git a/dali-toolkit/internal/text/text-scroller.h b/dali-toolkit/internal/text/text-scroller.h index f6c0b87..6af1b80 100644 --- a/dali-toolkit/internal/text/text-scroller.h +++ b/dali-toolkit/internal/text/text-scroller.h @@ -123,6 +123,11 @@ public: void SetStopMode( DevelTextLabel::AutoScrollStopMode::Type stopMode ); /** + * @brief Stop the auto scrolling. + */ + void StopScrolling(); + + /** * @brief Get the mode of scrolling stop * @return stopMode type when text scrolling is stoped. */ -- 2.7.4