mirror of https://github.com/axmolengine/axmol.git
Update extensions/GUI/CCControlExtension/CCControlSwitch.cpp
implement setOn(isOn,false)
This commit is contained in:
parent
9b5d0bd251
commit
3316f8c961
|
@ -346,6 +346,7 @@ void CCControlSwitch::setOn(bool isOn, bool animated)
|
|||
{
|
||||
m_bOn = isOn;
|
||||
|
||||
if (animated) {
|
||||
m_pSwitchSprite->runAction
|
||||
(
|
||||
CCActionTween::create
|
||||
|
@ -356,6 +357,10 @@ void CCControlSwitch::setOn(bool isOn, bool animated)
|
|||
(m_bOn) ? m_pSwitchSprite->getOnPosition() : m_pSwitchSprite->getOffPosition()
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
m_pSwitchSprite->setSliderXPosition((m_bOn) ? m_pSwitchSprite->getOnPosition() : m_pSwitchSprite->getOffPosition());
|
||||
}
|
||||
|
||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue