Skip to content

Commit

Permalink
Merge pull request #319 from johnathan-becker/johnb-fix-textbox
Browse files Browse the repository at this point in the history
Fix issue with NSCollectionView and single column views
  • Loading branch information
gcasa authored Nov 17, 2024
2 parents f7fd33a + c80105a commit bc53ea0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Source/NSCollectionView.m
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ - (NSRect) frameForItemAtIndex: (NSUInteger)theIndex
NSRect itemFrame = NSMakeRect (0,0,0,0);
NSInteger index;
NSUInteger count = [_items count];
CGFloat x = _horizontalMargin;
CGFloat x = 0;
CGFloat y = -_itemSize.height;

if (_maxNumberOfColumns > 0 && _maxNumberOfRows > 0)
Expand All @@ -700,7 +700,7 @@ - (NSRect) frameForItemAtIndex: (NSUInteger)theIndex
{
if (index % _numberOfColumns == 0)
{
x = _horizontalMargin;
x = 0;
y += _verticalMargin + _itemSize.height;
}

Expand Down Expand Up @@ -731,6 +731,9 @@ - (NSRect) frameForItemAtIndex: (NSUInteger)theIndex

x += _itemSize.width + _horizontalMargin;
}
if(_maxNumberOfColumns == 1) {
itemFrame.size.width = self.frame.size.width;
}
return itemFrame;
}

Expand Down

0 comments on commit bc53ea0

Please sign in to comment.