mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3' of https://github.com/cocos2d/cocos2d-x into v3_hot_fix
This commit is contained in:
commit
19cc5b9c4d
|
@ -10,6 +10,7 @@ cocos2d-x-3.2 ??
|
|||
[FIX] SpriteBatchNode: opacity can not work
|
||||
[FIX] Sprite3D: may crash on Android if playing animation and replace Scene after come from background
|
||||
[FIX] UIdget: opacity is wrong when replace texture
|
||||
[FIX] UIText: can not wrap words automatically
|
||||
[FIX] UITextField: keyboard can not hide if touching space outside of keyboard
|
||||
|
||||
[FIX] Others: don't release singleton objects correctly that are needed in the whole game, which will be treated
|
||||
|
|
|
@ -296,7 +296,6 @@ void Text::labelScaleChangedWithSize()
|
|||
{
|
||||
if (_ignoreSize)
|
||||
{
|
||||
_labelRenderer->setDimensions(0,0);
|
||||
_labelRenderer->setScale(1.0f);
|
||||
_normalScaleValueX = _normalScaleValueY = 1.0f;
|
||||
}
|
||||
|
|
|
@ -456,16 +456,18 @@ public:
|
|||
|
||||
|
||||
/**
|
||||
* Ignore the widget size
|
||||
*
|
||||
* @param ignore, true that widget will ignore it's size, use texture size, false otherwise. Default value is true.
|
||||
* Note: when you set _ignoreSize to true, no matther you call setContentSize or not,
|
||||
* the widget size is always equal to the return value of the member function getVirtualRendererSize.
|
||||
*
|
||||
* @param ignore, set member variabl _ignoreSize to ignore
|
||||
*/
|
||||
virtual void ignoreContentAdaptWithSize(bool ignore);
|
||||
|
||||
/**
|
||||
* Gets the widget if is ignore it's size.
|
||||
* Query whether the widget ignores user deinfed content size or not
|
||||
*
|
||||
* @param ignore, true that widget will ignore it's size, use texture size, false otherwise. Default value is true.
|
||||
* @return bool
|
||||
*/
|
||||
bool isIgnoreContentAdaptWithSize() const;
|
||||
|
||||
|
@ -485,14 +487,8 @@ public:
|
|||
*/
|
||||
virtual Node* getVirtualRenderer();
|
||||
|
||||
// /**
|
||||
// * Gets the content size of widget.
|
||||
// *
|
||||
// * Content size is widget's texture size.
|
||||
// */
|
||||
// virtual const Size& getContentSize() const;
|
||||
virtual const Size& getVirtualRendererSize() const;
|
||||
|
||||
virtual const Size& getVirtualRendererSize() const;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -40,10 +40,25 @@ bool UITextTest_LineWrap::init()
|
|||
_uiLayer->addChild(alert);
|
||||
|
||||
// Create the line wrap
|
||||
Text* text = Text::create("Text can line wrap","AmericanTypewriter",32);
|
||||
Text* text = Text::create("TextArea Widget can line wrap","AmericanTypewriter",32);
|
||||
text->ignoreContentAdaptWithSize(false);
|
||||
text->setContentSize(Size(280, 150));
|
||||
text->setTextHorizontalAlignment(TextHAlignment::CENTER);
|
||||
text->setTouchScaleChangeEnabled(true);
|
||||
text->setTouchEnabled(true);
|
||||
text->addTouchEventListener([=](Ref* sender, Widget::TouchEventType type)
|
||||
{
|
||||
if (type == Widget::TouchEventType::ENDED)
|
||||
{
|
||||
if ((int)text->getContentSize().width == 280)
|
||||
{
|
||||
text->setContentSize(Size(380,100));
|
||||
}else
|
||||
{
|
||||
text->setContentSize(Size(280, 150));
|
||||
}
|
||||
}
|
||||
});
|
||||
text->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - text->getContentSize().height / 8.0f));
|
||||
_uiLayer->addChild(text);
|
||||
|
||||
|
|
Loading…
Reference in New Issue