зеркало из https://github.com/microsoft/cocos2d-x.git
Modify text filed size control
This commit is contained in:
Родитель
fea75444a7
Коммит
94339312ba
|
@ -221,12 +221,14 @@ void Text::labelScaleChangedWithSize()
|
||||||
{
|
{
|
||||||
if (_ignoreSize)
|
if (_ignoreSize)
|
||||||
{
|
{
|
||||||
|
_labelRenderer->setDimensions(Size::ZERO);
|
||||||
_labelRenderer->setScale(1.0f);
|
_labelRenderer->setScale(1.0f);
|
||||||
_size = _labelRenderer->getContentSize();
|
_size = _labelRenderer->getContentSize();
|
||||||
_normalScaleValueX = _normalScaleValueY = 1.0f;
|
_normalScaleValueX = _normalScaleValueY = 1.0f;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_labelRenderer->setDimensions(_size);
|
||||||
Size textureSize = _labelRenderer->getContentSize();
|
Size textureSize = _labelRenderer->getContentSize();
|
||||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -663,11 +663,13 @@ void TextField::textfieldRendererScaleChangedWithSize()
|
||||||
{
|
{
|
||||||
if (_ignoreSize)
|
if (_ignoreSize)
|
||||||
{
|
{
|
||||||
|
_textFieldRenderer->setDimensions(Size::ZERO);
|
||||||
_textFieldRenderer->setScale(1.0f);
|
_textFieldRenderer->setScale(1.0f);
|
||||||
_size = getContentSize();
|
_size = getContentSize();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
_textFieldRenderer->setDimensions(_size);
|
||||||
Size textureSize = getContentSize();
|
Size textureSize = getContentSize();
|
||||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||||
{
|
{
|
||||||
|
|
|
@ -311,7 +311,8 @@ bool UITextFieldTest_LineWrap::init()
|
||||||
|
|
||||||
// Create the textfield
|
// Create the textfield
|
||||||
TextField* textField = TextField::create();
|
TextField* textField = TextField::create();
|
||||||
textField->setTextAreaSize(Size(240, 160));
|
textField->ignoreContentAdaptWithSize(false);
|
||||||
|
textField->setSize(Size(240, 160));
|
||||||
textField->setTextHorizontalAlignment(TextHAlignment::CENTER);
|
textField->setTextHorizontalAlignment(TextHAlignment::CENTER);
|
||||||
textField->setTextVerticalAlignment(TextVAlignment::CENTER);
|
textField->setTextVerticalAlignment(TextVAlignment::CENTER);
|
||||||
textField->setTouchEnabled(true);
|
textField->setTouchEnabled(true);
|
||||||
|
|
Загрузка…
Ссылка в новой задаче