一个widget放在touchgroup里,在点击widget的时候touchgroup setTouchEnabled(false),再touchgroup setTouchEnabled(true)的时候,点击 widget以外的部分, 竟然还能响应widget的move事件, 跳过了begin事件
你好,请问你使用的引擎是什么版本呢?能否提供一段代码说明该问题呢?
2.2.3版本的,Widget->addTouchEventListener(this, toucheventselector(HelloWorld::onBaseTouch));
void HelloWorld::onBaseTouch(CCObject* pTouch, EventType eventType)
{
if (eventType == TOUCH_EVENT_BEGAN)
{
this->getParent()->setTouchEnabled(false);
}
if (eventType == TOUCH_EVENT_MOVED)
{
//当this->getParent()->setTouchEnabled(true)时,会执行到这,跳过TOUCH_EVENT_BEGAN
}
}