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
|
at indexPath: IndexPath
|
||||||
) -> [UIDragItem] {
|
) -> [UIDragItem] {
|
||||||
let emojiName = items[indexPath.row]
|
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)
|
let item = NSItemProvider(item: emojiName as NSSecureCoding, typeIdentifier: UTType.utf8PlainText.identifier)
|
||||||
|
|
||||||
|
|||||||
@@ -115,4 +115,19 @@ class EmojiCollectionViewCell: PlainEmojiCollectionViewCell {
|
|||||||
button.isUserInteractionEnabled = false
|
button.isUserInteractionEnabled = false
|
||||||
edit = 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
|
style: .plainWithMenu
|
||||||
)
|
)
|
||||||
downloadedView.navigationItem.title = "Downloaded"
|
downloadedView.navigationItem.title = "Downloaded"
|
||||||
|
downloadedView.collectionView.dragInteractionEnabled = false
|
||||||
super.init(rootViewController: downloadedView)
|
super.init(rootViewController: downloadedView)
|
||||||
|
|
||||||
refreshUI()
|
refreshUI()
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ class SearchViewController: UINavigationController, UISearchControllerDelegate,
|
|||||||
width: 75,
|
width: 75,
|
||||||
style: .plainWithLabel
|
style: .plainWithLabel
|
||||||
)
|
)
|
||||||
|
(self.resultsView as! EmojiCollectionView).collectionView.dragInteractionEnabled = false
|
||||||
} else {
|
} else {
|
||||||
self.resultsView = EmojiTableView(hoarder: emojiHoarder, items: [])
|
self.resultsView = EmojiTableView(hoarder: emojiHoarder, items: [])
|
||||||
}
|
}
|
||||||
|
|||||||