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
|
@ -345,17 +345,22 @@ void CCControlSwitch::setOn(bool isOn)
|
||||||
void CCControlSwitch::setOn(bool isOn, bool animated)
|
void CCControlSwitch::setOn(bool isOn, bool animated)
|
||||||
{
|
{
|
||||||
m_bOn = isOn;
|
m_bOn = isOn;
|
||||||
|
|
||||||
m_pSwitchSprite->runAction
|
if (animated) {
|
||||||
(
|
m_pSwitchSprite->runAction
|
||||||
CCActionTween::create
|
(
|
||||||
(
|
CCActionTween::create
|
||||||
0.2f,
|
(
|
||||||
"sliderXPosition",
|
0.2f,
|
||||||
m_pSwitchSprite->getSliderXPosition(),
|
"sliderXPosition",
|
||||||
(m_bOn) ? m_pSwitchSprite->getOnPosition() : m_pSwitchSprite->getOffPosition()
|
m_pSwitchSprite->getSliderXPosition(),
|
||||||
)
|
(m_bOn) ? m_pSwitchSprite->getOnPosition() : m_pSwitchSprite->getOffPosition()
|
||||||
);
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_pSwitchSprite->setSliderXPosition((m_bOn) ? m_pSwitchSprite->getOnPosition() : m_pSwitchSprite->getOffPosition());
|
||||||
|
}
|
||||||
|
|
||||||
sendActionsForControlEvents(CCControlEventValueChanged);
|
sendActionsForControlEvents(CCControlEventValueChanged);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue