From: joogab yun Date: Mon, 7 Oct 2019 00:43:22 +0000 (+0000) Subject: Merge "Fixed issue where only the last line was aligned in the case of a multiline... X-Git-Tag: dali_1.4.41~2 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=031078c7bcb293beebd4918b03ae1809e00fe958;hp=9d90f1c756062234808cbfab600260fc4a42d9bb Merge "Fixed issue where only the last line was aligned in the case of a multiline input text editor" into devel/master --- diff --git a/dali-toolkit/internal/text/text-controller-impl.cpp b/dali-toolkit/internal/text/text-controller-impl.cpp index 90eb88c..2686153 100755 --- a/dali-toolkit/internal/text/text-controller-impl.cpp +++ b/dali-toolkit/internal/text/text-controller-impl.cpp @@ -110,7 +110,8 @@ EventData::EventData( DecoratorPtr decorator, InputMethodContext& inputMethodCon mIsPlaceholderPixelSize( false ), mIsPlaceholderElideEnabled( false ), mPlaceholderEllipsisFlag( false ), - mShiftSelectionFlag( true ) + mShiftSelectionFlag( true ), + mUpdateAlignment( false ) { } diff --git a/dali-toolkit/internal/text/text-controller-impl.h b/dali-toolkit/internal/text/text-controller-impl.h index 5527870..5dd231a 100755 --- a/dali-toolkit/internal/text/text-controller-impl.h +++ b/dali-toolkit/internal/text/text-controller-impl.h @@ -167,6 +167,7 @@ struct EventData bool mIsPlaceholderElideEnabled : 1; ///< True if the placeholder text's elide is enabled. bool mPlaceholderEllipsisFlag : 1; ///< True if the text controller sets the placeholder ellipsis. bool mShiftSelectionFlag : 1; ///< True if the text selection using Shift key is enabled. + bool mUpdateAlignment : 1; ///< True if the whole text needs to be full aligned.. }; struct ModifyEvent diff --git a/dali-toolkit/internal/text/text-controller.cpp b/dali-toolkit/internal/text/text-controller.cpp index fee1690..44a6788 100755 --- a/dali-toolkit/internal/text/text-controller.cpp +++ b/dali-toolkit/internal/text/text-controller.cpp @@ -396,6 +396,11 @@ void Controller::SetHorizontalAlignment( Text::HorizontalAlignment::Type alignme // Set the flag to redo the alignment operation. mImpl->mOperationsPending = static_cast( mImpl->mOperationsPending | ALIGN ); + if( mImpl->mEventData ) + { + mImpl->mEventData->mUpdateAlignment = true; + } + mImpl->RequestRelayout(); } } @@ -3945,11 +3950,23 @@ bool Controller::DoRelayout( const Size& size, // The laid-out lines. Vector& lines = mImpl->mModel->mVisualModel->mLines; + CharacterIndex alignStartIndex = startIndex; + Length alignRequestedNumberOfCharacters = requestedNumberOfCharacters; + + // the whole text needs to be full aligned. + // If you do not do a full aligned, only the last line of the multiline input is aligned. + if( mImpl->mEventData && mImpl->mEventData->mUpdateAlignment ) + { + alignStartIndex = 0u; + alignRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count(); + mImpl->mEventData->mUpdateAlignment = false; + } + // 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, + alignStartIndex, + alignRequestedNumberOfCharacters, mImpl->mModel->mHorizontalAlignment, lines, mImpl->mModel->mAlignmentOffset,