Merge pull request #366 from jareguo/master

fix label size not initialized in play mode
This commit is contained in:
Jare Guo
2016-02-23 16:50:32 +08:00
+8 -5
View File
@@ -271,11 +271,14 @@ var Label = cc.Class({
// update node size (this will also invoke the size-changed event)
_updateNodeSize: function () {
if (this.overflow === Overflow.NONE) {
this.node.setContentSize(this._sgNode.getContentSize());
}
if ( !this.node._sizeProvider ) {
this.node._sizeProvider = this._sgNode;
var initialized = this._sgNode && this._sgNode.parent;
if (initialized) {
if (this.overflow === Overflow.NONE) {
this.node.setContentSize(this._sgNode.getContentSize());
}
if ( !this.node._sizeProvider ) {
this.node._sizeProvider = this._sgNode;
}
}
}
});