X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali-toolkit%2Finternal%2Ftext%2Fcontroller%2Ftext-controller-event-handler.cpp;h=99cc2272d0605a5b457508366f4142b5cbdfcf24;hb=HEAD;hp=8e175b1e181752fbd1bb02b618e587548d44f250;hpb=b720eca641eed8e5905a13656b0f6c91223e8cef;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git diff --git a/dali-toolkit/internal/text/controller/text-controller-event-handler.cpp b/dali-toolkit/internal/text/controller/text-controller-event-handler.cpp index 8e175b1..99cc227 100644 --- a/dali-toolkit/internal/text/controller/text-controller-event-handler.cpp +++ b/dali-toolkit/internal/text/controller/text-controller-event-handler.cpp @@ -379,16 +379,19 @@ void Controller::EventHandler::AnchorEvent(Controller& controller, float x, floa CharacterIndex cursorPosition = 0u; // Convert from control's coords to text's coords. + const float xPosition = x - controller.mImpl->mModel->mScrollPosition.x; const float yPosition = y - controller.mImpl->mModel->mScrollPosition.y; + Vector2 visualTransformOffset = controller.mImpl->mModel->mVisualTransformOffset; + // Whether to touch point hits on a glyph. bool matchedCharacter = false; cursorPosition = Text::GetClosestCursorIndex(controller.mImpl->mModel->mVisualModel, controller.mImpl->mModel->mLogicalModel, controller.mImpl->mMetrics, xPosition, - yPosition, + yPosition - visualTransformOffset.y, CharacterHitTest::TAP, matchedCharacter); @@ -405,15 +408,16 @@ void Controller::EventHandler::AnchorEvent(Controller& controller, float x, floa // TODO: in mutable text, the anchor color and underline run index should be able to be updated. if(!controller.IsEditable()) { + // If there is a markup clicked color attribute, use it. Otherwise, use the property color. if(controller.mImpl->mModel->mLogicalModel->mColorRuns.Count() > anchor.colorRunIndex) { ColorRun& colorRun = *(controller.mImpl->mModel->mLogicalModel->mColorRuns.Begin() + anchor.colorRunIndex); - colorRun.color = anchor.clickedColor; + colorRun.color = anchor.isMarkupClickedColorSet ? anchor.markupClickedColor : controller.mImpl->mAnchorClickedColor; } if(controller.mImpl->mModel->mLogicalModel->mUnderlinedCharacterRuns.Count() > anchor.underlinedCharacterRunIndex) { UnderlinedCharacterRun& underlineRun = *(controller.mImpl->mModel->mLogicalModel->mUnderlinedCharacterRuns.Begin() + anchor.underlinedCharacterRunIndex); - underlineRun.properties.color = anchor.clickedColor; + underlineRun.properties.color = anchor.isMarkupClickedColorSet ? anchor.markupClickedColor : controller.mImpl->mAnchorClickedColor; } controller.mImpl->ClearFontData(); @@ -764,13 +768,13 @@ bool Controller::EventHandler::DeleteEvent(Controller& controller, int keyCode) else if((controller.mImpl->mEventData->mPrimaryCursorPosition > 0) && (keyCode == Dali::DALI_KEY_BACKSPACE)) { // Remove the character before the current cursor position - removed = TextUpdater::RemoveText(controller, -1, 1, UPDATE_INPUT_STYLE); + removed = TextUpdater::RemoveText(controller, -1, 1, UPDATE_INPUT_STYLE, false); } else if((controller.mImpl->mEventData->mPrimaryCursorPosition < controller.mImpl->mModel->mLogicalModel->mText.Count()) && (keyCode == Dali::DevelKey::DALI_KEY_DELETE)) { // Remove the character after the current cursor position - removed = TextUpdater::RemoveText(controller, 0, 1, UPDATE_INPUT_STYLE); + removed = TextUpdater::RemoveText(controller, 0, 1, UPDATE_INPUT_STYLE, false); } if(removed) @@ -821,7 +825,8 @@ InputMethodContext::CallbackData Controller::EventHandler::OnInputMethodContextE const bool textDeleted = TextUpdater::RemoveText(controller, inputMethodContextEvent.cursorOffset, inputMethodContextEvent.numberOfChars, - DONT_UPDATE_INPUT_STYLE); + DONT_UPDATE_INPUT_STYLE, + false); if(textDeleted) {