| 108 | } |
| 109 | |
| 110 | void 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 | |
| 145 | void ListView::remedyVerticalLayoutParameter(LinearLayoutParameter* layoutParameter, ssize_t itemIndex) |
| 146 | { |
nothing calls this directly
no test coverage detected