1
mirror of https://code.videolan.org/videolan/vlc synced 2024-09-04 09:11:33 +02:00

macosx: Use accurate width for container view intrinsic sizing

Signed-off-by: Claudio Cambra <developer@claudiocambra.com>
This commit is contained in:
Claudio Cambra 2022-12-14 02:26:38 +01:00 committed by Jean-Baptiste Kempf
parent 2406d1b186
commit 839f4dc45d

View File

@ -180,23 +180,28 @@
scrollViewInsets.bottom +
collectionViewLayoutInset.top +
collectionViewLayoutInset.bottom;
const CGFloat width = scrollViewInsets.left +
scrollViewInsets.right +
collectionViewLayoutInset.left +
collectionViewLayoutInset.right +
self.frame.size.width;
if (collectionViewContentSize.height == 0) {
// If we don't return a size larger than 0 then we run into issues with the collection
// view layout not trying to properly calculate its size. So let's return something
NSLog(@"Unable to provide accurate height for container -- providing rough size");
const CGFloat roughValue = _collectionViewLayout.itemSize.height + insetsHeight;
return NSMakeSize(roughValue, roughValue);
return NSMakeSize(width, roughValue);
}
if (_groupDescriptor.isHorizontalBarCollectionView) {
const CGFloat viewHeight = _collectionViewLayout.itemSize.height +
insetsHeight +
15; // Account for horizontal scrollbar
return NSMakeSize(viewHeight, viewHeight);
return NSMakeSize(width, viewHeight);
}
return _scrollView.documentView.frame.size;
return NSMakeSize(width, collectionViewContentSize.height - 1);
}
@end