X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller.cpp;h=f10d93ec482d4348f12112230c6cca5b45dba64d;hb=b498966b0fc8a3ed14ed20129fb20f2a66c75868;hp=5a82cc9b6c77f628af7d216b45a89adb3fd2279a;hpb=ee431c9e2b342243f9e0e2b6bafca7505d321457;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index 5a82cc9..f10d93e 100644 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -1467,6 +1467,18 @@ const ModelInterface* const Controller::GetTextModel() const return mImpl->mModel.Get(); } +float Controller::GetScrollAmountByUserInput() +{ + float scrollAmount = 0.0f; + + if (NULL != mImpl->mEventData && mImpl->mEventData->mCheckScrollAmount) + { + scrollAmount = mImpl->mModel->mScrollPosition.y - mImpl->mModel->mScrollPositionLast.y; + mImpl->mEventData->mCheckScrollAmount = false; + } + return scrollAmount; +} + // public : Relayout. Controller::UpdateTextType Controller::Relayout( const Size& size ) @@ -1508,6 +1520,9 @@ Controller::UpdateTextType Controller::Relayout( const Size& size ) // Set the update info to relayout the whole text. mImpl->mTextUpdateInfo.mFullRelayoutNeeded = true; mImpl->mTextUpdateInfo.mCharacterIndex = 0u; + + // Store the size used to layout the text. + mImpl->mModel->mVisualModel->mControlSize = size; } // Whether there are modify events. @@ -1535,6 +1550,7 @@ Controller::UpdateTextType Controller::Relayout( const Size& size ) // Do not re-do any operation until something changes. mImpl->mOperationsPending = NO_OPERATION; + mImpl->mModel->mScrollPositionLast = mImpl->mModel->mScrollPosition; // Whether the text control is editable const bool isEditable = NULL != mImpl->mEventData; @@ -1683,6 +1699,8 @@ bool Controller::KeyEvent( const Dali::KeyEvent& keyEvent ) ( Dali::DALI_KEY_CURSOR_UP == keyCode ) || ( Dali::DALI_KEY_CURSOR_DOWN == keyCode ) ) { + mImpl->mEventData->mCheckScrollAmount = true; + Event event( Event::CURSOR_KEY_EVENT ); event.p1.mInt = keyCode; mImpl->mEventData->mEventQueue.push_back( event ); @@ -2664,9 +2682,6 @@ bool Controller::DoRelayout( const Size& size, mImpl->mModel->mVisualModel->SetLayoutSize( layoutSize ); } } // view updated - - // Store the size used to layout the text. - mImpl->mModel->mVisualModel->mControlSize = size; } if( NO_OPERATION != ( ALIGN & operations ) ) @@ -2674,11 +2689,14 @@ bool Controller::DoRelayout( const Size& size, // The laid-out lines. Vector& lines = mImpl->mModel->mVisualModel->mLines; + // Need to align with the control's size as the text may contain lines + // starting either with left to right text or right to left. mImpl->mLayoutEngine.Align( size, startIndex, requestedNumberOfCharacters, mImpl->mModel->mHorizontalAlignment, - lines ); + lines, + mImpl->mModel->mAlignmentOffset ); viewUpdated = true; } @@ -2789,6 +2807,8 @@ void Controller::TextInsertedEvent() return; } + mImpl->mEventData->mCheckScrollAmount = true; + // The natural size needs to be re-calculated. mImpl->mRecalculateNaturalSize = true; @@ -2805,6 +2825,8 @@ void Controller::TextDeletedEvent() return; } + mImpl->mEventData->mCheckScrollAmount = true; + // The natural size needs to be re-calculated. mImpl->mRecalculateNaturalSize = true; @@ -2831,6 +2853,7 @@ void Controller::SelectEvent( float x, float y, bool selectAll ) mImpl->mEventData->mEventQueue.push_back( event ); } + mImpl->mEventData->mCheckScrollAmount = true; mImpl->RequestRelayout(); } }