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

Method setNodeTop

core/ui/LayoutHelper.cpp:1047–1061  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1045 pNode->setPositionX(ptLocal.x);
1046}
1047void LayoutHelper::VisibleRect::setNodeTop(Node* pNode, float top)
1048{
1049 AX_ASSERT(pNode);
1050 Vec2 scrSize = Director::getInstance()->getRenderView()->getDesignResolutionSize();
1051 ax::Point delta = ax::Vec2(0, scrSize.height) - LayoutHelper::VisibleRect::leftTop();
1052 Vec2 size = pNode->getContentSize() * getScale2D(pNode);
1053 ax::Point achorPoint = Vec2::ZERO;
1054 if (!pNode->isIgnoreAnchorPointForPosition())
1055 {
1056 achorPoint = pNode->getAnchorPoint();
1057 }
1058 ax::Point ptWorld(0, adjust_coord_neg(scrSize.height, size.height, achorPoint.y, top) - delta.y);
1059 auto ptLocal = pNode->getParent()->convertToNodeSpace(ptWorld);
1060 pNode->setPositionY(ptLocal.y);
1061}
1062void LayoutHelper::VisibleRect::setNodeRight(Node* pNode, float right)
1063{
1064 AX_ASSERT(pNode);

Callers

nothing calls this directly

Calls 9

getInstanceFunction · 0.85
getScale2DFunction · 0.85
getAnchorPointMethod · 0.80
convertToNodeSpaceMethod · 0.80
Vec2Function · 0.50
getContentSizeMethod · 0.45
getParentMethod · 0.45
setPositionYMethod · 0.45

Tested by

no test coverage detected