forked from shadowfacts/Tusker
Improve expanded emoji picker layout on iPad
This commit is contained in:
parent
62c7a30bbc
commit
bc9a700383
|
@ -37,7 +37,10 @@ class EmojiPickerCollectionViewController: UICollectionViewController {
|
||||||
init(mastodonController: MastodonController) {
|
init(mastodonController: MastodonController) {
|
||||||
self.mastodonController = mastodonController
|
self.mastodonController = mastodonController
|
||||||
|
|
||||||
let itemWidth = NSCollectionLayoutDimension.fractionalWidth(1.0 / 10)
|
let layout = UICollectionViewCompositionalLayout { sectionIndex, environment in
|
||||||
|
let hSizeClass = environment.traitCollection.horizontalSizeClass
|
||||||
|
|
||||||
|
let itemWidth = NSCollectionLayoutDimension.fractionalWidth(1.0 / (hSizeClass == .compact ? 10 : 20))
|
||||||
let itemSize = NSCollectionLayoutSize(widthDimension: itemWidth, heightDimension: itemWidth)
|
let itemSize = NSCollectionLayoutSize(widthDimension: itemWidth, heightDimension: itemWidth)
|
||||||
let item = NSCollectionLayoutItem(layoutSize: itemSize)
|
let item = NSCollectionLayoutItem(layoutSize: itemSize)
|
||||||
|
|
||||||
|
@ -47,8 +50,8 @@ class EmojiPickerCollectionViewController: UICollectionViewController {
|
||||||
|
|
||||||
let section = NSCollectionLayoutSection(group: group)
|
let section = NSCollectionLayoutSection(group: group)
|
||||||
section.interGroupSpacing = 4
|
section.interGroupSpacing = 4
|
||||||
|
return section
|
||||||
let layout = UICollectionViewCompositionalLayout(section: section)
|
}
|
||||||
|
|
||||||
super.init(collectionViewLayout: layout)
|
super.init(collectionViewLayout: layout)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue