Fix ListView dimensions when child elements are scaled.

This commit is contained in:
rh101 2020-11-27 17:02:31 +11:00
parent 192a59f39e
commit f113e1f2ed
1 changed files with 2 additions and 2 deletions

View File

@ -117,7 +117,7 @@ void ListView::updateInnerContainerSize()
float totalHeight = (length == 0) ? 0.0f : (length - 1) * _itemsMargin + (_topPadding + _bottomPadding);
for (auto& item : _items)
{
totalHeight += item->getContentSize().height;
totalHeight += item->getContentSize().height * item->getScaleY();
}
float finalWidth = _contentSize.width;
float finalHeight = totalHeight;
@ -130,7 +130,7 @@ void ListView::updateInnerContainerSize()
float totalWidth = (length == 0) ? 0.0f : (length - 1) * _itemsMargin + (_leftPadding + _rightPadding);
for (auto& item : _items)
{
totalWidth += item->getContentSize().width;
totalWidth += item->getContentSize().width * item->getScaleX();
}
float finalWidth = totalWidth;
float finalHeight = _contentSize.height;