Fix cursor's position when there is no text and the width is > 1. 17/46017/1
authorVictor Cebollada <v.cebollada@samsung.com>
Thu, 13 Aug 2015 08:38:03 +0000 (09:38 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Thu, 13 Aug 2015 09:01:17 +0000 (10:01 +0100)
Change-Id: I03fa21885b874624c1414656f51f1b5bcaacf650
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/text/decorator/text-decorator.cpp
dali-toolkit/internal/text/text-controller-impl.cpp

index c4d0a6826403028b0cfce2fadf07b28edf6dfa7e..2f8d0e43ef47c25292d0aec71d8cca8333e58af3 100644 (file)
@@ -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
index 9d53ae665b16abfa20f180fb71c7470f5af07c2b..3da71385abec07e1306ab5c865f1962faf72323c 100644 (file)
@@ -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: