fixed bug for ButtonGroupPositionLayout - take the min between collectionViewWidth and button width

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2024-02-13 16:45:17 -06:00
parent ba63562445
commit ba33824576

View File

@ -229,7 +229,7 @@ class ButtonGroupPositionLayout: UICollectionViewLayout {
// create the custom layout attribute
let attributes = ButtonLayoutAttributes(spacing: itemSpacing, button: itemButtonBase, forCellWith: indexPath)
attributes.frame = CGRect(x: 0, y: 0, width: itemSize.width, height: itemSize.height)
attributes.frame = CGRect(x: 0, y: 0, width: min(itemSize.width, collectionViewWidth), height: itemSize.height)
// add it to the array
rows.last?.add(attribute: attributes)