X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-impl-event-handler.cpp;h=e298a5ad7ba0281ae1addac2442bb85e1cb49c65;hp=d9fedd7f5659cb75de71e20daedf36081a3584a1;hb=d44300a6f74767fb66b96d5583a60779a50c4c65;hpb=c77c595b92d6c39b65515910480db935ab960a0c diff --git a/dali-toolkit/internal/text/text-controller-impl-event-handler.cpp b/dali-toolkit/internal/text/text-controller-impl-event-handler.cpp index d9fedd7..e298a5a 100644 --- a/dali-toolkit/internal/text/text-controller-impl-event-handler.cpp +++ b/dali-toolkit/internal/text/text-controller-impl-event-handler.cpp @@ -286,6 +286,8 @@ void ControllerImplEventHandler::OnCursorKeyEvent(Controller::Impl& impl, const ModelPtr& model = impl.mModel; LogicalModelPtr& logicalModel = model->mLogicalModel; VisualModelPtr& visualModel = model->mVisualModel; + uint32_t oldSelStart = eventData.mLeftSelectionPosition; + uint32_t oldSelEnd = eventData.mRightSelectionPosition; CharacterIndex& primaryCursorPosition = eventData.mPrimaryCursorPosition; CharacterIndex previousPrimaryCursorPosition = primaryCursorPosition; @@ -397,6 +399,11 @@ void ControllerImplEventHandler::OnCursorKeyEvent(Controller::Impl& impl, const // Update selection position after moving the cursor eventData.mLeftSelectionPosition = primaryCursorPosition; eventData.mRightSelectionPosition = primaryCursorPosition; + + if(impl.mSelectableControlInterface != nullptr && eventData.mDecorator->IsHighlightVisible()) + { + impl.mSelectableControlInterface->SelectionChanged(oldSelStart, oldSelEnd, eventData.mLeftSelectionPosition, eventData.mRightSelectionPosition); + } } if(isShiftModifier && impl.IsShowingRealText() && eventData.mShiftSelectionFlag) @@ -410,14 +417,11 @@ void ControllerImplEventHandler::OnCursorKeyEvent(Controller::Impl& impl, const int cursorPositionDelta = primaryCursorPosition - previousPrimaryCursorPosition; if(cursorPositionDelta > 0 || eventData.mRightSelectionPosition > 0u) // Check the boundary { - uint32_t oldStart = eventData.mLeftSelectionPosition; - uint32_t oldEnd = eventData.mRightSelectionPosition; - eventData.mRightSelectionPosition += cursorPositionDelta; if(impl.mSelectableControlInterface != nullptr) { - impl.mSelectableControlInterface->SelectionChanged(oldStart, oldEnd, eventData.mLeftSelectionPosition, eventData.mRightSelectionPosition); + impl.mSelectableControlInterface->SelectionChanged(oldSelStart, oldSelEnd, eventData.mLeftSelectionPosition, eventData.mRightSelectionPosition); } } selecting = true; @@ -477,8 +481,10 @@ void ControllerImplEventHandler::OnTapEvent(Controller::Impl& impl, const Event& if(impl.IsShowingRealText()) { // Convert from control's coords to text's coords. - const float xPosition = event.p2.mFloat - model->mScrollPosition.x; - const float yPosition = event.p3.mFloat - model->mScrollPosition.y; + const float xPosition = event.p2.mFloat - model->mScrollPosition.x; + const float yPosition = event.p3.mFloat - model->mScrollPosition.y; + uint32_t oldSelStart = eventData.mLeftSelectionPosition; + uint32_t oldSelEnd = eventData.mRightSelectionPosition; // Keep the tap 'x' position. Used to move the cursor. eventData.mCursorHookPositionX = xPosition; @@ -493,6 +499,11 @@ void ControllerImplEventHandler::OnTapEvent(Controller::Impl& impl, const Event& CharacterHitTest::TAP, matchedCharacter); + if(impl.mSelectableControlInterface != nullptr && eventData.mDecorator->IsHighlightVisible()) + { + impl.mSelectableControlInterface->SelectionChanged(oldSelStart, oldSelEnd, eventData.mPrimaryCursorPosition, eventData.mPrimaryCursorPosition); + } + // When the cursor position is changing, delay cursor blinking eventData.mDecorator->DelayCursorBlink(); }