mirror of https://github.com/axmolengine/axmol.git
ui::loadingBar -> add flip logic back
This commit is contained in:
parent
d4a5d0da44
commit
847094ec7d
|
@ -111,10 +111,26 @@ void LoadingBar::setDirection(cocos2d::ui::LoadingBar::Direction direction)
|
|||
case Direction::LEFT:
|
||||
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
|
||||
_barRenderer->setPosition(Vec2(0,_contentSize.height*0.5f));
|
||||
if (!_scale9Enabled)
|
||||
{
|
||||
auto innerSprite = _barRenderer->getSprite();
|
||||
if (nullptr != innerSprite)
|
||||
{
|
||||
innerSprite->setFlippedX(false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case Direction::RIGHT:
|
||||
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
|
||||
_barRenderer->setPosition(Vec2(_totalLength,_contentSize.height*0.5f));
|
||||
if (!_scale9Enabled)
|
||||
{
|
||||
auto innerSprite = _barRenderer->getSprite();
|
||||
if (nullptr != innerSprite)
|
||||
{
|
||||
innerSprite->setFlippedX(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -167,9 +183,27 @@ void LoadingBar::setupTexture()
|
|||
{
|
||||
case Direction::LEFT:
|
||||
_barRenderer->setAnchorPoint(Vec2(0.0f,0.5f));
|
||||
if (!_scale9Enabled)
|
||||
{
|
||||
auto innerSprite = _barRenderer->getSprite();
|
||||
if (nullptr != innerSprite)
|
||||
{
|
||||
innerSprite->setFlippedX(false);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case Direction::RIGHT:
|
||||
_barRenderer->setAnchorPoint(Vec2(1.0f,0.5f));
|
||||
if (!_scale9Enabled)
|
||||
{
|
||||
auto innerSprite = _barRenderer->getSprite();
|
||||
if (nullptr != innerSprite)
|
||||
{
|
||||
innerSprite->setFlippedX(true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
_barRenderer->setCapInsets(_capInsets);
|
||||
|
|
Loading…
Reference in New Issue