Merge "Fix the cursor vertical position when there is no text." into tizen
authorPaul Wisbey <p.wisbey@samsung.com>
Thu, 28 May 2015 13:44:53 +0000 (06:44 -0700)
committerGerrit Code Review <gerrit@review.vlan103.tizen.org>
Thu, 28 May 2015 13:44:53 +0000 (06:44 -0700)
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,