Fix for cursor position when a void text is set.
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / text / text-controller-impl.cpp
index 9d53ae6..7dd88e4 100644 (file)
@@ -1473,7 +1473,7 @@ void Controller::Impl::GetCursorPosition( CharacterIndex logical,
     cursorInfo.lineHeight = GetDefaultFontLineHeight();
     cursorInfo.primaryCursorHeight = cursorInfo.lineHeight;
 
     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.
     cursorInfo.primaryPosition.y = 0.f;
 
     // Nothing else to do.
@@ -1709,7 +1709,7 @@ void Controller::Impl::UpdateCursorPosition()
     return;
   }
 
     return;
   }
 
-  if( IsShowingPlaceholderText() )
+  if( IsShowingPlaceholderText() || ( 0u == mLogicalModel->mText.Count() ) )
   {
     // Do not want to use the place-holder text to set the cursor position.
 
   {
     // Do not want to use the place-holder text to set the cursor position.
 
@@ -1742,7 +1742,7 @@ void Controller::Impl::UpdateCursorPosition()
     {
       case LayoutEngine::HORIZONTAL_ALIGN_BEGIN:
       {
     {
       case LayoutEngine::HORIZONTAL_ALIGN_BEGIN:
       {
-        cursorPosition.x = 1.f;
+        cursorPosition.x = mEventData->mDecorator->GetCursorWidth();
         break;
       }
       case LayoutEngine::HORIZONTAL_ALIGN_CENTER:
         break;
       }
       case LayoutEngine::HORIZONTAL_ALIGN_CENTER: