diff --git a/Source/NSCollectionView.m b/Source/NSCollectionView.m index 8b487f6ec..2ddc873e2 100644 --- a/Source/NSCollectionView.m +++ b/Source/NSCollectionView.m @@ -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) @@ -700,7 +700,7 @@ - (NSRect) frameForItemAtIndex: (NSUInteger)theIndex { if (index % _numberOfColumns == 0) { - x = _horizontalMargin; + x = 0; y += _verticalMargin + _itemSize.height; } @@ -731,6 +731,9 @@ - (NSRect) frameForItemAtIndex: (NSUInteger)theIndex x += _itemSize.width + _horizontalMargin; } + if(_maxNumberOfColumns == 1) { + itemFrame.size.width = self.frame.size.width; + } return itemFrame; }