From df920328a0b6ee577f05f821eede3e880e58b9f0 Mon Sep 17 00:00:00 2001 From: neit_nas Date: Tue, 12 Feb 2019 19:09:25 +0200 Subject: [PATCH] Checking, does the touch is within the height of the line, not the height of the sprite? --- cocos/2d/CCTextFieldTTF.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CCTextFieldTTF.cpp b/cocos/2d/CCTextFieldTTF.cpp index ed870d00fd5f..f6c7823aa49f 100644 --- a/cocos/2d/CCTextFieldTTF.cpp +++ b/cocos/2d/CCTextFieldTTF.cpp @@ -387,7 +387,7 @@ void TextFieldTTF::setCursorFromPoint(const Vec2 &point, const Camera* camera) auto sprite = getLetter(latterPosition); if (sprite) { - rect.size = sprite->getContentSize(); + rect.size = Size(sprite->getContentSize().width, _lineHeight); if (isScreenPointInRect(point, camera, sprite->getWorldToNodeTransform(), rect, nullptr)) { setCursorPosition(latterPosition);