X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Ftext-controller-impl-event-handler.cpp;h=9574f8b72bee8b5f3efd81435958411c64f8e125;hb=75fe6c4a2f784bd52ccf8eb16049317825338a6e;hp=2aafff7b1926411d002799ebb49c8a706e701d33;hpb=b65eaebffecede94f9c089f40448a499ab516f0c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git 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 2aafff7..9574f8b 100644 --- a/dali-toolkit/internal/text/text-controller-impl-event-handler.cpp +++ b/dali-toolkit/internal/text/text-controller-impl-event-handler.cpp @@ -54,6 +54,8 @@ bool ControllerImplEventHandler::ProcessInputEvents(Controller::Impl& impl) return false; } + unsigned int oldPos = eventData->mPrimaryCursorPosition; + if(eventData->mDecorator) { for(std::vector::iterator iter = eventData->mEventQueue.begin(); @@ -124,12 +126,14 @@ bool ControllerImplEventHandler::ProcessInputEvents(Controller::Impl& impl) { // Updates the cursor position and scrolls the text to make it visible. CursorInfo cursorInfo; + // Calculate the cursor position from the new cursor index. impl.GetCursorPosition(eventData->mPrimaryCursorPosition, cursorInfo); - if(nullptr != impl.mEditableControlInterface) + //only emit the event if the cursor is moved in current function. + if(nullptr != impl.mEditableControlInterface && eventData->mEventQueue.size() > 0) { - impl.mEditableControlInterface->CursorMoved(eventData->mPrimaryCursorPosition); + impl.mEditableControlInterface->CursorPositionChanged(oldPos, eventData->mPrimaryCursorPosition); } if(eventData->mUpdateCursorHookPosition) @@ -338,7 +342,7 @@ void ControllerImplEventHandler::OnCursorKeyEvent(Controller::Impl& impl, const const LineRun& line = *(visualModel->mLines.Begin() + previousLineIndex); // Get the next hit 'y' point. - const float hitPointY = cursorInfo.lineOffset - 0.5f * (line.ascender - line.descender); + const float hitPointY = cursorInfo.lineOffset - 0.5f * GetLineHeight(line); // Use the cursor hook position 'x' and the next hit 'y' position to calculate the new cursor index. bool matchedCharacter = false; @@ -374,7 +378,7 @@ void ControllerImplEventHandler::OnCursorKeyEvent(Controller::Impl& impl, const const LineRun& line = *(visualModel->mLines.Begin() + lineIndex + 1u); // Get the next hit 'y' point. - const float hitPointY = cursorInfo.lineOffset + cursorInfo.lineHeight + 0.5f * (line.ascender - line.descender); + const float hitPointY = cursorInfo.lineOffset + cursorInfo.lineHeight + 0.5f * GetLineHeight(line); // Use the cursor hook position 'x' and the next hit 'y' position to calculate the new cursor index. bool matchedCharacter = false;