From ca701031116232aba4de64c74d4480520d074534 Mon Sep 17 00:00:00 2001 From: knoxHuang <821686174@qq.com> Date: Wed, 13 Apr 2016 15:43:13 +0800 Subject: [PATCH] =?UTF-8?q?Sprite=20execution=20should=20not=20=20?= =?UTF-8?q?=E2=80=98size-changed=E2=80=99=20at=20run=20time?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cocos2d/core/components/CCSprite.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cocos2d/core/components/CCSprite.js b/cocos2d/core/components/CCSprite.js index 58d9a9dcd0..a67c1a6667 100644 --- a/cocos2d/core/components/CCSprite.js +++ b/cocos2d/core/components/CCSprite.js @@ -499,7 +499,7 @@ var Sprite = cc.Class({ return this._sgNode.getInsetBottom(); }, - onLoad: function () { + onLoad: CC_EDITOR && function () { this._super(); this.node.on('size-changed', this._resized, this); }, @@ -512,7 +512,7 @@ var Sprite = cc.Class({ } }, - onDestroy: function () { + onDestroy: CC_EDITOR && function () { this._super(); this.node.off('size-changed', this._resized, this); }, @@ -594,7 +594,7 @@ var Sprite = cc.Class({ _initSgNode: function () { var sgNode = this._sgNode; - + this._applySpriteFrame(null); // should keep the size of the sg node the same as entity, @@ -613,7 +613,7 @@ var Sprite = cc.Class({ sgNode.setBlendFunc(this._blendFunc); }, - _resized: function () { + _resized: CC_EDITOR && function () { if (this._spriteFrame) { var actualSize = this.node.getContentSize(); var expectedW = actualSize.width;