fix input nodes being clickable when invisible

This commit is contained in:
HJfod 2024-02-10 13:15:07 +02:00
parent 3b7621c8a0
commit bf43946daf

View file

@ -16,6 +16,11 @@ struct TextInputNodeFix : Modify<TextInputNodeFix, CCTextInputNode> {
bool ccTouchBegan(cocos2d::CCTouch* touch, cocos2d::CCEvent* event) {
if (this->getTag() != INPUT_TAG) return CCTextInputNode::ccTouchBegan(touch, event);
if (!this->isVisible()) {
this->onClickTrackNode(false);
return false;
}
auto const touchPos = touch->getLocation();
auto const size = this->getContentSize();
auto const pos = this->convertToNodeSpace(touchPos) + m_textField->getAnchorPoint() * size;