зеркало из 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)
|
||||
{
|
||||
_labelRenderer->setDimensions(Size::ZERO);
|
||||
_labelRenderer->setScale(1.0f);
|
||||
_size = _labelRenderer->getContentSize();
|
||||
_normalScaleValueX = _normalScaleValueY = 1.0f;
|
||||
}
|
||||
else
|
||||
{
|
||||
_labelRenderer->setDimensions(_size);
|
||||
Size textureSize = _labelRenderer->getContentSize();
|
||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||
{
|
||||
|
|
|
@ -663,11 +663,13 @@ void TextField::textfieldRendererScaleChangedWithSize()
|
|||
{
|
||||
if (_ignoreSize)
|
||||
{
|
||||
_textFieldRenderer->setDimensions(Size::ZERO);
|
||||
_textFieldRenderer->setScale(1.0f);
|
||||
_size = getContentSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
_textFieldRenderer->setDimensions(_size);
|
||||
Size textureSize = getContentSize();
|
||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||
{
|
||||
|
|
|
@ -311,7 +311,8 @@ bool UITextFieldTest_LineWrap::init()
|
|||
|
||||
// Create the textfield
|
||||
TextField* textField = TextField::create();
|
||||
textField->setTextAreaSize(Size(240, 160));
|
||||
textField->ignoreContentAdaptWithSize(false);
|
||||
textField->setSize(Size(240, 160));
|
||||
textField->setTextHorizontalAlignment(TextHAlignment::CENTER);
|
||||
textField->setTextVerticalAlignment(TextVAlignment::CENTER);
|
||||
textField->setTouchEnabled(true);
|
||||
|
|
Загрузка…
Ссылка в новой задаче