Skip to content

Commit

Permalink
Fix for item not being ull width in non-integral collection views.
Browse files Browse the repository at this point in the history
[cappuccino#164 state:resolved].

Reviewed by me.
  • Loading branch information
Francisco Ryan Tolmasky I committed Dec 14, 2008
1 parent de5d83a commit b08e98d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion AppKit/CPCollectionView.j
Expand Up @@ -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)
Expand All @@ -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;
Expand Down Expand Up @@ -515,6 +519,7 @@
frame = [view frame];

[view setFrameSize:_itemSize];
[view setAlphaValue:0.5];

[self dragView:view
at:[[_items[[_selectionIndexes firstIndex]] view] frame].origin
Expand Down

0 comments on commit b08e98d

Please sign in to comment.