From cc7366845e7e10732fb9ab529bb4f7be5d7b15b7 Mon Sep 17 00:00:00 2001 From: halx99 Date: Thu, 26 Nov 2020 23:08:30 -0800 Subject: [PATCH] Merge: 74add84559 f113e1f2ed Merge pull request #285 from rh101/fix-listview-dimensions Fix ListView dimensions when child elements are scaled --- cocos/ui/UIListView.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cocos/ui/UIListView.cpp b/cocos/ui/UIListView.cpp index dae43dd0b4..3c39d408f9 100644 --- a/cocos/ui/UIListView.cpp +++ b/cocos/ui/UIListView.cpp @@ -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;