Merge pull request #187 from dabingnn/v0.7fixSpriteContentSizeJSB

V0.7fix sprite content size jsb
This commit is contained in:
pandamicro
2016-01-05 16:32:42 +08:00
+9
View File
@@ -1276,3 +1276,12 @@ cc.Scale9Sprite.prototype.setAnchorPoint = function(anchorPoint, y){
}
this._setAnchorPoint(anchorPoint);
};
cc.Scale9Sprite.prototype._setSpriteFrame = cc.Scale9Sprite.prototype.setSpriteFrame;
cc.Scale9Sprite.prototype.setSpriteFrame = function(spriteFrame) {
var contentSize = this.getContentSize();
this._setSpriteFrame(spriteFrame);
if (!cc.sizeEqualToSize(contentSize, cc.size(0, 0))) {
this.setContentSize(contentSize);
}
};