mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 20:54:51 +00:00
fix width calculation
This commit is contained in:
2 files changed
+3
-3
No files matched your search
@@ -76,7 +76,7 @@ struct EmojiPackDetailView: View {
|
|||||||
hoarder: hoarder,
|
hoarder: hoarder,
|
||||||
items: pack.items,
|
items: pack.items,
|
||||||
pack: pack,
|
pack: pack,
|
||||||
width: 80,
|
width: 75,
|
||||||
style: .full
|
style: .full
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ struct EmojiCollectionView: UIViewRepresentable {
|
|||||||
self.width = width
|
self.width = width
|
||||||
self.style = style
|
self.style = style
|
||||||
|
|
||||||
layout.itemSize = CGSize(width: width, height: width)
|
layout.minimumInteritemSpacing = 8
|
||||||
|
|
||||||
super.init(collectionViewLayout: layout)
|
super.init(collectionViewLayout: layout)
|
||||||
collectionView.contentInset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
|
collectionView.contentInset = UIEdgeInsets(top: 16, left: 16, bottom: 16, right: 16)
|
||||||
@@ -120,7 +120,7 @@ struct EmojiCollectionView: UIViewRepresentable {
|
|||||||
let totalWidth = collectionView.bounds.width
|
let totalWidth = collectionView.bounds.width
|
||||||
let availWidth = totalWidth-(collectionView.contentInset.left*2)
|
let availWidth = totalWidth-(collectionView.contentInset.left*2)
|
||||||
let cols = max(1, floor(availWidth/width))
|
let cols = max(1, floor(availWidth/width))
|
||||||
let totalSpacing = 1 * (cols - 1)
|
let totalSpacing = layout.minimumInteritemSpacing * (cols - 1)
|
||||||
let itemWidth = (availWidth-totalSpacing)/cols
|
let itemWidth = (availWidth-totalSpacing)/cols
|
||||||
let defaultSize = CGSize(width: itemWidth, height: itemWidth)
|
let defaultSize = CGSize(width: itemWidth, height: itemWidth)
|
||||||
|
|
||||||
|
|||||||