fix size calculations

This commit is contained in:
Nihaal Sharma committed 2026-05-08 19:13:17 +01:00
1 parent 90f277282e
commit cec8fe74aa
2 files changed
+2 -4

No files matched your search

@@ -108,7 +108,6 @@ class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
guard label.text != nil else { return layoutAttributes }
let labelHeight = label.sizeThatFits(CGSize(width: layoutAttributes.size.width, height: .infinity)).height
layoutAttributes.size = CGSize(width: layoutAttributes.size.width, height: labelHeight+4+view.frame.height)
print(label.text!, layoutAttributes.size)
return layoutAttributes
}
@@ -79,10 +79,9 @@ class PlainEmojiCollectionViewCell: UICollectionViewCell {
} else {
cols = max(1, floor(availWidth/width))
}
let totalSpacing = (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumInteritemSpacing ?? 0 * (cols-1)
let totalSpacing = ((collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumInteritemSpacing ?? 0) * (cols-1)
let itemWidth = (availWidth-totalSpacing)/cols
layoutAttributes.size = CGSize(width: itemWidth, height: itemWidth)
print(layoutAttributes.size)
layoutAttributes.size = CGSize(width: itemWidth.rounded(.down), height: itemWidth.rounded(.down))
return layoutAttributes
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.