Merge pull request #2207 from csy1988525/master

fixed a bug when button's parent is hided, the button still can responce to clicked event
This commit is contained in:
minggo 2013-05-15 23:44:25 -07:00
commit 5f57ec2d1b
1 changed files with 8 additions and 0 deletions

View File

@ -638,6 +638,14 @@ bool CCControlButton::ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent)
return false;
}
for (CCNode *c = this->m_pParent; c != NULL; c = c->getParent())
{
if (c->isVisible() == false)
{
return false;
}
}
m_isPushed = true;
this->setHighlighted(true);
sendActionsForControlEvents(CCControlEventTouchDown);