Fix text color issue in label 35/324235/1
authorBowon Ryu <bowon.ryu@samsung.com>
Wed, 14 May 2025 09:33:14 +0000 (18:33 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Wed, 14 May 2025 09:33:14 +0000 (18:33 +0900)
- If only TextColor is changed in async, there is no need to make a render request.
- If strikethrough color is not explicitly set, follow TextColor.
  (Same behavior as underline color)

Change-Id: Icb4330aeeb769f5684f5f995be1bf72b6096c636
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali-toolkit/internal/controls/text-controls/text-label-impl.cpp
dali-toolkit/internal/text/visual-model-impl.cpp
dali-toolkit/internal/text/visual-model-impl.h

index e4c796a1388145a0604ac70418ca2d17fbdcd830..0ba288adef949ce2310e2ced7e994632793b2cc7 100644 (file)
@@ -1315,7 +1315,7 @@ void TextLabel::OnPropertySet(Property::Index index, const Property::Value& prop
       {
         mController->SetDefaultColor(textColor);
         mTextUpdateNeeded    = true;
-        mIsAsyncRenderNeeded = true;
+        mIsAsyncRenderNeeded = mController->IsUnderlineEnabled() || mController->IsStrikethroughEnabled();
       }
       break;
     }
index 369bd5ff0690040dc9438331496772a9c2ccab26..52e673a6ee176e6cb63bfbdb3617b0ba3568bc9b 100644 (file)
@@ -358,6 +358,10 @@ void VisualModel::SetTextColor(const Vector4& textColor)
   {
     mUnderlineColor = textColor;
   }
+  if(!mStrikethroughColorSet)
+  {
+    mStrikethroughColor = textColor;
+  }
 }
 
 void VisualModel::SetShadowOffset(const Vector2& shadowOffset)
@@ -473,7 +477,8 @@ void VisualModel::SetSecondMiddleIndexOfElidedGlyphs(GlyphIndex secondMiddleInde
 
 void VisualModel::SetStrikethroughColor(const Vector4& color)
 {
-  mStrikethroughColor = color;
+  mStrikethroughColor    = color;
+  mStrikethroughColorSet = true;
 }
 
 void VisualModel::SetStrikethroughEnabled(bool enabled)
@@ -749,6 +754,7 @@ VisualModel::VisualModel()
   mBackgroundEnabled(false),
   mMarkupProcessorEnabled(false),
   mStrikethroughEnabled(false),
+  mStrikethroughColorSet(false),
   mCharacterSpacing(0.0f),
   mCutoutEnabled(false),
   mBackgroundWithCutoutEnabled(false)
index e391113650d050dc3e8728042873aa2aa05806af..8f63398b45e1faa98495f5a987e505813fc0882e 100644 (file)
@@ -791,11 +791,12 @@ public:
   bool       mUnderlineColorSet : 1;            ///< Has the underline color been explicitly set?
   bool       mBackgroundEnabled : 1;            ///< Background enabled flag
   bool       mMarkupProcessorEnabled : 1;       ///< Markup-processor enabled flag
-  HyphenInfo mHyphen;                           ///< Contains hyphen glyph info & the character index to draw hyphen after.
   bool       mStrikethroughEnabled : 1;         ///< Strikethrough enabled flag
+  bool       mStrikethroughColorSet : 1;        ///< Has the strikethrough color been explicitly set?
   float      mCharacterSpacing;                 ///< Contains the value of the character spacing.
   bool       mCutoutEnabled : 1;                ///< Cutout enabled flag
   bool       mBackgroundWithCutoutEnabled : 1;  ///< Background with cutout enabled flag.
+  HyphenInfo mHyphen;                           ///< Contains hyphen glyph info & the character index to draw hyphen after.
 };
 
 } // namespace Text