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

Method valueChanged

tests/cpp-tests/Source/LabelTest/LabelTest.cpp:2852–2883  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2850}
2851
2852void LabelLayoutBaseTest::valueChanged(ax::Object* sender, ax::extension::Control::EventType controlEvent)
2853{
2854 ControlStepper* pControl = (ControlStepper*)sender;
2855 // Change value of label.
2856 auto fontSizeLabel = (Label*)this->getChildByName("fontSize");
2857 float fontSize = (float)pControl->getValue();
2858 fontSizeLabel->setString(fmt::format("font size:{}", (int)fontSize));
2859
2860 if (_labelType == 0)
2861 {
2862 auto ttfConfig = _label->getTTFConfig();
2863 ttfConfig.fontSize = fontSize;
2864 _label->setTTFConfig(ttfConfig);
2865 }
2866 else if (_labelType == 1)
2867 {
2868 _label->setBMFontSize(fontSize);
2869 }
2870 else if (_labelType == 2)
2871 {
2872 _label->setSystemFontSize(fontSize);
2873 }
2874 this->updateDrawNodeSize(_label->getContentSize());
2875
2876 // FIXME::When calling getLetter, the label Overflow feature will be invalid.
2877 // auto letterSprite = _label->getLetter(1);
2878 // auto moveBy = ScaleBy::create(1.0,2.0);
2879 // letterSprite->stopAllActions();
2880 // letterSprite->runAction(Sequence::create(moveBy, moveBy->clone()->reverse(), nullptr ));
2881 //
2882 // AXLOGD("label line height = {}", _label->getLineHeight());
2883}
2884
2885void LabelLayoutBaseTest::onExit()
2886{

Callers

nothing calls this directly

Calls 9

updateDrawNodeSizeMethod · 0.95
setTTFConfigMethod · 0.80
setBMFontSizeMethod · 0.80
setSystemFontSizeMethod · 0.80
formatFunction · 0.50
getChildByNameMethod · 0.45
getValueMethod · 0.45
setStringMethod · 0.45
getContentSizeMethod · 0.45

Tested by

no test coverage detected