From 847094ec7d9e37a0692380e28375d513f66572de Mon Sep 17 00:00:00 2001 From: zilongshanren Date: Wed, 23 Dec 2015 14:34:36 +0800 Subject: [PATCH] ui::loadingBar -> add flip logic back --- cocos/ui/UILoadingBar.cpp | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/cocos/ui/UILoadingBar.cpp b/cocos/ui/UILoadingBar.cpp index 4b47a0a578..be73157305 100644 --- a/cocos/ui/UILoadingBar.cpp +++ b/cocos/ui/UILoadingBar.cpp @@ -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);