Merge pull request #1178 from zilongshanren/fix-label-debounce-issue

move debounce function in ctor
This commit is contained in:
Jare Guo
2016-10-09 18:34:15 +08:00
committed by GitHub
+2 -4
View File
@@ -149,6 +149,8 @@ var Label = cc.Class({
ctor: function() {
if(CC_EDITOR) {
this._userDefinedFontSize = 40;
this._debouncedUpdateSgNodeString = debounce(this._updateSgNodeString, 200);
this._debouncedUpdateFontSize = debounce(this._updateSgNodeFontSize, 200);
}
},
@@ -427,10 +429,6 @@ var Label = cc.Class({
__preload: function () {
this._super();
if (CC_EDITOR) {
this._debouncedUpdateSgNodeString = debounce(this._updateSgNodeString, 200);
this._debouncedUpdateFontSize = debounce(this._updateSgNodeFontSize, 200);
}
var sgSizeInitialized = this._sgNode._isUseSystemFont;
if (sgSizeInitialized) {