ui::loadingBar -> add flip logic back

This commit is contained in:
zilongshanren 2015-12-23 14:34:36 +08:00
parent d4a5d0da44
commit 847094ec7d
1 changed files with 34 additions and 0 deletions

View File

@ -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);