Fix cursor visible issue on text editing 04/272604/1
authorBowon Ryu <bowon.ryu@samsung.com>
Mon, 21 Mar 2022 11:10:37 +0000 (20:10 +0900)
committerBowon Ryu <bowon.ryu@samsung.com>
Mon, 21 Mar 2022 11:19:03 +0000 (20:19 +0900)
I made a prev patch to ensure that the cursor layer is on top.
16ef097a0b2d3945a5045db7bb2f3896ed5a5a95

But cursor layer in clippingDecorationActors(in RednerText) is processed only once.

Therefore, if user edit while the background is present, the cursor still invisible.

This patch passes the cursor layer actor as an argument to RenderText(),
so that the cursor is always on top.

Change-Id: I27e3334f74dbca34aaae18089082125c871935fa
Signed-off-by: Bowon Ryu <bowon.ryu@samsung.com>
dali-toolkit/internal/controls/text-controls/common-text-utils.cpp
dali-toolkit/internal/controls/text-controls/common-text-utils.h
dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp
dali-toolkit/internal/controls/text-controls/text-field-impl.cpp
dali-toolkit/internal/text/decorator/text-decorator.cpp

index e0c2306ab6e5336929ba1849bcfef16684b118d9..c1f4179d3e3372d7a345ffc3cf4542e3165ac4f5 100644 (file)
@@ -55,6 +55,7 @@ void CommonTextUtils::RenderText(
   float&                            alignmentOffset,
   Actor&                            renderableActor,
   Actor&                            backgroundActor,
+  Actor&                            cursorLayerActor,
   Toolkit::Control&                 stencil,
   std::vector<Actor>&               clippingDecorationActors,
   std::vector<Toolkit::TextAnchor>& anchorActors,
@@ -132,10 +133,6 @@ void CommonTextUtils::RenderText(
       {
         highlightActor = *it;
       }
-      else if(it->GetProperty<std::string>(Dali::Actor::Property::NAME) == "CursorLayerActor")
-      {
-        it->RaiseToTop();
-      }
     }
     clippingDecorationActors.clear();
 
@@ -156,6 +153,12 @@ void CommonTextUtils::RenderText(
         backgroundActor.LowerToBottom();
       }
     }
+
+    if(cursorLayerActor)
+    {
+      cursorLayerActor.RaiseToTop();
+    }
+
     SynchronizeTextAnchorsInParent(textActor, controller, anchorActors);
   }
 }
index f6a9a2fb95b3e8e78bbb6ebee1ce572fbb741f1c..a0d0ad48c6e0fc10e8ca46e753e388ed5b925a53 100644 (file)
@@ -60,6 +60,7 @@ public:
     float&                           alignmentOffset,
     Actor&                           renderableActor,
     Actor&                           backgroundActor,
+    Actor&                           cursorLayerActor,
     Toolkit::Control&                stencil,
     std::vector<Actor>&              clippingDecorationActors,
     std::vector<Toolkit::TextAnchor>& anchorActors,
index d3c01546e59b356e675f4701244f79dff4eb0232..d6bae90dd6985950498b75ba735b01a4a56f0410 100644 (file)
@@ -776,7 +776,7 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container)
 
 void TextEditor::RenderText(Text::Controller::UpdateTextType updateTextType)
 {
-  CommonTextUtils::RenderText(Self(), mRenderer, mController, mDecorator, mAlignmentOffset, mRenderableActor, mBackgroundActor, mStencil, mClippingDecorationActors, mAnchorActors, updateTextType);
+  CommonTextUtils::RenderText(Self(), mRenderer, mController, mDecorator, mAlignmentOffset, mRenderableActor, mBackgroundActor, mCursorLayer, mStencil, mClippingDecorationActors, mAnchorActors, updateTextType);
   if(mRenderableActor)
   {
     ApplyScrollPosition();
index b1ea8e7829dbed4990a94f688fc0c5826479cb90..3cbd0b90617ede57903734d123ba8ed02f347755 100644 (file)
@@ -716,7 +716,7 @@ Text::ControllerPtr TextField::GetTextController()
 
 void TextField::RenderText(Text::Controller::UpdateTextType updateTextType)
 {
-  CommonTextUtils::RenderText(Self(), mRenderer, mController, mDecorator, mAlignmentOffset, mRenderableActor, mBackgroundActor, mStencil, mClippingDecorationActors, mAnchorActors, updateTextType);
+  CommonTextUtils::RenderText(Self(), mRenderer, mController, mDecorator, mAlignmentOffset, mRenderableActor, mBackgroundActor, mCursorLayer, mStencil, mClippingDecorationActors, mAnchorActors, updateTextType);
 }
 
 void TextField::OnKeyInputFocusGained()
index d005d94f93834d5e17b57ba7b1b063a4ea94114d..f4d2ca41387a23862319beaa2ffbb3e6bf94813b 100644 (file)
@@ -746,12 +746,15 @@ struct Decorator::Impl : public ConnectionTracker
       {
         layer.SetProperty(Actor::Property::NAME, "ActiveLayerActor");
       }
+      else if(type == DecorationType::CURSOR_LAYER)
+      {
+        layer.SetProperty(Actor::Property::NAME, "CursorLayerActor");
+      }
 #endif
       bool needsClipping = false;
       if(type == DecorationType::CURSOR_LAYER)
       {
         needsClipping = true;
-        layer.SetProperty(Actor::Property::NAME, "CursorLayerActor");
       }
 
       layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);