Fixes some alignment issues. 13/46913/1
authorv.cebollada <v.cebollada@samsung.com>
Thu, 27 Aug 2015 07:19:25 +0000 (16:19 +0900)
committerv.cebollada <v.cebollada@samsung.com>
Thu, 27 Aug 2015 07:43:32 +0000 (16:43 +0900)
* Align decorator when text-field's size changes.
* Fixes the text's scroll position when the text-field's size changes.

Change-Id: Iede1a116b6855da47a689e4da7e70775e13ed821
Signed-off-by: v.cebollada <v.cebollada@samsung.com>
dali-toolkit/internal/text/text-controller.cpp

index e3b29bd..ccc60fa 100644 (file)
@@ -641,11 +641,24 @@ bool Controller::Relayout( const Size& size )
   // Do not re-do any operation until something changes.
   mImpl->mOperationsPending = NO_OPERATION;
 
+  // Keep the current offset and alignment as it will be used to update the decorator's positions.
+  Vector2 offset;
+  if( mImpl->mEventData )
+  {
+    offset = mImpl->mAlignmentOffset + mImpl->mEventData->mScrollPosition;
+  }
+
   // After doing the text layout, the alignment offset to place the actor in the desired position can be calculated.
   CalculateTextAlignment( size );
 
   if( mImpl->mEventData )
   {
+    // If there is a nex size, the scroll position needs to be clamped.
+    mImpl->ClampHorizontalScroll( layoutSize );
+
+    // Update the decorator's positions.
+    mImpl->mEventData->mDecorator->UpdatePositions( mImpl->mAlignmentOffset + mImpl->mEventData->mScrollPosition - offset );
+
     // Move the cursor, grab handle etc.
     updated = mImpl->ProcessInputEvents() || updated;
   }