Move getWorldPosition() from Widget to Node class (#978)

* Committing genbindings changes

* Move getWorldPosition() method to Node class to allow world position to be retrieved for any node.
This commit is contained in:
RH 2022-12-07 12:24:46 +11:00 committed by GitHub
parent 23b19d4b40
commit 1a0612ca6e
4 changed files with 12 additions and 12 deletions

View File

@ -1929,6 +1929,11 @@ Vec2 Node::convertTouchToNodeSpaceAR(Touch* touch) const
return this->convertToNodeSpaceAR(point);
}
Vec2 Node::getWorldPosition() const
{
return convertToWorldSpace(Vec2(_anchorPoint.x * _contentSize.width, _anchorPoint.y * _contentSize.height));
}
void Node::updateTransform()
{
// Recursively iterate over children

View File

@ -1608,6 +1608,13 @@ public:
*/
Vec2 convertTouchToNodeSpaceAR(Touch* touch) const;
/**
* Gets position of widget in world space.
*
* @return Position of widget in world space.
*/
Vec2 getWorldPosition() const;
/**
* Sets an additional transform matrix to the node.
*

View File

@ -503,11 +503,6 @@ const Vec2& Widget::getSizePercent()
return _sizePercent;
}
Vec2 Widget::getWorldPosition() const
{
return convertToWorldSpace(Vec2(_anchorPoint.x * _contentSize.width, _anchorPoint.y * _contentSize.height));
}
Node* Widget::getVirtualRenderer()
{
return this;

View File

@ -511,13 +511,6 @@ public:
*/
bool isIgnoreContentAdaptWithSize() const;
/**
* Gets position of widget in world space.
*
* @return Position of widget in world space.
*/
Vec2 getWorldPosition() const;
/**
* Gets the inner Renderer node of widget.
*