bool consumed = false;
if(keyName == KEY_C_NAME || keyName == KEY_INSERT_NAME || logicalKey == KEY_C_NAME || logicalKey == KEY_INSERT_NAME)
{
- // Ctrl-C or Ctrl+Insert to copy the selected text
- controller.TextPopupButtonTouched(Toolkit::TextSelectionPopup::COPY);
+ if(!keyEvent.IsRepeat())
+ {
+ // Ctrl-C or Ctrl+Insert to copy the selected text
+ controller.TextPopupButtonTouched(Toolkit::TextSelectionPopup::COPY);
+ }
consumed = true;
}
else if(keyName == KEY_V_NAME || logicalKey == KEY_V_NAME)
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);
- for(const auto& anchor : controller.mImpl->mModel->mLogicalModel->mAnchors)
+ for(auto& anchor : controller.mImpl->mModel->mLogicalModel->mAnchors)
{
// Anchor clicked if the calculated cursor position is within the range of anchor.
if(cursorPosition >= anchor.startIndex && cursorPosition < anchor.endIndex)
{
- if(controller.mImpl->mAnchorControlInterface && anchor.href)
+ if(controller.mImpl->mAnchorControlInterface)
{
- std::string href(anchor.href);
+ if(!anchor.isClicked)
+ {
+ anchor.isClicked = true;
+ // 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.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.isMarkupClickedColorSet ? anchor.markupClickedColor : controller.mImpl->mAnchorClickedColor;
+ }
+
+ controller.mImpl->ClearFontData();
+ controller.mImpl->mOperationsPending = static_cast<OperationsMask>(controller.mImpl->mOperationsPending | COLOR);
+ controller.mImpl->RequestRelayout();
+ }
+ }
+
+ std::string href = anchor.href == nullptr ? "" : anchor.href;
controller.mImpl->mAnchorControlInterface->AnchorClicked(href);
break;
}
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)
const bool textDeleted = TextUpdater::RemoveText(controller,
inputMethodContextEvent.cursorOffset,
inputMethodContextEvent.numberOfChars,
- DONT_UPDATE_INPUT_STYLE);
+ DONT_UPDATE_INPUT_STYLE,
+ false);
if(textDeleted)
{