mirror of https://github.com/axmolengine/axmol.git
add function for uiText and uiTextField
This commit is contained in:
parent
e8fa6597df
commit
a72e65b4de
|
@ -283,6 +283,11 @@ void Text::adaptRenderers()
|
|||
}
|
||||
|
||||
Size Text::getVirtualRendererSize() const
|
||||
{
|
||||
return _labelRenderer->getContentSize();
|
||||
}
|
||||
|
||||
Size Text::getAutoRenderSize()
|
||||
{
|
||||
Size virtualSize = _labelRenderer->getContentSize();
|
||||
if (!_ignoreSize)
|
||||
|
|
|
@ -144,6 +144,8 @@ public:
|
|||
//override "getVirtualRenderer" method of widget.
|
||||
virtual Node* getVirtualRenderer() override;
|
||||
|
||||
virtual Size getAutoRenderSize();
|
||||
|
||||
/**
|
||||
* Returns the "class name" of widget.
|
||||
*/
|
||||
|
|
|
@ -768,6 +768,19 @@ void TextField::textfieldRendererScaleChangedWithSize()
|
|||
_textFieldRenderer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f);
|
||||
}
|
||||
|
||||
Size TextField::getAutoRenderSize()
|
||||
{
|
||||
Size virtualSize = _textFieldRenderer->getContentSize();
|
||||
if (!_ignoreSize)
|
||||
{
|
||||
_textFieldRenderer->setDimensions(0, 0);
|
||||
virtualSize = _textFieldRenderer->getContentSize();
|
||||
_textFieldRenderer->setDimensions(_contentSize.width, _contentSize.height);
|
||||
}
|
||||
|
||||
return virtualSize;
|
||||
}
|
||||
|
||||
Size TextField::getVirtualRendererSize() const
|
||||
{
|
||||
return _textFieldRenderer->getContentSize();
|
||||
|
|
|
@ -187,6 +187,7 @@ public:
|
|||
*/
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
virtual Size getAutoRenderSize();
|
||||
virtual Size getVirtualRendererSize() const override;
|
||||
virtual Node* getVirtualRenderer() override;
|
||||
void attachWithIME();
|
||||
|
|
Loading…
Reference in New Issue