Fix resize issue with flow

This commit is contained in:
Gregory John Casamento 2022-07-17 10:07:09 -04:00
parent 2246da3d0e
commit 9c1aec70e7
2 changed files with 14 additions and 10 deletions

View file

@ -1437,14 +1437,9 @@ static NSString *placeholderItem = nil;
NSSize s = _itemSize;
CGFloat h = s.height;
CGFloat proposedHeight = ns * h;
id sv = [self superview];
//if ([sv isKindOfClass: [NSClipView class]])
// {
// sv = [sv superview];
// }
NSRect newRect = [sv frame];
if (proposedHeight < newRect.size.height)
{
proposedHeight = newRect.size.height;
@ -1453,10 +1448,8 @@ static NSString *placeholderItem = nil;
newRect.size.height = proposedHeight;
[self setFrame: newRect];
NSDebugLog(@"reloading data... number of sections = %ld, %@", ns, _collectionViewLayout);
[_visibleItems removeAllObjects];
[[self subviews] makeObjectsPerformSelector: @selector(removeFromSuperview)];
[self setSubviews: [NSArray array]];
[_collectionViewLayout prepareLayout];
for (cs = 0; cs < ns; cs++)
{

View file

@ -29,6 +29,17 @@
#import "GSGuiPrivate.h"
@interface NSCollectionView (__FlowLayoutPrivate__)
- (void) _setFrameWithoutTile: (NSRect)f;
@end
@implementation NSCollectionView (__FlowLayoutPrivate__)
- (void) _setFrameWithoutTile: (NSRect)f
{
_frame = f;
}
@end
@implementation NSCollectionViewFlowLayoutInvalidationContext
- (instancetype) init
@ -448,7 +459,7 @@
if (y + h > vf.size.height)
{
vf.size.height = y + h;
// [_collectionView setFrame: vf];
[_collectionView _setFrameWithoutTile: vf];
}
// Build attrs object...