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

Method updateInnerContainerSize

core/ui/UIListView.cpp:110–143  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void ListView::updateInnerContainerSize()
111{
112 switch (_direction)
113 {
114 case Direction::VERTICAL:
115 {
116 size_t length = _items.size();
117 float totalHeight = (length == 0) ? 0.0f : (length - 1) * _itemsMargin + (_topPadding + _bottomPadding);
118 for (auto&& item : _items)
119 {
120 totalHeight += item->getContentSize().height * item->getScaleY();
121 }
122 float finalWidth = _contentSize.width;
123 float finalHeight = totalHeight;
124 setInnerContainerSize(Vec2(finalWidth, finalHeight));
125 break;
126 }
127 case Direction::HORIZONTAL:
128 {
129 size_t length = _items.size();
130 float totalWidth = (length == 0) ? 0.0f : (length - 1) * _itemsMargin + (_leftPadding + _rightPadding);
131 for (auto&& item : _items)
132 {
133 totalWidth += item->getContentSize().width * item->getScaleX();
134 }
135 float finalWidth = totalWidth;
136 float finalHeight = _contentSize.height;
137 setInnerContainerSize(Vec2(finalWidth, finalHeight));
138 break;
139 }
140 default:
141 break;
142 }
143}
144
145void ListView::remedyVerticalLayoutParameter(LinearLayoutParameter* layoutParameter, ssize_t itemIndex)
146{

Callers

nothing calls this directly

Calls 5

Vec2Function · 0.50
sizeMethod · 0.45
getContentSizeMethod · 0.45
getScaleYMethod · 0.45
getScaleXMethod · 0.45

Tested by

no test coverage detected