mirror of https://github.com/axmolengine/axmol.git
issue #5161, replace all _size to _contentSize
This commit is contained in:
parent
f1ea2e9332
commit
585ccf2c71
|
@ -56,9 +56,9 @@ _capInsetsDisabled(Rect::ZERO),
|
|||
_normalTexType(TextureResType::LOCAL),
|
||||
_pressedTexType(TextureResType::LOCAL),
|
||||
_disabledTexType(TextureResType::LOCAL),
|
||||
_normalTextureSize(_size),
|
||||
_pressedTextureSize(_size),
|
||||
_disabledTextureSize(_size),
|
||||
_normalTextureSize(_contentSize),
|
||||
_pressedTextureSize(_contentSize),
|
||||
_disabledTextureSize(_contentSize),
|
||||
_pressedActionEnabled(false),
|
||||
_titleColor(Color3B::WHITE),
|
||||
_normalTextureScaleXInSize(1.0f),
|
||||
|
@ -615,7 +615,7 @@ void Button::normalTextureScaleChangedWithSize()
|
|||
{
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
static_cast<extension::Scale9Sprite*>(_buttonNormalRenderer)->setPreferredSize(_size);
|
||||
static_cast<extension::Scale9Sprite*>(_buttonNormalRenderer)->setPreferredSize(_contentSize);
|
||||
_normalTextureScaleXInSize = _normalTextureScaleYInSize = 1.0f;
|
||||
}
|
||||
else
|
||||
|
@ -626,8 +626,8 @@ void Button::normalTextureScaleChangedWithSize()
|
|||
_buttonNormalRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_buttonNormalRenderer->setScaleX(scaleX);
|
||||
_buttonNormalRenderer->setScaleY(scaleY);
|
||||
_normalTextureScaleXInSize = scaleX;
|
||||
|
@ -651,7 +651,7 @@ void Button::pressedTextureScaleChangedWithSize()
|
|||
{
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
static_cast<extension::Scale9Sprite*>(_buttonClickedRenderer)->setPreferredSize(_size);
|
||||
static_cast<extension::Scale9Sprite*>(_buttonClickedRenderer)->setPreferredSize(_contentSize);
|
||||
_pressedTextureScaleXInSize = _pressedTextureScaleYInSize = 1.0f;
|
||||
}
|
||||
else
|
||||
|
@ -662,8 +662,8 @@ void Button::pressedTextureScaleChangedWithSize()
|
|||
_buttonClickedRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / _pressedTextureSize.width;
|
||||
float scaleY = _size.height / _pressedTextureSize.height;
|
||||
float scaleX = _contentSize.width / _pressedTextureSize.width;
|
||||
float scaleY = _contentSize.height / _pressedTextureSize.height;
|
||||
_buttonClickedRenderer->setScaleX(scaleX);
|
||||
_buttonClickedRenderer->setScaleY(scaleY);
|
||||
_pressedTextureScaleXInSize = scaleX;
|
||||
|
@ -686,7 +686,7 @@ void Button::disabledTextureScaleChangedWithSize()
|
|||
{
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
static_cast<extension::Scale9Sprite*>(_buttonDisableRenderer)->setPreferredSize(_size);
|
||||
static_cast<extension::Scale9Sprite*>(_buttonDisableRenderer)->setPreferredSize(_contentSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -696,8 +696,8 @@ void Button::disabledTextureScaleChangedWithSize()
|
|||
_buttonDisableRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / _disabledTextureSize.width;
|
||||
float scaleY = _size.height / _disabledTextureSize.height;
|
||||
float scaleX = _contentSize.width / _disabledTextureSize.width;
|
||||
float scaleY = _contentSize.height / _disabledTextureSize.height;
|
||||
_buttonDisableRenderer->setScaleX(scaleX);
|
||||
_buttonDisableRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
|
|
@ -473,8 +473,8 @@ void CheckBox::backGroundTextureScaleChangedWithSize()
|
|||
_backGroundBoxRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_backGroundBoxRenderer->setScaleX(scaleX);
|
||||
_backGroundBoxRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
@ -495,8 +495,8 @@ void CheckBox::backGroundSelectedTextureScaleChangedWithSize()
|
|||
_backGroundSelectedBoxRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_backGroundSelectedBoxRenderer->setScaleX(scaleX);
|
||||
_backGroundSelectedBoxRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
@ -517,8 +517,8 @@ void CheckBox::frontCrossTextureScaleChangedWithSize()
|
|||
_frontCrossRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_frontCrossRenderer->setScaleX(scaleX);
|
||||
_frontCrossRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
@ -539,8 +539,8 @@ void CheckBox::backGroundDisabledTextureScaleChangedWithSize()
|
|||
_backGroundBoxDisabledRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_backGroundBoxDisabledRenderer->setScaleX(scaleX);
|
||||
_backGroundBoxDisabledRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
@ -561,8 +561,8 @@ void CheckBox::frontCrossDisabledTextureScaleChangedWithSize()
|
|||
_frontCrossDisabledRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_frontCrossDisabledRenderer->setScaleX(scaleX);
|
||||
_frontCrossDisabledRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ _capInsets(Rect::ZERO),
|
|||
_imageRenderer(nullptr),
|
||||
_textureFile(""),
|
||||
_imageTexType(TextureResType::LOCAL),
|
||||
_imageTextureSize(_size),
|
||||
_imageTextureSize(_contentSize),
|
||||
_imageRendererAdaptDirty(true)
|
||||
{
|
||||
|
||||
|
@ -300,7 +300,7 @@ void ImageView::imageTextureScaleChangedWithSize()
|
|||
{
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
static_cast<extension::Scale9Sprite*>(_imageRenderer)->setPreferredSize(_size);
|
||||
static_cast<extension::Scale9Sprite*>(_imageRenderer)->setPreferredSize(_contentSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -310,8 +310,8 @@ void ImageView::imageTextureScaleChangedWithSize()
|
|||
_imageRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_imageRenderer->setScaleX(scaleX);
|
||||
_imageRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
|
|
@ -429,7 +429,7 @@ void Layout::setClippingEnabled(bool able)
|
|||
_clippingStencil->onEnter();
|
||||
}
|
||||
_clippingStencil->retain();
|
||||
setStencilClippingSize(_size);
|
||||
setStencilClippingSize(_contentSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -469,9 +469,9 @@ void Layout::setStencilClippingSize(const Size &size)
|
|||
{
|
||||
Vec2 rect[4];
|
||||
rect[0] = Vec2::ZERO;
|
||||
rect[1] = Vec2(_size.width, 0);
|
||||
rect[2] = Vec2(_size.width, _size.height);
|
||||
rect[3] = Vec2(0, _size.height);
|
||||
rect[1] = Vec2(_contentSize.width, 0);
|
||||
rect[2] = Vec2(_contentSize.width, _contentSize.height);
|
||||
rect[3] = Vec2(0, _contentSize.height);
|
||||
Color4F green(0, 1, 0, 1);
|
||||
_clippingStencil->clear();
|
||||
_clippingStencil->drawPolygon(rect, 4, green, 0, green);
|
||||
|
@ -484,8 +484,8 @@ const Rect& Layout::getClippingRect()
|
|||
{
|
||||
Vec2 worldPos = convertToWorldSpace(Vec2::ZERO);
|
||||
AffineTransform t = getNodeToWorldAffineTransform();
|
||||
float scissorWidth = _size.width*t.a;
|
||||
float scissorHeight = _size.height*t.d;
|
||||
float scissorWidth = _contentSize.width*t.a;
|
||||
float scissorHeight = _contentSize.height*t.d;
|
||||
Rect parentClippingRect;
|
||||
Layout* parent = this;
|
||||
|
||||
|
@ -560,24 +560,24 @@ const Rect& Layout::getClippingRect()
|
|||
void Layout::onSizeChanged()
|
||||
{
|
||||
Widget::onSizeChanged();
|
||||
setStencilClippingSize(_size);
|
||||
setStencilClippingSize(_contentSize);
|
||||
_doLayoutDirty = true;
|
||||
_clippingRectDirty = true;
|
||||
if (_backGroundImage)
|
||||
{
|
||||
_backGroundImage->setPosition(Vec2(_size.width/2.0f, _size.height/2.0f));
|
||||
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
|
||||
if (_backGroundScale9Enabled && _backGroundImage)
|
||||
{
|
||||
static_cast<extension::Scale9Sprite*>(_backGroundImage)->setPreferredSize(_size);
|
||||
static_cast<extension::Scale9Sprite*>(_backGroundImage)->setPreferredSize(_contentSize);
|
||||
}
|
||||
}
|
||||
if (_colorRender)
|
||||
{
|
||||
_colorRender->setContentSize(_size);
|
||||
_colorRender->setContentSize(_contentSize);
|
||||
}
|
||||
if (_gradientRender)
|
||||
{
|
||||
_gradientRender->setContentSize(_size);
|
||||
_gradientRender->setContentSize(_contentSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -626,7 +626,7 @@ void Layout::setBackGroundImage(const std::string& fileName,TextureResType texTy
|
|||
default:
|
||||
break;
|
||||
}
|
||||
bgiScale9->setPreferredSize(_size);
|
||||
bgiScale9->setPreferredSize(_contentSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -643,7 +643,7 @@ void Layout::setBackGroundImage(const std::string& fileName,TextureResType texTy
|
|||
}
|
||||
}
|
||||
_backGroundImageTextureSize = _backGroundImage->getContentSize();
|
||||
_backGroundImage->setPosition(Vec2(_size.width/2.0f, _size.height/2.0f));
|
||||
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
|
||||
updateBackGroundImageRGBA();
|
||||
}
|
||||
|
||||
|
@ -701,14 +701,14 @@ void Layout::addBackGroundImage()
|
|||
{
|
||||
_backGroundImage = extension::Scale9Sprite::create();
|
||||
addProtectedChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
|
||||
static_cast<extension::Scale9Sprite*>(_backGroundImage)->setPreferredSize(_size);
|
||||
static_cast<extension::Scale9Sprite*>(_backGroundImage)->setPreferredSize(_contentSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
_backGroundImage = Sprite::create();
|
||||
addProtectedChild(_backGroundImage, BACKGROUNDIMAGE_Z, -1);
|
||||
}
|
||||
_backGroundImage->setPosition(Vec2(_size.width/2.0f, _size.height/2.0f));
|
||||
_backGroundImage->setPosition(Vec2(_contentSize.width/2.0f, _contentSize.height/2.0f));
|
||||
}
|
||||
|
||||
void Layout::removeBackGroundImage()
|
||||
|
@ -767,14 +767,14 @@ void Layout::setBackGroundColorType(BackGroundColorType type)
|
|||
break;
|
||||
case BackGroundColorType::SOLID:
|
||||
_colorRender = LayerColor::create();
|
||||
_colorRender->setContentSize(_size);
|
||||
_colorRender->setContentSize(_contentSize);
|
||||
_colorRender->setOpacity(_cOpacity);
|
||||
_colorRender->setColor(_cColor);
|
||||
addProtectedChild(_colorRender, BCAKGROUNDCOLORRENDERER_Z, -1);
|
||||
break;
|
||||
case BackGroundColorType::GRADIENT:
|
||||
_gradientRender = LayerGradient::create();
|
||||
_gradientRender->setContentSize(_size);
|
||||
_gradientRender->setContentSize(_contentSize);
|
||||
_gradientRender->setOpacity(_cOpacity);
|
||||
_gradientRender->setStartColor(_gStartColor);
|
||||
_gradientRender->setEndColor(_gEndColor);
|
||||
|
|
|
@ -98,7 +98,7 @@ void ListView::updateInnerContainerSize()
|
|||
{
|
||||
totalHeight += item->getSize().height;
|
||||
}
|
||||
float finalWidth = _size.width;
|
||||
float finalWidth = _contentSize.width;
|
||||
float finalHeight = totalHeight;
|
||||
setInnerContainerSize(Size(finalWidth, finalHeight));
|
||||
break;
|
||||
|
@ -112,7 +112,7 @@ void ListView::updateInnerContainerSize()
|
|||
totalWidth += item->getSize().width;
|
||||
}
|
||||
float finalWidth = totalWidth;
|
||||
float finalHeight = _size.height;
|
||||
float finalHeight = _contentSize.height;
|
||||
setInnerContainerSize(Size(finalWidth, finalHeight));
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -317,7 +317,7 @@ void LoadingBar::barRendererScaleChangedWithSize()
|
|||
}
|
||||
else
|
||||
{
|
||||
_totalLength = _size.width;
|
||||
_totalLength = _contentSize.width;
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
setScale9Scale();
|
||||
|
@ -331,8 +331,8 @@ void LoadingBar::barRendererScaleChangedWithSize()
|
|||
_barRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_barRenderer->setScaleX(scaleX);
|
||||
_barRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ void LoadingBar::barRendererScaleChangedWithSize()
|
|||
void LoadingBar::setScale9Scale()
|
||||
{
|
||||
float width = (float)(_percent) / 100.0f * _totalLength;
|
||||
static_cast<extension::Scale9Sprite*>(_barRenderer)->setPreferredSize(Size(width, _size.height));
|
||||
static_cast<extension::Scale9Sprite*>(_barRenderer)->setPreferredSize(Size(width, _contentSize.height));
|
||||
}
|
||||
|
||||
std::string LoadingBar::getDescription() const
|
||||
|
|
|
@ -414,7 +414,7 @@ void RichText::formarRenderers()
|
|||
nextPosX += l->getContentSize().width;
|
||||
}
|
||||
}
|
||||
_elementRenderersContainer->setContentSize(_size);
|
||||
_elementRenderersContainer->setContentSize(_contentSize);
|
||||
delete [] maxHeights;
|
||||
}
|
||||
|
||||
|
@ -430,13 +430,13 @@ void RichText::formarRenderers()
|
|||
if (_ignoreSize)
|
||||
{
|
||||
Size s = getVirtualRendererSize();
|
||||
_size = s;
|
||||
_contentSize = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
_size = _customSize;
|
||||
_contentSize = _customSize;
|
||||
}
|
||||
updateContentSizeWithTextureSize(_size);
|
||||
updateContentSizeWithTextureSize(_contentSize);
|
||||
_elementRenderersContainer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f);
|
||||
}
|
||||
|
||||
|
|
|
@ -128,29 +128,29 @@ void ScrollView::initRenderer()
|
|||
void ScrollView::onSizeChanged()
|
||||
{
|
||||
Layout::onSizeChanged();
|
||||
_topBoundary = _size.height;
|
||||
_rightBoundary = _size.width;
|
||||
float bounceBoundaryParameterX = _size.width / 3.0f;
|
||||
float bounceBoundaryParameterY = _size.height / 3.0f;
|
||||
_bounceTopBoundary = _size.height - bounceBoundaryParameterY;
|
||||
_topBoundary = _contentSize.height;
|
||||
_rightBoundary = _contentSize.width;
|
||||
float bounceBoundaryParameterX = _contentSize.width / 3.0f;
|
||||
float bounceBoundaryParameterY = _contentSize.height / 3.0f;
|
||||
_bounceTopBoundary = _contentSize.height - bounceBoundaryParameterY;
|
||||
_bounceBottomBoundary = bounceBoundaryParameterY;
|
||||
_bounceLeftBoundary = bounceBoundaryParameterX;
|
||||
_bounceRightBoundary = _size.width - bounceBoundaryParameterX;
|
||||
_bounceRightBoundary = _contentSize.width - bounceBoundaryParameterX;
|
||||
Size innerSize = _innerContainer->getSize();
|
||||
float orginInnerSizeWidth = innerSize.width;
|
||||
float orginInnerSizeHeight = innerSize.height;
|
||||
float innerSizeWidth = MAX(orginInnerSizeWidth, _size.width);
|
||||
float innerSizeHeight = MAX(orginInnerSizeHeight, _size.height);
|
||||
float innerSizeWidth = MAX(orginInnerSizeWidth, _contentSize.width);
|
||||
float innerSizeHeight = MAX(orginInnerSizeHeight, _contentSize.height);
|
||||
_innerContainer->setSize(Size(innerSizeWidth, innerSizeHeight));
|
||||
_innerContainer->setPosition(Vec2(0, _size.height - _innerContainer->getSize().height));
|
||||
_innerContainer->setPosition(Vec2(0, _contentSize.height - _innerContainer->getSize().height));
|
||||
}
|
||||
|
||||
void ScrollView::setInnerContainerSize(const Size &size)
|
||||
{
|
||||
float innerSizeWidth = _size.width;
|
||||
float innerSizeHeight = _size.height;
|
||||
float innerSizeWidth = _contentSize.width;
|
||||
float innerSizeHeight = _contentSize.height;
|
||||
Size originalInnerSize = _innerContainer->getSize();
|
||||
if (size.width < _size.width)
|
||||
if (size.width < _contentSize.width)
|
||||
{
|
||||
CCLOG("Inner width <= scrollview width, it will be force sized!");
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ void ScrollView::setInnerContainerSize(const Size &size)
|
|||
{
|
||||
innerSizeWidth = size.width;
|
||||
}
|
||||
if (size.height < _size.height)
|
||||
if (size.height < _contentSize.height)
|
||||
{
|
||||
CCLOG("Inner height <= scrollview height, it will be force sized!");
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ void ScrollView::setInnerContainerSize(const Size &size)
|
|||
}
|
||||
case Direction::HORIZONTAL:
|
||||
{
|
||||
if (_innerContainer->getRightBoundary() <= _size.width)
|
||||
if (_innerContainer->getRightBoundary() <= _contentSize.width)
|
||||
{
|
||||
Size newInnerSize = _innerContainer->getSize();
|
||||
float offset = originalInnerSize.width - newInnerSize.width;
|
||||
|
@ -192,7 +192,7 @@ void ScrollView::setInnerContainerSize(const Size &size)
|
|||
Size newInnerSize = _innerContainer->getSize();
|
||||
float offsetY = originalInnerSize.height - newInnerSize.height;
|
||||
float offsetX = 0.0f;
|
||||
if (_innerContainer->getRightBoundary() <= _size.width)
|
||||
if (_innerContainer->getRightBoundary() <= _contentSize.width)
|
||||
{
|
||||
offsetX = originalInnerSize.width - newInnerSize.width;
|
||||
}
|
||||
|
@ -204,19 +204,23 @@ void ScrollView::setInnerContainerSize(const Size &size)
|
|||
}
|
||||
if (_innerContainer->getLeftBoundary() > 0.0f)
|
||||
{
|
||||
_innerContainer->setPosition(Vec2(_innerContainer->getAnchorPoint().x * _innerContainer->getSize().width, _innerContainer->getPosition().y));
|
||||
_innerContainer->setPosition(Vec2(_innerContainer->getAnchorPoint().x * _innerContainer->getSize().width,
|
||||
_innerContainer->getPosition().y));
|
||||
}
|
||||
if (_innerContainer->getRightBoundary() < _size.width)
|
||||
if (_innerContainer->getRightBoundary() < _contentSize.width)
|
||||
{
|
||||
_innerContainer->setPosition(Vec2(_size.width - ((1.0f - _innerContainer->getAnchorPoint().x) * _innerContainer->getSize().width), _innerContainer->getPosition().y));
|
||||
_innerContainer->setPosition(Vec2(_contentSize.width - ((1.0f - _innerContainer->getAnchorPoint().x) * _innerContainer->getSize().width),
|
||||
_innerContainer->getPosition().y));
|
||||
}
|
||||
if (_innerContainer->getPosition().y > 0.0f)
|
||||
{
|
||||
_innerContainer->setPosition(Vec2(_innerContainer->getPosition().x, _innerContainer->getAnchorPoint().y * _innerContainer->getSize().height));
|
||||
_innerContainer->setPosition(Vec2(_innerContainer->getPosition().x,
|
||||
_innerContainer->getAnchorPoint().y * _innerContainer->getSize().height));
|
||||
}
|
||||
if (_innerContainer->getTopBoundary() < _size.height)
|
||||
if (_innerContainer->getTopBoundary() < _contentSize.height)
|
||||
{
|
||||
_innerContainer->setPosition(Vec2(_innerContainer->getPosition().x, _size.height - (1.0f - _innerContainer->getAnchorPoint().y) * _innerContainer->getSize().height));
|
||||
_innerContainer->setPosition(Vec2(_innerContainer->getPosition().x,
|
||||
_contentSize.height - (1.0f - _innerContainer->getAnchorPoint().y) * _innerContainer->getSize().height));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -359,14 +363,14 @@ bool ScrollView::checkNeedBounce()
|
|||
{
|
||||
if (_topBounceNeeded && _leftBounceNeeded)
|
||||
{
|
||||
Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(_innerContainer->getLeftBoundary(), _innerContainer->getTopBoundary());
|
||||
Vec2 scrollVector = Vec2(0.0f, _contentSize.height) - Vec2(_innerContainer->getLeftBoundary(), _innerContainer->getTopBoundary());
|
||||
float orSpeed = scrollVector.getLength()/(0.2f);
|
||||
_bounceDir = scrollVector.getNormalized();
|
||||
startBounceChildren(orSpeed);
|
||||
}
|
||||
else if (_topBounceNeeded && _rightBounceNeeded)
|
||||
{
|
||||
Vec2 scrollVector = Vec2(_size.width, _size.height) - Vec2(_innerContainer->getRightBoundary(), _innerContainer->getTopBoundary());
|
||||
Vec2 scrollVector = Vec2(_contentSize.width, _contentSize.height) - Vec2(_innerContainer->getRightBoundary(), _innerContainer->getTopBoundary());
|
||||
float orSpeed = scrollVector.getLength()/(0.2f);
|
||||
_bounceDir = scrollVector.getNormalized();
|
||||
startBounceChildren(orSpeed);
|
||||
|
@ -380,14 +384,14 @@ bool ScrollView::checkNeedBounce()
|
|||
}
|
||||
else if (_bottomBounceNeeded && _rightBounceNeeded)
|
||||
{
|
||||
Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightBoundary(), _innerContainer->getBottomBoundary());
|
||||
Vec2 scrollVector = Vec2(_contentSize.width, 0.0f) - Vec2(_innerContainer->getRightBoundary(), _innerContainer->getBottomBoundary());
|
||||
float orSpeed = scrollVector.getLength()/(0.2f);
|
||||
_bounceDir = scrollVector.getNormalized();
|
||||
startBounceChildren(orSpeed);
|
||||
}
|
||||
else if (_topBounceNeeded)
|
||||
{
|
||||
Vec2 scrollVector = Vec2(0.0f, _size.height) - Vec2(0.0f, _innerContainer->getTopBoundary());
|
||||
Vec2 scrollVector = Vec2(0.0f, _contentSize.height) - Vec2(0.0f, _innerContainer->getTopBoundary());
|
||||
float orSpeed = scrollVector.getLength()/(0.2f);
|
||||
_bounceDir = scrollVector.getNormalized();
|
||||
startBounceChildren(orSpeed);
|
||||
|
@ -408,7 +412,7 @@ bool ScrollView::checkNeedBounce()
|
|||
}
|
||||
else if (_rightBounceNeeded)
|
||||
{
|
||||
Vec2 scrollVector = Vec2(_size.width, 0.0f) - Vec2(_innerContainer->getRightBoundary(), 0.0f);
|
||||
Vec2 scrollVector = Vec2(_contentSize.width, 0.0f) - Vec2(_innerContainer->getRightBoundary(), 0.0f);
|
||||
float orSpeed = scrollVector.getLength()/(0.2f);
|
||||
_bounceDir = scrollVector.getNormalized();
|
||||
startBounceChildren(orSpeed);
|
||||
|
@ -518,23 +522,23 @@ void ScrollView::jumpToDestination(const Vec2 &des)
|
|||
case Direction::VERTICAL:
|
||||
if (des.y <= 0)
|
||||
{
|
||||
finalOffsetY = MAX(des.y, _size.height - _innerContainer->getSize().height);
|
||||
finalOffsetY = MAX(des.y, _contentSize.height - _innerContainer->getSize().height);
|
||||
}
|
||||
break;
|
||||
case Direction::HORIZONTAL:
|
||||
if (des.x <= 0)
|
||||
{
|
||||
finalOffsetX = MAX(des.x, _size.width - _innerContainer->getSize().width);
|
||||
finalOffsetX = MAX(des.x, _contentSize.width - _innerContainer->getSize().width);
|
||||
}
|
||||
break;
|
||||
case Direction::BOTH:
|
||||
if (des.y <= 0)
|
||||
{
|
||||
finalOffsetY = MAX(des.y, _size.height - _innerContainer->getSize().height);
|
||||
finalOffsetY = MAX(des.y, _contentSize.height - _innerContainer->getSize().height);
|
||||
}
|
||||
if (des.x <= 0)
|
||||
{
|
||||
finalOffsetX = MAX(des.x, _size.width - _innerContainer->getSize().width);
|
||||
finalOffsetX = MAX(des.x, _contentSize.width - _innerContainer->getSize().width);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
|
@ -1217,7 +1221,8 @@ void ScrollView::scrollToBottom(float time, bool attenuated)
|
|||
|
||||
void ScrollView::scrollToTop(float time, bool attenuated)
|
||||
{
|
||||
startAutoScrollChildrenWithDestination(Vec2(_innerContainer->getPosition().x, _size.height - _innerContainer->getSize().height), time, attenuated);
|
||||
startAutoScrollChildrenWithDestination(Vec2(_innerContainer->getPosition().x,
|
||||
_contentSize.height - _innerContainer->getSize().height), time, attenuated);
|
||||
}
|
||||
|
||||
void ScrollView::scrollToLeft(float time, bool attenuated)
|
||||
|
@ -1227,7 +1232,8 @@ void ScrollView::scrollToLeft(float time, bool attenuated)
|
|||
|
||||
void ScrollView::scrollToRight(float time, bool attenuated)
|
||||
{
|
||||
startAutoScrollChildrenWithDestination(Vec2(_size.width - _innerContainer->getSize().width, _innerContainer->getPosition().y), time, attenuated);
|
||||
startAutoScrollChildrenWithDestination(Vec2(_contentSize.width - _innerContainer->getSize().width,
|
||||
_innerContainer->getPosition().y), time, attenuated);
|
||||
}
|
||||
|
||||
void ScrollView::scrollToTopLeft(float time, bool attenuated)
|
||||
|
@ -1237,7 +1243,7 @@ void ScrollView::scrollToTopLeft(float time, bool attenuated)
|
|||
CCLOG("Scroll diretion is not both!");
|
||||
return;
|
||||
}
|
||||
startAutoScrollChildrenWithDestination(Vec2(0.0f, _size.height - _innerContainer->getSize().height), time, attenuated);
|
||||
startAutoScrollChildrenWithDestination(Vec2(0.0f, _contentSize.height - _innerContainer->getSize().height), time, attenuated);
|
||||
}
|
||||
|
||||
void ScrollView::scrollToTopRight(float time, bool attenuated)
|
||||
|
@ -1247,7 +1253,8 @@ void ScrollView::scrollToTopRight(float time, bool attenuated)
|
|||
CCLOG("Scroll diretion is not both!");
|
||||
return;
|
||||
}
|
||||
startAutoScrollChildrenWithDestination(Vec2(_size.width - _innerContainer->getSize().width, _size.height - _innerContainer->getSize().height), time, attenuated);
|
||||
startAutoScrollChildrenWithDestination(Vec2(_contentSize.width - _innerContainer->getSize().width,
|
||||
_contentSize.height - _innerContainer->getSize().height), time, attenuated);
|
||||
}
|
||||
|
||||
void ScrollView::scrollToBottomLeft(float time, bool attenuated)
|
||||
|
@ -1267,19 +1274,19 @@ void ScrollView::scrollToBottomRight(float time, bool attenuated)
|
|||
CCLOG("Scroll diretion is not both!");
|
||||
return;
|
||||
}
|
||||
startAutoScrollChildrenWithDestination(Vec2(_size.width - _innerContainer->getSize().width, 0.0f), time, attenuated);
|
||||
startAutoScrollChildrenWithDestination(Vec2(_contentSize.width - _innerContainer->getSize().width, 0.0f), time, attenuated);
|
||||
}
|
||||
|
||||
void ScrollView::scrollToPercentVertical(float percent, float time, bool attenuated)
|
||||
{
|
||||
float minY = _size.height - _innerContainer->getSize().height;
|
||||
float minY = _contentSize.height - _innerContainer->getSize().height;
|
||||
float h = - minY;
|
||||
startAutoScrollChildrenWithDestination(Vec2(_innerContainer->getPosition().x, minY + percent * h / 100.0f), time, attenuated);
|
||||
}
|
||||
|
||||
void ScrollView::scrollToPercentHorizontal(float percent, float time, bool attenuated)
|
||||
{
|
||||
float w = _innerContainer->getSize().width - _size.width;
|
||||
float w = _innerContainer->getSize().width - _contentSize.width;
|
||||
startAutoScrollChildrenWithDestination(Vec2(-(percent * w / 100.0f), _innerContainer->getPosition().y), time, attenuated);
|
||||
}
|
||||
|
||||
|
@ -1289,9 +1296,9 @@ void ScrollView::scrollToPercentBothDirection(const Vec2& percent, float time, b
|
|||
{
|
||||
return;
|
||||
}
|
||||
float minY = _size.height - _innerContainer->getSize().height;
|
||||
float minY = _contentSize.height - _innerContainer->getSize().height;
|
||||
float h = - minY;
|
||||
float w = _innerContainer->getSize().width - _size.width;
|
||||
float w = _innerContainer->getSize().width - _contentSize.width;
|
||||
startAutoScrollChildrenWithDestination(Vec2(-(percent.x * w / 100.0f), minY + percent.y * h / 100.0f), time, attenuated);
|
||||
}
|
||||
|
||||
|
@ -1302,7 +1309,8 @@ void ScrollView::jumpToBottom()
|
|||
|
||||
void ScrollView::jumpToTop()
|
||||
{
|
||||
jumpToDestination(Vec2(_innerContainer->getPosition().x, _size.height - _innerContainer->getSize().height));
|
||||
jumpToDestination(Vec2(_innerContainer->getPosition().x,
|
||||
_contentSize.height - _innerContainer->getSize().height));
|
||||
}
|
||||
|
||||
void ScrollView::jumpToLeft()
|
||||
|
@ -1312,7 +1320,7 @@ void ScrollView::jumpToLeft()
|
|||
|
||||
void ScrollView::jumpToRight()
|
||||
{
|
||||
jumpToDestination(Vec2(_size.width - _innerContainer->getSize().width, _innerContainer->getPosition().y));
|
||||
jumpToDestination(Vec2(_contentSize.width - _innerContainer->getSize().width, _innerContainer->getPosition().y));
|
||||
}
|
||||
|
||||
void ScrollView::jumpToTopLeft()
|
||||
|
@ -1322,7 +1330,7 @@ void ScrollView::jumpToTopLeft()
|
|||
CCLOG("Scroll diretion is not both!");
|
||||
return;
|
||||
}
|
||||
jumpToDestination(Vec2(0.0f, _size.height - _innerContainer->getSize().height));
|
||||
jumpToDestination(Vec2(0.0f, _contentSize.height - _innerContainer->getSize().height));
|
||||
}
|
||||
|
||||
void ScrollView::jumpToTopRight()
|
||||
|
@ -1332,7 +1340,8 @@ void ScrollView::jumpToTopRight()
|
|||
CCLOG("Scroll diretion is not both!");
|
||||
return;
|
||||
}
|
||||
jumpToDestination(Vec2(_size.width - _innerContainer->getSize().width, _size.height - _innerContainer->getSize().height));
|
||||
jumpToDestination(Vec2(_contentSize.width - _innerContainer->getSize().width,
|
||||
_contentSize.height - _innerContainer->getSize().height));
|
||||
}
|
||||
|
||||
void ScrollView::jumpToBottomLeft()
|
||||
|
@ -1352,19 +1361,19 @@ void ScrollView::jumpToBottomRight()
|
|||
CCLOG("Scroll diretion is not both!");
|
||||
return;
|
||||
}
|
||||
jumpToDestination(Vec2(_size.width - _innerContainer->getSize().width, 0.0f));
|
||||
jumpToDestination(Vec2(_contentSize.width - _innerContainer->getSize().width, 0.0f));
|
||||
}
|
||||
|
||||
void ScrollView::jumpToPercentVertical(float percent)
|
||||
{
|
||||
float minY = _size.height - _innerContainer->getSize().height;
|
||||
float minY = _contentSize.height - _innerContainer->getSize().height;
|
||||
float h = - minY;
|
||||
jumpToDestination(Vec2(_innerContainer->getPosition().x, minY + percent * h / 100.0f));
|
||||
}
|
||||
|
||||
void ScrollView::jumpToPercentHorizontal(float percent)
|
||||
{
|
||||
float w = _innerContainer->getSize().width - _size.width;
|
||||
float w = _innerContainer->getSize().width - _contentSize.width;
|
||||
jumpToDestination(Vec2(-(percent * w / 100.0f), _innerContainer->getPosition().y));
|
||||
}
|
||||
|
||||
|
@ -1374,9 +1383,9 @@ void ScrollView::jumpToPercentBothDirection(const Vec2& percent)
|
|||
{
|
||||
return;
|
||||
}
|
||||
float minY = _size.height - _innerContainer->getSize().height;
|
||||
float minY = _contentSize.height - _innerContainer->getSize().height;
|
||||
float h = - minY;
|
||||
float w = _innerContainer->getSize().width - _size.width;
|
||||
float w = _innerContainer->getSize().width - _contentSize.width;
|
||||
jumpToDestination(Vec2(-(percent.x * w / 100.0f), minY + percent.y * h / 100.0f));
|
||||
}
|
||||
|
||||
|
|
|
@ -500,14 +500,14 @@ void Slider::barRendererScaleChangedWithSize()
|
|||
{
|
||||
|
||||
_barRenderer->setScale(1.0f);
|
||||
_barLength = _size.width;
|
||||
_barLength = _contentSize.width;
|
||||
}
|
||||
else
|
||||
{
|
||||
_barLength = _size.width;
|
||||
_barLength = _contentSize.width;
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
static_cast<extension::Scale9Sprite*>(_barRenderer)->setPreferredSize(_size);
|
||||
static_cast<extension::Scale9Sprite*>(_barRenderer)->setPreferredSize(_contentSize);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -517,8 +517,8 @@ void Slider::barRendererScaleChangedWithSize()
|
|||
_barRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float bscaleX = _size.width / btextureSize.width;
|
||||
float bscaleY = _size.height / btextureSize.height;
|
||||
float bscaleX = _contentSize.width / btextureSize.width;
|
||||
float bscaleY = _contentSize.height / btextureSize.height;
|
||||
_barRenderer->setScaleX(bscaleX);
|
||||
_barRenderer->setScaleY(bscaleY);
|
||||
}
|
||||
|
@ -534,8 +534,8 @@ void Slider::progressBarRendererScaleChangedWithSize()
|
|||
if (!_scale9Enabled)
|
||||
{
|
||||
Size ptextureSize = _progressBarTextureSize;
|
||||
float pscaleX = _size.width / ptextureSize.width;
|
||||
float pscaleY = _size.height / ptextureSize.height;
|
||||
float pscaleX = _contentSize.width / ptextureSize.width;
|
||||
float pscaleY = _contentSize.height / ptextureSize.height;
|
||||
_progressBarRenderer->setScaleX(pscaleX);
|
||||
_progressBarRenderer->setScaleY(pscaleY);
|
||||
}
|
||||
|
@ -544,7 +544,7 @@ void Slider::progressBarRendererScaleChangedWithSize()
|
|||
{
|
||||
if (_scale9Enabled)
|
||||
{
|
||||
static_cast<extension::Scale9Sprite*>(_progressBarRenderer)->setPreferredSize(_size);
|
||||
static_cast<extension::Scale9Sprite*>(_progressBarRenderer)->setPreferredSize(_contentSize);
|
||||
_progressBarTextureSize = _progressBarRenderer->getContentSize();
|
||||
}
|
||||
else
|
||||
|
@ -555,8 +555,8 @@ void Slider::progressBarRendererScaleChangedWithSize()
|
|||
_progressBarRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float pscaleX = _size.width / ptextureSize.width;
|
||||
float pscaleY = _size.height / ptextureSize.height;
|
||||
float pscaleX = _contentSize.width / ptextureSize.width;
|
||||
float pscaleY = _contentSize.height / ptextureSize.height;
|
||||
_progressBarRenderer->setScaleX(pscaleX);
|
||||
_progressBarRenderer->setScaleY(pscaleY);
|
||||
}
|
||||
|
|
|
@ -302,15 +302,15 @@ void Text::labelScaleChangedWithSize()
|
|||
}
|
||||
else
|
||||
{
|
||||
_labelRenderer->setDimensions(_size.width,_size.height);
|
||||
_labelRenderer->setDimensions(_contentSize.width,_contentSize.height);
|
||||
Size textureSize = _labelRenderer->getContentSize();
|
||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||
{
|
||||
_labelRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_labelRenderer->setScaleX(scaleX);
|
||||
_labelRenderer->setScaleY(scaleY);
|
||||
_normalScaleValueX = scaleX;
|
||||
|
|
|
@ -159,8 +159,8 @@ void TextAtlas::labelAtlasScaleChangedWithSize()
|
|||
_labelAtlasRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_labelAtlasRenderer->setScaleX(scaleX);
|
||||
_labelAtlasRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
|
|
@ -155,8 +155,8 @@ void TextBMFont::labelBMFontScaleChangedWithSize()
|
|||
_labelBMFontRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_labelBMFontRenderer->setScaleX(scaleX);
|
||||
_labelBMFontRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
|
|
@ -783,15 +783,15 @@ void TextField::textfieldRendererScaleChangedWithSize()
|
|||
}
|
||||
else
|
||||
{
|
||||
_textFieldRenderer->setDimensions(_size.width,_size.height);
|
||||
_textFieldRenderer->setDimensions(_contentSize.width, _contentSize.height);
|
||||
Size textureSize = getContentSize();
|
||||
if (textureSize.width <= 0.0f || textureSize.height <= 0.0f)
|
||||
{
|
||||
_textFieldRenderer->setScale(1.0f);
|
||||
return;
|
||||
}
|
||||
float scaleX = _size.width / textureSize.width;
|
||||
float scaleY = _size.height / textureSize.height;
|
||||
float scaleX = _contentSize.width / textureSize.width;
|
||||
float scaleY = _contentSize.height / textureSize.height;
|
||||
_textFieldRenderer->setScaleX(scaleX);
|
||||
_textFieldRenderer->setScaleY(scaleY);
|
||||
}
|
||||
|
|
|
@ -145,7 +145,6 @@ _touchEndPosition(Vec2::ZERO),
|
|||
_touchEventListener(nullptr),
|
||||
_touchEventSelector(nullptr),
|
||||
_actionTag(0),
|
||||
_size(Size::ZERO),
|
||||
_customSize(Size::ZERO),
|
||||
_ignoreSize(false),
|
||||
_affectByClipping(false),
|
||||
|
@ -258,11 +257,11 @@ void Widget::setSize(const Size &size)
|
|||
_customSize = size;
|
||||
if (_ignoreSize)
|
||||
{
|
||||
_size = getVirtualRendererSize();
|
||||
_contentSize = getVirtualRendererSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
_size = size;
|
||||
_contentSize = size;
|
||||
}
|
||||
if (_running)
|
||||
{
|
||||
|
@ -309,11 +308,11 @@ void Widget::setSizePercent(const Vec2 &percent)
|
|||
}
|
||||
if (_ignoreSize)
|
||||
{
|
||||
_size = getVirtualRendererSize();
|
||||
_contentSize = getVirtualRendererSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
_size = cSize;
|
||||
_contentSize = cSize;
|
||||
}
|
||||
_customSize = cSize;
|
||||
onSizeChanged();
|
||||
|
@ -342,11 +341,11 @@ void Widget::updateSizeAndPosition(const cocos2d::Size &parentSize)
|
|||
{
|
||||
if (_ignoreSize)
|
||||
{
|
||||
_size = getVirtualRendererSize();
|
||||
_contentSize = getVirtualRendererSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
_size = _customSize;
|
||||
_contentSize = _customSize;
|
||||
}
|
||||
float spx = 0.0f;
|
||||
float spy = 0.0f;
|
||||
|
@ -366,11 +365,11 @@ void Widget::updateSizeAndPosition(const cocos2d::Size &parentSize)
|
|||
Size cSize = Size(parentSize.width * _sizePercent.x , parentSize.height * _sizePercent.y);
|
||||
if (_ignoreSize)
|
||||
{
|
||||
_size = getVirtualRendererSize();
|
||||
_contentSize = getVirtualRendererSize();
|
||||
}
|
||||
else
|
||||
{
|
||||
_size = cSize;
|
||||
_contentSize = cSize;
|
||||
}
|
||||
_customSize = cSize;
|
||||
break;
|
||||
|
@ -425,11 +424,11 @@ void Widget::ignoreContentAdaptWithSize(bool ignore)
|
|||
if (_ignoreSize)
|
||||
{
|
||||
Size s = getVirtualRendererSize();
|
||||
_size = s;
|
||||
_contentSize = s;
|
||||
}
|
||||
else
|
||||
{
|
||||
_size = _customSize;
|
||||
_contentSize = _customSize;
|
||||
}
|
||||
onSizeChanged();
|
||||
}
|
||||
|
@ -441,7 +440,7 @@ bool Widget::isIgnoreContentAdaptWithSize() const
|
|||
|
||||
const Size& Widget::getSize() const
|
||||
{
|
||||
return _size;
|
||||
return _contentSize;
|
||||
}
|
||||
|
||||
const Size& Widget::getCustomSize() const
|
||||
|
@ -466,7 +465,7 @@ Node* Widget::getVirtualRenderer()
|
|||
|
||||
void Widget::onSizeChanged()
|
||||
{
|
||||
setContentSize(_size);
|
||||
setContentSize(_contentSize);
|
||||
for (auto& child : getChildren())
|
||||
{
|
||||
Widget* widgetChild = dynamic_cast<Widget*>(child);
|
||||
|
@ -486,11 +485,11 @@ void Widget::updateContentSizeWithTextureSize(const cocos2d::Size &size)
|
|||
{
|
||||
if (_ignoreSize)
|
||||
{
|
||||
_size = size;
|
||||
_contentSize = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
_size = _customSize;
|
||||
_contentSize = _customSize;
|
||||
}
|
||||
onSizeChanged();
|
||||
}
|
||||
|
@ -911,22 +910,22 @@ bool Widget::isEnabled() const
|
|||
|
||||
float Widget::getLeftBoundary() const
|
||||
{
|
||||
return getPosition().x - getAnchorPoint().x * _size.width;
|
||||
return getPosition().x - getAnchorPoint().x * _contentSize.width;
|
||||
}
|
||||
|
||||
float Widget::getBottomBoundary() const
|
||||
{
|
||||
return getPosition().y - getAnchorPoint().y * _size.height;
|
||||
return getPosition().y - getAnchorPoint().y * _contentSize.height;
|
||||
}
|
||||
|
||||
float Widget::getRightBoundary() const
|
||||
{
|
||||
return getLeftBoundary() + _size.width;
|
||||
return getLeftBoundary() + _contentSize.width;
|
||||
}
|
||||
|
||||
float Widget::getTopBoundary() const
|
||||
{
|
||||
return getBottomBoundary() + _size.height;
|
||||
return getBottomBoundary() + _contentSize.height;
|
||||
}
|
||||
|
||||
const Vec2& Widget::getTouchBeganPosition()const
|
||||
|
@ -1012,7 +1011,7 @@ void Widget::copyProperties(Widget *widget)
|
|||
setName(widget->getName());
|
||||
setActionTag(widget->getActionTag());
|
||||
_ignoreSize = widget->_ignoreSize;
|
||||
_size = widget->_size;
|
||||
_contentSize = widget->_contentSize;
|
||||
_customSize = widget->_customSize;
|
||||
_sizeType = widget->getSizeType();
|
||||
_sizePercent = widget->_sizePercent;
|
||||
|
|
|
@ -407,7 +407,7 @@ public:
|
|||
|
||||
const Size& getCustomSize() const;
|
||||
|
||||
virtual const Size& getLayoutSize() {return _size;};
|
||||
virtual const Size& getLayoutSize() {return _contentSize;};
|
||||
|
||||
/**
|
||||
* Returns size percent of widget
|
||||
|
@ -659,7 +659,6 @@ protected:
|
|||
//use
|
||||
int _actionTag;
|
||||
|
||||
Size _size;
|
||||
Size _customSize;
|
||||
|
||||
Vec2 _sizePercent;
|
||||
|
|
Loading…
Reference in New Issue