From: Bowon Ryu Date: Fri, 29 Dec 2023 05:49:36 +0000 (+0900) Subject: [Tizen] Fix cursor position issue X-Git-Tag: accepted/tizen/7.0/unified/20240104.073236^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1342e20d8e20d1397c97d9e050e1a50c18a97d30;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git [Tizen] Fix cursor position issue This patch fixes an issue where the cursor position is incorrectly positioned when padding is set for the textfield text editor. It is a problem caused by the wrong location of the cursor layer. Change-Id: Ifa0e9b752160761dfd6806cfc18dbf98576c71e3 Signed-off-by: Bowon Ryu --- diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index 315d6bc..59843ca 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -732,7 +732,9 @@ void TextEditor::OnRelayout(const Vector2& size, RelayoutContainer& container) } if(mCursorLayer) { - mCursorLayer.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top)); + // The cursor layer is added to the stencil in RenderText. + // Do not calculate the position because the stencil has already been resized excluding the padding size. + // There is no case where the text editor does not have a stencil. ResizeActor(mCursorLayer, contentSize); } diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index bd3de4e..b9174bc 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -666,7 +666,12 @@ void TextField::OnRelayout(const Vector2& size, RelayoutContainer& container) } if(mCursorLayer) { - mCursorLayer.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top)); + if(!mStencil) + { + // If there is a stencil, the cursor layer is added to the stencil in RenderText. + // Do not calculate the position because the stencil has already been resized excluding the padding size. + mCursorLayer.SetProperty(Actor::Property::POSITION, Vector2(padding.start, padding.top)); + } ResizeActor(mCursorLayer, contentSize); }