Fix the cursor vertical position when there is no text. 49/40049/1
authorVictor Cebollada <v.cebollada@samsung.com>
Thu, 28 May 2015 08:01:00 +0000 (09:01 +0100)
committerVictor Cebollada <v.cebollada@samsung.com>
Thu, 28 May 2015 08:01:00 +0000 (09:01 +0100)
Change-Id: I41f58f13d50528266974cc78b974eebdcc9e08f3
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/text/text-controller-impl.cpp

index ec74f67..35c43b0 100644 (file)
@@ -1089,6 +1089,25 @@ void Controller::Impl::UpdateCursorPosition()
       }
     }
 
+    switch( mLayoutEngine.GetVerticalAlignment() )
+    {
+      case LayoutEngine::VERTICAL_ALIGN_TOP:
+      {
+        cursorPosition.y = 0.f;
+        break;
+      }
+      case LayoutEngine::VERTICAL_ALIGN_CENTER:
+      {
+        cursorPosition.y = floorf( 0.5f * ( mControlSize.height - lineHeight ) );
+        break;
+      }
+      case LayoutEngine::VERTICAL_ALIGN_BOTTOM:
+      {
+        cursorPosition.y = mControlSize.height - lineHeight;
+        break;
+      }
+    }
+
     mEventData->mDecorator->SetPosition( PRIMARY_CURSOR,
                                          cursorPosition.x,
                                          cursorPosition.y,