Skip to content

Commit 7b0ac0f

Browse files
committed
Merge pull request cocos2d#2923 from VisualSJ/develop-spriteFrame
Fixed texture does not rotate bug
2 parents d4db1f0 + cc321f0 commit 7b0ac0f

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

extensions/ccui/uiwidgets/UILoadingBar.js

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -240,24 +240,28 @@ ccui.LoadingBar = ccui.Widget.extend(/** @lends ccui.LoadingBar# */{
240240
this._setPercent(percent);
241241
},
242242

243-
_setPercent: function(percent){
243+
_setPercent: function(){
244+
var res, rect, spriteRenderer, spriteTextureRect;
245+
244246
if (this._totalLength <= 0)
245247
return;
246-
var res = this._percent / 100.0;
248+
res = this._percent / 100.0;
247249

248250
if (this._scale9Enabled)
249251
this._setScale9Scale();
250252
else {
251-
var spriteRenderer = this._barRenderer;
252-
var rect = spriteRenderer.getTextureRect();
253-
rect.width = this._barRendererTextureSize.width * res;
254-
this._barRenderer.setTextureRect(
253+
spriteRenderer = this._barRenderer;
254+
spriteTextureRect = this._barRendererTextureSize;
255+
rect = spriteRenderer.getTextureRect();
256+
rect.width = spriteTextureRect.width * res;
257+
spriteRenderer.setTextureRect(
255258
cc.rect(
256259
rect.x,
257260
rect.y,
258-
this._barRendererTextureSize.width * res,
259-
this._barRendererTextureSize.height
260-
)
261+
spriteTextureRect.width * res,
262+
spriteTextureRect.height
263+
),
264+
spriteRenderer._rectRotated
261265
);
262266
}
263267
},

0 commit comments

Comments
 (0)