mirror of
https://github.com/neon443/StickerSlack.git
synced 2026-11-30 20:54:51 +00:00
tweak drag setup
This commit is contained in:
4 files changed
+17
-1
No files matched your search
@@ -16,7 +16,6 @@ extension EmojiCollectionView: UICollectionViewDragDelegate {
|
||||
at indexPath: IndexPath
|
||||
) -> [UIDragItem] {
|
||||
let emojiName = items[indexPath.row]
|
||||
guard let emoji = hoarder.trie.dict[emojiName] else { return [] }
|
||||
|
||||
let item = NSItemProvider(item: emojiName as NSSecureCoding, typeIdentifier: UTType.utf8PlainText.identifier)
|
||||
|
||||
|
||||
@@ -115,4 +115,19 @@ class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
|
||||
button.isUserInteractionEnabled = false
|
||||
edit = false
|
||||
}
|
||||
|
||||
override func dragStateDidChange(_ dragState: UICollectionViewCell.DragState) {
|
||||
self.transform = .identity
|
||||
|
||||
switch dragState {
|
||||
case .none:
|
||||
self.setEdit(to: edit, animated: false)
|
||||
case .lifting:
|
||||
button.alpha = 0
|
||||
case .dragging:
|
||||
button.alpha = 0
|
||||
@unknown default:
|
||||
fatalError()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ class DownloadedViewController: UINavigationController, UINavigationControllerDe
|
||||
style: .plainWithMenu
|
||||
)
|
||||
downloadedView.navigationItem.title = "Downloaded"
|
||||
downloadedView.collectionView.dragInteractionEnabled = false
|
||||
super.init(rootViewController: downloadedView)
|
||||
|
||||
refreshUI()
|
||||
|
||||
@@ -35,6 +35,7 @@ class SearchViewController: UINavigationController, UISearchControllerDelegate,
|
||||
width: 75,
|
||||
style: .plainWithLabel
|
||||
)
|
||||
(self.resultsView as! EmojiCollectionView).collectionView.dragInteractionEnabled = false
|
||||
} else {
|
||||
self.resultsView = EmojiTableView(hoarder: emojiHoarder, items: [])
|
||||
}
|
||||
|
||||