From b08e98d0ab595d1e8c149e8a3cbf89637681ee8e Mon Sep 17 00:00:00 2001 From: Francisco Ryan Tolmasky I Date: Sun, 14 Dec 2008 10:49:38 -0800 Subject: [PATCH] Fix for item not being ull width in non-integral collection views. [#164 state:resolved]. Reviewed by me. --- AppKit/CPCollectionView.j | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/AppKit/CPCollectionView.j b/AppKit/CPCollectionView.j index 6efb2b2666..ddc353ce70 100644 --- a/AppKit/CPCollectionView.j +++ b/AppKit/CPCollectionView.j @@ -328,7 +328,7 @@ // either proportioned out to the views (if their minSize != maxSize) or used as // margin var itemSize = CGSizeMakeCopy(_minItemSize); - + _numberOfColumns = MAX(1.0, FLOOR(width / itemSize.width)); if (_maxNumberOfColumns > 0) @@ -340,6 +340,10 @@ if (remaining > 0 && itemSize.width < _maxItemSize.width) itemSize.width = MIN(_maxItemSize.width, itemSize.width + FLOOR(remaining / _numberOfColumns)); + // When we ONE column and a non-integral width, the FLOORing above can cause the item width to be smaller than the total width. + if (_maxNumberOfColumns == 1 && itemSize.width < _maxItemSize.width && itemSize.width < width) + itemSize.width = MIN(_maxItemSize.width, width); + if (!CGSizeEqualToSize(_itemSize, itemSize)) { _itemSize = itemSize; @@ -515,6 +519,7 @@ frame = [view frame]; [view setFrameSize:_itemSize]; + [view setAlphaValue:0.5]; [self dragView:view at:[[_items[[_selectionIndexes firstIndex]] view] frame].origin