From: Bowon Ryu Date: Wed, 14 May 2025 09:33:14 +0000 (+0900) Subject: Fix text color issue in label X-Git-Tag: dali_2.4.19~3^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F35%2F324235%2F1;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Fix text color issue in label - 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 --- 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 e4c796a138..0ba288adef 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -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; } diff --git a/dali-toolkit/internal/text/visual-model-impl.cpp b/dali-toolkit/internal/text/visual-model-impl.cpp index 369bd5ff06..52e673a6ee 100644 --- a/dali-toolkit/internal/text/visual-model-impl.cpp +++ b/dali-toolkit/internal/text/visual-model-impl.cpp @@ -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) diff --git a/dali-toolkit/internal/text/visual-model-impl.h b/dali-toolkit/internal/text/visual-model-impl.h index e391113650..8f63398b45 100644 --- a/dali-toolkit/internal/text/visual-model-impl.h +++ b/dali-toolkit/internal/text/visual-model-impl.h @@ -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