Private _currentPrivate _currentPrivate _disposedPrivate _dropPrivate _overridePrivate _promisePrivate _resolvePrivate _scrollReadonly documentThe target document for dragging events.
Readonly dragThe drag image element for the drag object.
Readonly mimeThe mime data for the drag object.
Readonly proposedThe proposed drop action for the drag object.
Readonly sourceGet the drag source for the drag object.
Readonly supportedThe supported drop actions for the drag object.
Test whether the drag object is disposed.
Private _addPrivate _attachPrivate _detachPrivate _evtPrivate _evtPrivate _evtPrivate _finalizeFinalize the drag operation and resolve the drag promise.
Private _onPrivate _removePrivate _setSet the internal drop action state and update the drag cursor.
Private _updatePrivate _updateDispose of the resources held by the drag object.
This will cancel the drag operation if it is active.
Handle the DOM events for the drag operation.
The DOM event sent to the drag object.
This method implements the DOM EventListener interface and is
called in response to events on the document. It should not be
called directly by user code.
Protected moveStart the drag operation at the specified client position.
A promise which resolves to the result of the drag.
If the drag has already been started, the promise created by the
first call to start is returned.
If the drag operation has ended, or if the drag object has been
disposed, the returned promise will resolve to 'none'.
The drag object will be automatically disposed when drag operation
completes. This means Drag objects are for single-use only.
This method assumes the left mouse button is already held down.
The client X position for the drag start.
The client Y position for the drag start.
Generated using TypeDoc
An object which manages a drag-drop operation.
A drag object dispatches four different events to drop targets:
'lm-dragenter'- Dispatched when the mouse enters the target element. This event must be canceled in order to receive any of the other events.'lm-dragover'- Dispatched when the mouse moves over the drop target. It must cancel the event and set thedropActionto one of the supported actions in order to receive drop events.'lm-dragleave'- Dispatched when the mouse leaves the target element. This includes moving the mouse into child elements.'lm-drop'- Dispatched when the mouse is released over the target element when the target indicates an appropriate drop action. If the event is canceled, the indicated drop action is returned to the initiator through the resolved promise.A drag operation can be terminated at any time by pressing
Escapeor by disposing the drag object.A drag object has the ability to automatically scroll a scrollable element when the mouse is hovered near one of its edges. To enable this, add the
data-lm-dragscrollattribute to any element which the drag object should consider for scrolling.Notes
This class is designed to be used when dragging and dropping custom data within a single application. It is not a replacement for the native drag-drop API. Instead, it provides an API which allows drag operations to be initiated programmatically and enables the transfer of arbitrary non-string objects; features which are not possible with the native drag-drop API.