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 e0c2306..c1f4179 100644 (file)
@@ -55,6 +55,7 @@ void CommonTextUtils::RenderText(
   float&                            alignmentOffset,
   Actor&                            renderableActor,
   Actor&                            backgroundActor,
   float&                            alignmentOffset,
   Actor&                            renderableActor,
   Actor&                            backgroundActor,
+  Actor&                            cursorLayerActor,
   Toolkit::Control&                 stencil,
   std::vector<Actor>&               clippingDecorationActors,
   std::vector<Toolkit::TextAnchor>& anchorActors,
   Toolkit::Control&                 stencil,
   std::vector<Actor>&               clippingDecorationActors,
   std::vector<Toolkit::TextAnchor>& anchorActors,
@@ -132,10 +133,6 @@ void CommonTextUtils::RenderText(
       {
         highlightActor = *it;
       }
       {
         highlightActor = *it;
       }
-      else if(it->GetProperty<std::string>(Dali::Actor::Property::NAME) == "CursorLayerActor")
-      {
-        it->RaiseToTop();
-      }
     }
     clippingDecorationActors.clear();
 
     }
     clippingDecorationActors.clear();
 
@@ -156,6 +153,12 @@ void CommonTextUtils::RenderText(
         backgroundActor.LowerToBottom();
       }
     }
         backgroundActor.LowerToBottom();
       }
     }
+
+    if(cursorLayerActor)
+    {
+      cursorLayerActor.RaiseToTop();
+    }
+
     SynchronizeTextAnchorsInParent(textActor, controller, anchorActors);
   }
 }
     SynchronizeTextAnchorsInParent(textActor, controller, anchorActors);
   }
 }
index f6a9a2f..a0d0ad4 100644 (file)
@@ -60,6 +60,7 @@ public:
     float&                           alignmentOffset,
     Actor&                           renderableActor,
     Actor&                           backgroundActor,
     float&                           alignmentOffset,
     Actor&                           renderableActor,
     Actor&                           backgroundActor,
+    Actor&                           cursorLayerActor,
     Toolkit::Control&                stencil,
     std::vector<Actor>&              clippingDecorationActors,
     std::vector<Toolkit::TextAnchor>& anchorActors,
     Toolkit::Control&                stencil,
     std::vector<Actor>&              clippingDecorationActors,
     std::vector<Toolkit::TextAnchor>& anchorActors,
index d3c0154..d6bae90 100644 (file)
@@ -776,7 +776,7 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container)
 
 void TextEditor::RenderText(Text::Controller::UpdateTextType updateTextType)
 {
 
 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();
   if(mRenderableActor)
   {
     ApplyScrollPosition();
index b1ea8e7..3cbd0b9 100644 (file)
@@ -716,7 +716,7 @@ Text::ControllerPtr TextField::GetTextController()
 
 void TextField::RenderText(Text::Controller::UpdateTextType updateTextType)
 {
 
 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()
 }
 
 void TextField::OnKeyInputFocusGained()
index d005d94..f4d2ca4 100644 (file)
@@ -746,12 +746,15 @@ struct Decorator::Impl : public ConnectionTracker
       {
         layer.SetProperty(Actor::Property::NAME, "ActiveLayerActor");
       }
       {
         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;
 #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);
       }
 
       layer.SetProperty(Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER);