diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index cfde0230ad..e380ca0bc6 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1517,15 +1517,15 @@ Vector2 Node::convertToWorldSpace(const Vector2& nodePoint) const } -Point Node::convertToNodeSpaceAR(const Point& worldPoint) const +Vector2 Node::convertToNodeSpaceAR(const Vector2& worldPoint) const { - Point nodePoint = convertToNodeSpace(worldPoint); + Vector2 nodePoint = convertToNodeSpace(worldPoint); return nodePoint - _anchorPointInPoints; } -Point Node::convertToWorldSpaceAR(const Point& nodePoint) const +Vector2 Node::convertToWorldSpaceAR(const Vector2& nodePoint) const { - Point pt = nodePoint + _anchorPointInPoints; + Vector2 pt = nodePoint + _anchorPointInPoints; return convertToWorldSpace(pt); } @@ -1536,12 +1536,13 @@ Point Node::convertToWindowSpace(const Point& nodePoint) const } // convenience methods which take a Touch instead of Point -Point Node::convertTouchToNodeSpace(Touch *touch) const +Vector2 Node::convertTouchToNodeSpace(Touch *touch) const { Point point = touch->getLocation(); return this->convertToNodeSpace(point); } -Point Node::convertTouchToNodeSpaceAR(Touch *touch) const + +Vector2 Node::convertTouchToNodeSpaceAR(Touch *touch) const { Point point = touch->getLocation(); return this->convertToNodeSpaceAR(point); diff --git a/cocos/2d/CCNode.h b/cocos/2d/CCNode.h index 7fb8bf6e9a..1b38407865 100644 --- a/cocos/2d/CCNode.h +++ b/cocos/2d/CCNode.h @@ -1253,23 +1253,23 @@ public: * Converts a Point to node (local) space coordinates. The result is in Points. * treating the returned/received node point as anchor relative. */ - Point convertToNodeSpaceAR(const Point& worldPoint) const; + Vector2 convertToNodeSpaceAR(const Vector2& worldPoint) const; /** * Converts a local Point to world space coordinates.The result is in Points. * treating the returned/received node point as anchor relative. */ - Point convertToWorldSpaceAR(const Point& nodePoint) const; + Vector2 convertToWorldSpaceAR(const Vector2& nodePoint) const; /** * convenience methods which take a Touch instead of Point */ - Point convertTouchToNodeSpace(Touch * touch) const; + Vector2 convertTouchToNodeSpace(Touch * touch) const; /** * converts a Touch (world coordinates) into a local coordinate. This method is AR (Anchor Relative). */ - Point convertTouchToNodeSpaceAR(Touch * touch) const; + Vector2 convertTouchToNodeSpaceAR(Touch * touch) const; /** * Sets an additional transform matrix to the node.