2023-10-31 13:57:04 -04:00
|
|
|
// FIXME: This fix ends up breaking some of the vanilla text inputs.
|
|
|
|
#if 0
|
2023-10-22 09:38:09 -04:00
|
|
|
#include <Geode/modify/CCTextInputNode.hpp>
|
|
|
|
|
|
|
|
using namespace geode::prelude;
|
|
|
|
|
|
|
|
// rob only uses `CCTextInputNode`s in mostly-flat hierarchies, which still
|
|
|
|
// happen to work with the weird vanilla code. this fix makes it work even in
|
|
|
|
// deep hierarchies, because the vanilla code uses `getParent` and manually
|
|
|
|
// calculates the child location in the world space based on that rather than
|
|
|
|
// using `convertToNodeSpace`.
|
|
|
|
|
|
|
|
struct CCTextInputNodeFix : Modify<CCTextInputNodeFix, CCTextInputNode> {
|
|
|
|
bool ccTouchBegan(CCTouch* touch, CCEvent* event) {
|
2023-10-22 09:53:40 -04:00
|
|
|
auto const touchPos = touch->getLocation();
|
|
|
|
auto const size = this->getContentSize();
|
|
|
|
auto const pos = this->convertToNodeSpace(touchPos) + m_textField->getAnchorPoint() * size;
|
2023-10-22 09:38:09 -04:00
|
|
|
|
|
|
|
if (pos.x < 0 || pos.x > size.width || pos.y < 0 || pos.y > size.height)
|
|
|
|
return false;
|
2023-10-22 09:46:21 -04:00
|
|
|
if (m_delegate && !m_delegate->allowTextInput(this))
|
2023-10-22 09:38:09 -04:00
|
|
|
return false;
|
|
|
|
|
|
|
|
this->onClickTrackNode(true);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
};
|
2023-10-31 13:57:04 -04:00
|
|
|
#endif
|