Skip to content

Commit c9d132d

Browse files
author
SeanLin
committed
Merge pull request cocos2d#555 from dingpinglv/iss1348_PortBaseNode
fixed cocos2d#1348 modify code for setter of cc.Node
2 parents 465240f + 50f3a95 commit c9d132d

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

cocos2d/base_nodes/CCNode.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,7 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
484484
this._position.y = yValue;
485485
//this._position = cc.p(newPosOrxValue,yValue);
486486
} else if (newPosOrxValue.y != null) {
487-
this._position.x = newPosOrxValue.x;
488-
this._position.y = newPosOrxValue.y;
487+
this._position = new cc.Point(newPosOrxValue.x,newPosOrxValue.y);
489488
}
490489

491490
//save dirty region when after changed
@@ -623,11 +622,8 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
623622
//save dirty region when before change
624623
//this._addDirtyRegionToDirector(this.getBoundingBoxToWorld());
625624

626-
this._anchorPoint.x = point.x;
627-
this._anchorPoint.y = point.y;
628-
629-
this._anchorPointInPoints.x = this._contentSize.width * this._anchorPoint.x;
630-
this._anchorPointInPoints.y = this._contentSize.height * this._anchorPoint.y;
625+
this._anchorPoint = new cc.Point(point.x, point.y);
626+
this._anchorPointInPoints = new cc.Point(this._contentSize.width * this._anchorPoint.x,this._contentSize.height * this._anchorPoint.y);
631627

632628
//save dirty region when after changed
633629
//this._addDirtyRegionToDirector(this.getBoundingBoxToWorld());
@@ -658,11 +654,8 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
658654
if (!cc.Size.CCSizeEqualToSize(size, this._contentSize)) {
659655
//save dirty region when before change
660656
//this._addDirtyRegionToDirector(this.getBoundingBoxToWorld());
661-
this._contentSize.width = size.width;
662-
this._contentSize.height = size.height;
663-
664-
this._anchorPointInPoints.width = this._contentSize.width * this._anchorPoint.x;
665-
this._anchorPointInPoints.height = this._contentSize.height * this._anchorPoint.y;
657+
this._contentSize = new cc.Size(size.width,size.height);
658+
this._anchorPointInPoints = new cc.Point(this._contentSize.width * this._anchorPoint.x, this._contentSize.height * this._anchorPoint.y);
666659
//save dirty region when before change
667660
//this._addDirtyRegionToDirector(this.getBoundingBoxToWorld());
668661
this.setNodeDirty();

0 commit comments

Comments
 (0)