diff --git a/cocos2d/core/components/CCProgressBar.js b/cocos2d/core/components/CCProgressBar.js index 5a4376e794..f566b95f6f 100644 --- a/cocos2d/core/components/CCProgressBar.js +++ b/cocos2d/core/components/CCProgressBar.js @@ -38,9 +38,9 @@ var Mode = cc.Enum({ */ VERTICAL: 1, /** - * @property {Number} RADIAL + * @property {Number} FILLED */ - RADIAL: 2, + FILLED: 2, }); /** @@ -71,7 +71,7 @@ var ProgressBar = cc.Class({ } if (this.barSprite.fillType === cc.Sprite.FillType.RADIAL) { - this.mode = Mode.RADIAL; + this.mode = Mode.FILLED; } var barSpriteSize = entity.getContentSize(); @@ -127,7 +127,10 @@ var ProgressBar = cc.Class({ totalWidth = entitySize.width; totalHeight = this.totalLength; break; - case Mode.RADIAL: + case Mode.FILLED: + if (this.reverse) { + actualLenth = actualLenth * -1; + } this.barSprite.fillRange = actualLenth; break; } @@ -181,7 +184,7 @@ var ProgressBar = cc.Class({ this.totalLength = entitySize.width; } else if (this.mode === Mode.VERTICAL) { this.totalLength = entitySize.height; - } else if (this.mode === Mode.RADIAL) { + } else if (this.mode === Mode.FILLED) { this.totalLength = this.barSprite.fillRange; } } diff --git a/cocos2d/core/components/CCSprite.js b/cocos2d/core/components/CCSprite.js index 280b12caaa..8e16182db7 100644 --- a/cocos2d/core/components/CCSprite.js +++ b/cocos2d/core/components/CCSprite.js @@ -170,7 +170,7 @@ var Sprite = cc.Class({ return this._fillStart; }, set: function(value) { - this._fillStart = cc.clamp01(value); + this._fillStart = cc.clampf(value, -1, 1); this._sgNode && this._sgNode.setFillStart(value); }, }, @@ -180,7 +180,7 @@ var Sprite = cc.Class({ return this._fillRange; }, set: function(value) { - this._fillRange = cc.clamp01(value); + this._fillRange = cc.clampf(value, -1, 1); this._sgNode && this._sgNode.setFillRange(value); }, },