From 50f3a950e16ebbb7c3d7e161ed3097bf53995f7d Mon Sep 17 00:00:00 2001 From: dingpinglv Date: Fri, 28 Sep 2012 11:14:12 +0800 Subject: [PATCH] fixed #1348 modify code for setter of cc.Node --- cocos2d/base_nodes/CCNode.js | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/cocos2d/base_nodes/CCNode.js b/cocos2d/base_nodes/CCNode.js index 9887cd2722..bf5a59854b 100644 --- a/cocos2d/base_nodes/CCNode.js +++ b/cocos2d/base_nodes/CCNode.js @@ -484,8 +484,7 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{ this._position.y = yValue; //this._position = cc.p(newPosOrxValue,yValue); } else if (newPosOrxValue.y != null) { - this._position.x = newPosOrxValue.x; - this._position.y = newPosOrxValue.y; + this._position = new cc.Point(newPosOrxValue.x,newPosOrxValue.y); } //save dirty region when after changed @@ -623,11 +622,8 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{ //save dirty region when before change //this._addDirtyRegionToDirector(this.getBoundingBoxToWorld()); - this._anchorPoint.x = point.x; - this._anchorPoint.y = point.y; - - this._anchorPointInPoints.x = this._contentSize.width * this._anchorPoint.x; - this._anchorPointInPoints.y = this._contentSize.height * this._anchorPoint.y; + this._anchorPoint = new cc.Point(point.x, point.y); + this._anchorPointInPoints = new cc.Point(this._contentSize.width * this._anchorPoint.x,this._contentSize.height * this._anchorPoint.y); //save dirty region when after changed //this._addDirtyRegionToDirector(this.getBoundingBoxToWorld()); @@ -658,11 +654,8 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{ if (!cc.Size.CCSizeEqualToSize(size, this._contentSize)) { //save dirty region when before change //this._addDirtyRegionToDirector(this.getBoundingBoxToWorld()); - this._contentSize.width = size.width; - this._contentSize.height = size.height; - - this._anchorPointInPoints.width = this._contentSize.width * this._anchorPoint.x; - this._anchorPointInPoints.height = this._contentSize.height * this._anchorPoint.y; + this._contentSize = new cc.Size(size.width,size.height); + this._anchorPointInPoints = new cc.Point(this._contentSize.width * this._anchorPoint.x, this._contentSize.height * this._anchorPoint.y); //save dirty region when before change //this._addDirtyRegionToDirector(this.getBoundingBoxToWorld()); this.setNodeDirty();