MCPcopy Create free account
hub / github.com/axmolengine/axmol / setNodeNormalizedPosition

Method setNodeNormalizedPosition

core/ui/LayoutHelper.cpp:1285–1295  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1283 pNode->setPositionY(ptLocal.y);
1284}
1285void LayoutHelper::VisibleRect::setNodeNormalizedPosition(Node* pNode, const ax::Point& ratio)
1286{
1287 AX_ASSERT(pNode);
1288 pNode->setIgnoreAnchorPointForPosition(false);
1289 pNode->setAnchorPoint(ax::Vec2(.5f, .5f));
1290 ax::Rect visibleRect = LayoutHelper::LayoutHelper::VisibleRect::getScreenVisibleRect();
1291 ax::Point ptWorld(visibleRect.size.width * ratio.x + visibleRect.origin.x,
1292 visibleRect.size.height * ratio.y + visibleRect.origin.y);
1293 auto ptLocal = pNode->getParent()->convertToNodeSpace(ptWorld);
1294 pNode->setPosition(ptLocal);
1295}

Callers

nothing calls this directly

Calls 6

convertToNodeSpaceMethod · 0.80
Vec2Function · 0.50
setAnchorPointMethod · 0.45
getParentMethod · 0.45
setPositionMethod · 0.45

Tested by

no test coverage detected