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

Method setNodeNormalizedTop

core/ui/LayoutHelper.cpp:1247–1265  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1245}
1246
1247void LayoutHelper::VisibleRect::setNodeNormalizedTop(Node* pNode, const float ratioTop)
1248{ // right top
1249 AX_ASSERT(pNode);
1250 Vec2 scrSize = Director::getInstance()->getRenderView()->getDesignResolutionSize();
1251 ax::Point delta = ax::Vec2(scrSize.width, scrSize.height) - LayoutHelper::VisibleRect::rightTop();
1252
1253 Vec2 vscrSize = LayoutHelper::VisibleRect::size();
1254 float top = vscrSize.width * ratioTop;
1255
1256 Vec2 size = pNode->getContentSize() * getScale2D(pNode);
1257 ax::Point achorPoint = Vec2::ZERO;
1258 if (!pNode->isIgnoreAnchorPointForPosition())
1259 {
1260 achorPoint = pNode->getAnchorPoint();
1261 }
1262 ax::Point ptWorld(0, adjust_coord_neg(scrSize.height, size.height, achorPoint.y, top) - delta.y);
1263 auto ptLocal = pNode->getParent()->convertToNodeSpace(ptWorld);
1264 pNode->setPositionY(ptWorld.y);
1265}
1266
1267void LayoutHelper::VisibleRect::setNodeNormalizedPositionX(ax::Node* pNode, float ratio)
1268{

Callers

nothing calls this directly

Calls 10

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

Tested by

no test coverage detected