I have a collection view that I've subclassed that allows me to reorder the collection view items via drag and drop. My drag code that sets up the pasterboard is currently in mouseDragged:
- (void)mouseDragged:(NSEvent *)aEvent {
if(!dragInProgress) {
dragInProgress = YES;
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
... setup pboard, declare types, setData ...
... create drag image ....
[self dragImage: image
at: position
offset: NSZeroSize
event: aEvent
pasteboard: pboard
source: self
slideBack: YES];
}
}
I would like to only initiate a drag if the user has dragged for a certain length, so they don't initiate a drag accidentally. Is there a setting to do this in Cocoa, or do I need to move this code to mouseMoved: and check the distance between where the drag started and where the mouse is currently?