From 3d250fddcc2c6db959b6949d684ea27693475106 Mon Sep 17 00:00:00 2001 From: preble Date: Tue, 2 Nov 2010 15:19:53 -0400 Subject: [PATCH] Minor drag-n-drop improvements. --- Classes/IJInventoryView.m | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Classes/IJInventoryView.m b/Classes/IJInventoryView.m index ef9d4a7..a91cbc6 100644 --- a/Classes/IJInventoryView.m +++ b/Classes/IJInventoryView.m @@ -250,7 +250,10 @@ const static CGFloat cellOffset = 40; - (NSDragOperation)draggingSourceOperationMaskForLocal:(BOOL)isLocal { - return NSDragOperationEvery; + if (isLocal) + return NSDragOperationEvery; + else + return NSDragOperationDelete; } //- (void)draggedImage:(NSImage *)image beganAt:(NSPoint)screenPoint //{ @@ -260,9 +263,13 @@ const static CGFloat cellOffset = 40; { NSLog(@"%s operation=%d", __PRETTY_FUNCTION__, operation); - if (operation == NSDragOperationMove) + if (operation == NSDragOperationNone) { - // + // If the mouse has stopped outside of our bounds, we consider the item to have been removed; show an animation: + if (!NSMouseInRect([[self window] convertScreenToBase:screenPoint], [self bounds], NO)) + { + NSShowAnimationEffect(NSAnimationEffectDisappearingItemDefault, [NSEvent mouseLocation], NSZeroSize, nil, nil, nil); + } } } //- (void)draggedImage:(NSImage *)image movedTo:(NSPoint)screenPoint