From 29f6f34216c2d2efe48b33e45ff0d0aeedbeb7cb Mon Sep 17 00:00:00 2001 From: pandamicro Date: Mon, 12 Sep 2016 11:00:12 +0800 Subject: [PATCH] Fix convertToWorldSpace calculation issue --- cocos2d/core/utils/base-node.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cocos2d/core/utils/base-node.js b/cocos2d/core/utils/base-node.js index 0b3a52dbf8..b2bae14ea2 100644 --- a/cocos2d/core/utils/base-node.js +++ b/cocos2d/core/utils/base-node.js @@ -1574,8 +1574,10 @@ var BaseNode = cc.Class(/** @lends cc.Node# */{ // ensure transform computed cc.director._visitScene(); } - var worldPositionIgnoreAnchorPoint = this._sgNode.convertToWorldSpace(nodePoint); - return cc.pSub(worldPositionIgnoreAnchorPoint, cc.p(this._anchorPoint.x * this._contentSize.width, this._anchorPoint.y * this._contentSize.height)); + var x = nodePoint.x - this._anchorPoint.x * this._contentSize.width; + var y = nodePoint.y - this._anchorPoint.y * this._contentSize.height; + var worldPositionIgnoreAnchorPoint = this._sgNode.convertToWorldSpace(cc.v2(x, y)); + return worldPositionIgnoreAnchorPoint; }, /**