MCPcopy Create free account
hub / github.com/axmolengine/axmol / onPressStateChangedToNormal

Method onPressStateChangedToNormal

core/ui/UIButton.cpp:470–519  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

468}
469
470void Button::onPressStateChangedToNormal()
471{
472 _buttonNormalRenderer->setVisible(true);
473 _buttonClickedRenderer->setVisible(false);
474 _buttonDisabledRenderer->setVisible(false);
475 _buttonNormalRenderer->setState(Scale9Sprite::State::NORMAL);
476
477 if (_pressedTextureLoaded)
478 {
479 if (_pressedActionEnabled)
480 {
481 _buttonNormalRenderer->stopAllActions();
482 _buttonClickedRenderer->stopAllActions();
483
484 // Action *zoomAction = ScaleTo::create(ZOOM_ACTION_TIME_STEP, _normalTextureScaleXInSize,
485 // _normalTextureScaleYInSize);
486 // fixme: the zoomAction will run in the next frame which will cause the _buttonNormalRenderer to a wrong
487 // scale
488 _buttonNormalRenderer->setScale(1.0);
489 _buttonClickedRenderer->setScale(1.0);
490
491 if (nullptr != _titleRenderer)
492 {
493 _titleRenderer->stopAllActions();
494 if (_unifySize)
495 {
496 Action* zoomTitleAction = ScaleTo::create(ZOOM_ACTION_TIME_STEP, 1.0f, 1.0f);
497 _titleRenderer->runAction(zoomTitleAction);
498 }
499 else
500 {
501 _titleRenderer->setScaleX(1.0f);
502 _titleRenderer->setScaleY(1.0f);
503 }
504 }
505 }
506 }
507 else
508 {
509 _buttonNormalRenderer->stopAllActions();
510 _buttonNormalRenderer->setScale(1.0);
511
512 if (nullptr != _titleRenderer)
513 {
514 _titleRenderer->stopAllActions();
515 _titleRenderer->setScaleX(1.0f);
516 _titleRenderer->setScaleY(1.0f);
517 }
518 }
519}
520
521void Button::onPressStateChangedToPressed()
522{

Callers

nothing calls this directly

Calls 8

createFunction · 0.85
stopAllActionsMethod · 0.80
setVisibleMethod · 0.45
setStateMethod · 0.45
setScaleMethod · 0.45
runActionMethod · 0.45
setScaleXMethod · 0.45
setScaleYMethod · 0.45

Tested by

no test coverage detected