Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Fix edge insets in horizontally-scrolling groups
Browse files Browse the repository at this point in the history
  • Loading branch information
hartez committed Feb 5, 2021
1 parent 9fec16e commit b987bc0
Showing 1 changed file with 11 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -217,34 +217,24 @@ int GetLayoutSpanCount()
return uIEdgeInsets;
}

// If we're grouping, we'll need to inset the sections to maintain the item spacing between the
// groups and/or their group headers/footers
// If we're grouping, we'll need to inset the sections to maintain the spacing between the
// groups and their group headers/footers

var itemsLayout = ItemsView.ItemsLayout;
var scrollDirection = itemsViewLayout.ScrollDirection;
nfloat lineSpacing = itemsViewLayout.GetMinimumLineSpacingForSection(collectionView, itemsViewLayout, section);
nfloat spacing = itemsViewLayout.GetMinimumLineSpacingForSection(collectionView, itemsViewLayout, section);

if (itemsLayout is GridItemsLayout)
{
if (scrollDirection == UICollectionViewScrollDirection.Horizontal)
{
nfloat itemSpacing = itemsViewLayout.GetMinimumInteritemSpacingForSection(collectionView, itemsViewLayout, section);

return new UIEdgeInsets(uIEdgeInsets.Top, itemSpacing + uIEdgeInsets.Left,
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
}
var top = uIEdgeInsets.Top;
var left = uIEdgeInsets.Left;

return new UIEdgeInsets(lineSpacing + uIEdgeInsets.Top, uIEdgeInsets.Left,
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
if (itemsViewLayout.ScrollDirection == UICollectionViewScrollDirection.Horizontal)
{
left += spacing;
}

if (scrollDirection == UICollectionViewScrollDirection.Horizontal)
else
{
return new UIEdgeInsets(uIEdgeInsets.Top, lineSpacing + uIEdgeInsets.Left,
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
top += spacing;
}

return new UIEdgeInsets(lineSpacing + uIEdgeInsets.Top, uIEdgeInsets.Left,
return new UIEdgeInsets(top, left,
uIEdgeInsets.Bottom, uIEdgeInsets.Right);
}

Expand Down

0 comments on commit b987bc0

Please sign in to comment.