From 53cead8fdb4615ec76c00421d66de6e45ab7e577 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Wed, 16 Aug 2017 18:28:34 +0800 Subject: [PATCH 1/2] Failed to refresh the size in time for fireball/issues/6263 --- cocos2d/core/components/CCLabel.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index 484b794dde..49840c6f7e 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -501,6 +501,11 @@ var Label = cc.Class({ }, + onEnable: function () { + this._super(); + this._updateNodeSize(); + }, + _createSgNode: function () { return null; }, From 565c42ff7f6fa5670fece6faaf07af4d34b105c4 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Thu, 17 Aug 2017 14:19:57 +0800 Subject: [PATCH 2/2] remove redundant code --- cocos2d/core/components/CCLabel.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cocos2d/core/components/CCLabel.js b/cocos2d/core/components/CCLabel.js index 49840c6f7e..250de3da11 100644 --- a/cocos2d/core/components/CCLabel.js +++ b/cocos2d/core/components/CCLabel.js @@ -489,11 +489,6 @@ var Label = cc.Class({ __preload: function () { this._super(); - var sgSizeInitialized = this._sgNode._isUseSystemFont; - if (sgSizeInitialized) { - this._updateNodeSize(); - } - // node should be resize whenever font changed, needed only on web if (!CC_JSB) { this._sgNode.on('load', this._updateNodeSize, this);