Merge pull request #285 from rh101/fix-listview-dimensions

Fix ListView dimensions when child elements are scaled
This commit is contained in:
halx99 2020-11-26 23:08:30 -08:00 committed by GitHub
parent bcb96e66ee
commit cc7366845e
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;