[Tizen] Fix decorator color update issue 21/304621/1 accepted/tizen/7.0/unified/20240123.170437
authorBowon Ryu <bowon.ryu@samsung.com>
Thu, 18 Jan 2024 09:19:17 +0000 (18:19 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Mon, 22 Jan 2024 09:56:04 +0000 (18:56 +0900)
After a text decorator is created,
changing the related color causes only the property to be changed.
This patch fixes an issue where the actual actor's color was not changed.

Change-Id: I4778d9a51fa0cd128e24a4362354cebb81b2b2e9
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
automated-tests/src/dali-toolkit/utc-Dali-TextField.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp

index 63eac09..2f97873 100644 (file)
@@ -170,8 +170,8 @@ static void LoadMarkerImages(ToolkitTestApplication& app, TextField textField)
   textField.SetProperty(Toolkit::TextField::Property::SELECTION_HANDLE_PRESSED_IMAGE_RIGHT, propertyMap);
   textField.SetProperty(Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_LEFT, propertyMap);
   textField.SetProperty(Toolkit::TextField::Property::SELECTION_HANDLE_MARKER_IMAGE_RIGHT, propertyMap);
-  textField.SetProperty(Toolkit::TextField::Property::GRAB_HANDLE_IMAGE, propertyMap);
-  textField.SetProperty(Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, propertyMap);
+  textField.SetProperty(Toolkit::TextField::Property::GRAB_HANDLE_IMAGE, "image.png");
+  textField.SetProperty(Toolkit::TextField::Property::GRAB_HANDLE_PRESSED_IMAGE, "image.png");
 }
 
 /*
index 543c232..280f373 100644 (file)
@@ -2052,6 +2052,15 @@ const float Decorator::GetGlyphOffset(Cursor cursor) const
 void Decorator::SetCursorColor(Cursor cursor, const Dali::Vector4& color)
 {
   mImpl->mCursor[cursor].color = color;
+
+  if(cursor == PRIMARY_CURSOR && mImpl->mPrimaryCursor)
+  {
+    mImpl->mPrimaryCursor.SetBackgroundColor(color);
+  }
+  else if(cursor == SECONDARY_CURSOR && mImpl->mSecondaryCursor)
+  {
+    mImpl->mSecondaryCursor.SetBackgroundColor(color);
+  }
 }
 
 const Dali::Vector4& Decorator::GetColor(Cursor cursor) const
@@ -2112,6 +2121,15 @@ float Decorator::GetCursorBlinkDuration() const
 void Decorator::SetCursorWidth(int width)
 {
   mImpl->mCursorWidth = static_cast<float>(width);
+
+  if(mImpl->mPrimaryCursorVisible && mImpl->mPrimaryCursor)
+  {
+    mImpl->mPrimaryCursor.SetProperty(Actor::Property::SIZE, Size(mImpl->mCursorWidth, mImpl->mCursor[PRIMARY_CURSOR].cursorHeight));
+  }
+  if(mImpl->mSecondaryCursorVisible && mImpl->mSecondaryCursor)
+  {
+    mImpl->mSecondaryCursor.SetProperty(Actor::Property::SIZE, Size(mImpl->mCursorWidth, mImpl->mCursor[SECONDARY_CURSOR].cursorHeight));
+  }
 }
 
 int Decorator::GetCursorWidth() const
@@ -2189,6 +2207,23 @@ const std::string& Decorator::GetHandleImage(HandleType handleType, HandleImageT
 void Decorator::SetHandleColor(const Vector4& color)
 {
   mImpl->mHandleColor = color;
+
+  Impl::HandleImpl& grabHandle      = mImpl->mHandle[GRAB_HANDLE];
+  Impl::HandleImpl& primaryHandle   = mImpl->mHandle[LEFT_SELECTION_HANDLE];
+  Impl::HandleImpl& secondaryHandle = mImpl->mHandle[RIGHT_SELECTION_HANDLE];
+
+  if(grabHandle.actor)
+  {
+    grabHandle.actor.SetProperty(Actor::Property::COLOR, color);
+  }
+  if(primaryHandle.actor)
+  {
+    primaryHandle.actor.SetProperty(Actor::Property::COLOR, color);
+  }
+  if(secondaryHandle.actor)
+  {
+    secondaryHandle.actor.SetProperty(Actor::Property::COLOR, color);
+  }
 }
 
 const Vector4& Decorator::GetHandleColor() const
@@ -2275,6 +2310,11 @@ void Decorator::ResizeHighlightQuads(unsigned int numberOfQuads)
 void Decorator::SetHighlightColor(const Vector4& color)
 {
   mImpl->mHighlightColor = color;
+
+  if(mImpl->mHighlightActor)
+  {
+    mImpl->mHighlightActor.SetProperty(Actor::Property::COLOR, color);
+  }
 }
 
 const Vector4& Decorator::GetHighlightColor() const