Merge pull request #1183 from zilongshanren/fix-issue-4273

only reset node height in resize_height
This commit is contained in:
Jare Guo
2016-10-11 11:54:51 +08:00
committed by GitHub
+9 -1
View File
@@ -493,9 +493,17 @@ var Label = cc.Class({
_updateNodeSize: function () {
var initialized = this._sgNode && this._sgNode.parent;
if (initialized) {
if (this.overflow === Overflow.NONE || this.overflow === Overflow.RESIZE_HEIGHT) {
if (this.overflow === Overflow.NONE) {
this.node.setContentSize(this._sgNode.getContentSize());
}
if(this.overflow === Overflow.RESIZE_HEIGHT) {
//call this.node.getContentSize actually sync the node size with sgNode
//such that it won't trigger setDimensions method in jsb
var originalSize = this.node.getContentSize();
var newSize = this._sgNode.getContentSize();
this.node.setContentSize(cc.size(originalSize.width, newSize.height));
}
}
}
});