I understand how to get drag and drop working for NSCollectionView
but I can't seem to stop it 'lifting' the items off the view.
My current solution is to not implement
func collectionView(_ collectionView: NSCollectionView, pasteboardWriterForItemAt indexPath: IndexPath) -> NSPasteboardWriting?
from NSCollectionViewDelegate
to ensure that
func collectionView(_ collectionView: NSCollectionView, draggingImageForItemsAt indexPaths: Set<IndexPath>, with event: NSEvent, offset dragImageOffset: NSPointPointer) -> NSImage
IS called, where I can provide my own dragging images. However, these do not flock or provide the icon showing how many items are being dragged.
The problem is that when I implement the former method, nothing I seem to do (including overriding the NSCollectionViewItem's draggingImageComponents
) seems to prevent the drag 'lifting' the item off the collection view, leaving behind an empty space.
Dragging images in Photos.app and files in Finder.app (icon view) do not lift the item so hopefully this is possible.