From c9b0661fc1ea6a9a21a746cc7ac3fd46ef3e1659 Mon Sep 17 00:00:00 2001 From: Victor Cebollada Date: Thu, 13 Aug 2015 09:38:03 +0100 Subject: [PATCH] Fix cursor's position when there is no text and the width is > 1. Change-Id: I03fa21885b874624c1414656f51f1b5bcaacf650 Signed-off-by: Victor Cebollada --- dali-toolkit/internal/text/decorator/text-decorator.cpp | 4 ++-- dali-toolkit/internal/text/text-controller-impl.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index c4d0a68..2f8d0e4 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -323,7 +323,7 @@ struct Decorator::Impl : public ConnectionTracker CreateGrabHandle(); - grabHandle.actor.SetPosition( position.x, + grabHandle.actor.SetPosition( position.x - floor( 0.5f * mCursorWidth ), position.y + grabHandle.lineHeight ); // TODO : Fix for multiline. } grabHandle.actor.SetVisible( isVisible ); @@ -471,7 +471,7 @@ struct Decorator::Impl : public ConnectionTracker cursor = CreateSolidColorActor( color ); cursor.SetSortModifier( DECORATION_DEPTH_INDEX ); cursor.SetParentOrigin( ParentOrigin::TOP_LEFT ); // Need to set the default parent origin as CreateSolidColorActor() sets a different one. - cursor.SetAnchorPoint( AnchorPoint::TOP_CENTER ); + cursor.SetAnchorPoint( AnchorPoint::TOP_RIGHT ); } // Add or Remove cursor(s) from parent diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 9d53ae6..3da7138 100644 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -1473,7 +1473,7 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical, cursorInfo.lineHeight = GetDefaultFontLineHeight(); cursorInfo.primaryCursorHeight = cursorInfo.lineHeight; - cursorInfo.primaryPosition.x = 1.f; + cursorInfo.primaryPosition.x = mEventData->mDecorator->GetCursorWidth(); cursorInfo.primaryPosition.y = 0.f; // Nothing else to do. @@ -1742,7 +1742,7 @@ void Controller::Impl::UpdateCursorPosition() { case LayoutEngine::HORIZONTAL_ALIGN_BEGIN: { - cursorPosition.x = 1.f; + cursorPosition.x = mEventData->mDecorator->GetCursorWidth(); break; } case LayoutEngine::HORIZONTAL_ALIGN_CENTER: -- 2.7.4