A few fixes to drag and drop.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I
2009-11-12 04:15:43 -08:00
parent 61c0d33b4d
commit c3ac3ddd3f
2 changed files with 18 additions and 5 deletions
+4 -4
View File
@@ -251,7 +251,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
return dragOperation;
}
- (void)draggingEndedInPlatformWindow:(CPPlatformWindow)aPlatformWindow globalLocation:(CGPoint)aLocation
- (void)draggingEndedInPlatformWindow:(CPPlatformWindow)aPlatformWindow globalLocation:(CGPoint)aLocation operation:(CPDragOperation)anOperation
{
[_draggedView removeFromSuperview];
@@ -259,10 +259,10 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
[_draggedWindow orderOut:self];
if (_implementedDraggingSourceMethods & CPDraggingSource_draggedImage_endAt_operation_)
[_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:NO];
[_draggingSource draggedImage:[_draggedView image] endedAt:aLocation operation:anOperation];
else if (_implementedDraggingSourceMethods & CPDraggingSource_draggedView_endedAt_operation_)
[_draggingSource draggedView:_draggedView endedAt:aLocation operation:NO];
[_draggingSource draggedView:_draggedView endedAt:aLocation operation:anOperation];
_isDragging = NO;
}
@@ -386,7 +386,7 @@ var CPDraggingSource_draggedImage_movedTo_ = 1 << 0,
if (type === CPLeftMouseUp)
{
[self performDragOperationInPlatformWindow:platformWindow];
[self draggingEndedInPlatformWindow:platformWindow globalLocation:platformWindowLocation];
[self draggingEndedInPlatformWindow:platformWindow globalLocation:platformWindowLocation operation:CPDragOperationNone];
// Stop tracking events.
return;
+14 -1
View File
@@ -411,7 +411,20 @@ var supportsNativeDragAndDrop = [CPPlatform supportsDragAndDrop];
}
else if (type === "dragend")
[dragServer draggingEndedInPlatformWindow:self globalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY)];
{
var dropEffect = aDOMEvent.dataTransfer.dropEffect;
if (dropEffect === "move")
dragOperation = CPDragOperationMove;
else if (dropEffect === "copy")
dragOperation = CPDragOperationCopy;
else if (dropEffect === "link")
dragOperation = CPDragOperationLink;
else
dragOperation = CPDragOperationNone;
[dragServer draggingEndedInPlatformWindow:self globalLocation:[CPPlatform isBrowser] ? location : _CGPointMake(aDOMEvent.screenX, aDOMEvent.screenY) operation:dragOperation];
}
else //if (type === "drop")
{