mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-09-14 22:51:28 +00:00
A few fixes to drag and drop.
Reviewed by me.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user