Fix text scroller doesn't give finished signal when set to immediate 69/325069/5
authorANZ1217 <chihun.jeong@samsung.com>
Mon, 2 Jun 2025 07:40:59 +0000 (16:40 +0900)
committerANZ1217 <chihun.jeong@samsung.com>
Wed, 4 Jun 2025 04:08:41 +0000 (13:08 +0900)
Change-Id: I44b4932409a29c8c5c2efa43aec60a5cc6e8f1e6

dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/text/text-scroller.cpp
dali-toolkit/internal/text/text-scroller.h

index dee04364cd8aa504402989c576683c7b96b6bbcd..8b4e924e005a188e7c6c8bb3f7ba6cef37fbcb27 100644 (file)
@@ -1765,6 +1765,7 @@ void TextLabel::ScrollingFinished()
   // Pure Virtual from TextScroller Interface
   DALI_LOG_INFO(gLogFilter, Debug::General, "TextLabel::ScrollingFinished\n");
   mController->SetAutoScrollEnabled(false);
+  mIsAsyncRenderNeeded = true;
   RequestTextRelayout();
 }
 
index bd8673995038ba761aedc50330e3e36d989f2b85..552c6cb611004b616122a21cbe60449247f1ff35 100644 (file)
@@ -153,6 +153,7 @@ void TextScroller::StopScrolling()
         mIsStop = false;
         mScrollAnimation.Stop();
         mScrollerInterface.ScrollingFinished();
+        mIsStoppedImmediately.store(true);
         break;
       }
       case TextLabel::AutoScrollStopMode::FINISH_LOOP:
@@ -196,7 +197,8 @@ TextScroller::TextScroller(ScrollerInterface& scrollerInterface)
   mLoopDelay(0.0f),
   mWrapGap(0.0f),
   mStopMode(TextLabel::AutoScrollStopMode::FINISH_LOOP),
-  mIsStop(false)
+  mIsStop(false),
+  mIsStoppedImmediately(false)
 {
   DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextScroller Default Constructor\n");
 }
@@ -282,7 +284,7 @@ void TextScroller::AutoScrollAnimationFinished(Dali::Animation& animation)
 {
   DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextScroller::AutoScrollAnimationFinished\n");
   mIsStop = false;
-  if(mStopMode == TextLabel::AutoScrollStopMode::FINISH_LOOP)
+  if(!mIsStoppedImmediately.load())
   {
     mScrollerInterface.ScrollingFinished();
   }
@@ -290,6 +292,8 @@ void TextScroller::AutoScrollAnimationFinished(Dali::Animation& animation)
 
 void TextScroller::StartScrolling(Actor scrollingTextActor, float scrollAmount, float scrollDuration, int loopCount)
 {
+  mIsStoppedImmediately.store(false);
+
   DALI_LOG_INFO(gLogFilter, Debug::Verbose, "TextScroller::StartScrolling scrollAmount[%f] scrollDuration[%f], loop[%d] speed[%d]\n", scrollAmount, scrollDuration, loopCount, mScrollSpeed);
   Shader shader    = mRenderer.GetShader();
   mScrollAnimation = Animation::New(scrollDuration);
index 99a493629f16003967a2717e6abb39634ec3e34b..abaf4bf18429fb4e71de31b4b7a65d979cd5edf1 100644 (file)
@@ -184,12 +184,13 @@ private:
   Shader             mShader;            // Shader originally used by the renderer while not scrolling
   TextureSet         mTextureSet;        // Texture originally used by the renderer while not scrolling
 
-  int                                 mScrollSpeed; ///< Speed which text should automatically scroll at
-  int                                 mLoopCount;   ///< Number of time the text should scroll
-  float                               mLoopDelay;   ///< Time delay of loop start
-  float                               mWrapGap;     ///< Gap before text wraps around when scrolling
-  TextLabel::AutoScrollStopMode::Type mStopMode;    ///< Stop mode of scrolling text, when loop count is 0.
-  bool                                mIsStop : 1;  ///< Whether the stop scrolling has been triggered or not.
+  int                                 mScrollSpeed;           ///< Speed which text should automatically scroll at
+  int                                 mLoopCount;             ///< Number of time the text should scroll
+  float                               mLoopDelay;             ///< Time delay of loop start
+  float                               mWrapGap;               ///< Gap before text wraps around when scrolling
+  TextLabel::AutoScrollStopMode::Type mStopMode;              ///< Stop mode of scrolling text, when loop count is 0.
+  bool                                mIsStop : 1;            ///< Whether the stop scrolling has been triggered or not.
+  std::atomic<bool>                   mIsStoppedImmediately;  ///< Whether the stop is triggered by immediate stop.
 
 }; // TextScroller class