Protocol: SC.DragSource

If you implement the SC.DragSource protocol on your drag's source, it will receive a series of callbacks throughout the course of the drag, and be consulted about what operations to allow on a particular candidate drop target. All methods are optional.

(Note that when you initiate a drag you must also provide an object implementing SC.DragDataSource, which includes some required methods. A single object may serve as both the drag's source and its data source.)

Defined in: drag_source.js

Field Summary

Class Methods

Field Detail

SC.DragSource.ignoreModifierKeysWhileDragging Boolean

If this property is set to NO or is not implemented, then the user may modify the drag operation by changing the modifier keys they have pressed.

Default value:
NO

Class Method Detail

dragDidBegin(drag, loc)

This method is called when the drag begins. You can use this to do any visual highlighting to indicate that the receiver is the source of the drag.

Parameters:
drag SC.Drag
The Drag instance managing this drag.
loc Point
The point in *window* coordinates where the drag began. You can use convertOffsetFromView() to convert this to local coordinates.
dragDidCancel(drag, loc, op)

This method is called if the drag ends without being handled, or if a drop target handles it but returns SC.DRAG_NONE.

Parameters:
drag SC.Drag
The drag instance managing the drag.
loc Point
The point in WINDOW coordinates where the drag ended.
op DragOp
Provided for consistency. Always SC.DRAG_NONE.
dragDidEnd(drag, loc, op)

This method is called when the drag ended, regardless of whether it succeeded or not. You can use this to do any cleanup.

Parameters:
drag SC.Drag
The drag instance managing the drag.
loc Point
The point in WINDOW coordinates where the drag ended.
op DragOp
The drag operation that was performed. One of SC.DRAG_COPY, SC.DRAG_MOVE, SC.DRAG_LINK, or SC.DRAG_NONE.
dragDidMove(drag, loc)

This method is called whenever the drag image is moved. This is similar to the dragUpdated() method called on drop targets.

Parameters:
drag SC.Drag
The Drag instance managing this drag.
loc Point
The point in *window* coordinates where the drag mouse is. You can use convertOffsetFromView() to convert this to local coordinates.
dragDidSucceed(drag, loc, op)

This method is called if the drag ends and is successfully handled by a drop target (i.e. the drop target returns any operation other than SC.DRAG_NONE).

Parameters:
drag SC.Drag
The drag instance managing the drag.
loc Point
The point in WINDOW coordinates where the drag ended.
op DragOp
The drag operation that was performed. One of SC.DRAG_COPY, SC.DRAG_MOVE, or SC.DRAG_LINK.
dragSlideBackDidEnd(drag)

If a drag is canceled or not handled, and has its slideBack property set to YES, then the drag's ghost view will slide back to its initial location. dragDidEnd is called immediately upon mouseUp; dragSlideBackDidEnd is called after the slide-back animation completes.

Parameters:
drag SC.Drag
The drag instance managing the drag.
dragSourceOperationMaskFor(drag, dropTarget)

Return a bitwise OR'd mask of the drag operations allowed on the specified target. If you don't care about the target, just return a constant value. If a drag's source does not implement this method, it will assume that any drag operation (SC.DRAG_ANY) is allowed.

Parameters:
drag SC.Drag
The SC.Drag instance managing this drag.
dropTarget SC.View
The proposed target of the drop.
Documentation generated by JsDoc Toolkit 2.4.0 on Fri Nov 28 2014 17:58:15 GMT+0100 (CET)