Helper class for drag and drop support that is used for the source of drag and drop operations.
Inheritance Hierarchy
DragSource
Type Details
- yFiles module
- view
See Also
Constructors
Initializes a new instance of the DragSource class, optionally setting the source property to the given element.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- source - HTMLElement | SVGElement
- The source that is considered the origin of the drag. Will be set to source.
Properties
Gets or sets the DragDropEffects that will be used for the drag operation.
Gets or sets the data that will be used for the drag operation.
Remarks
If this data is not a DragDropItem, the expected format of the automatic drag operation will be
code
.Property Value
The drag data, the default value is
null
.See Also
Methods
Cleans up by removing the association with the source element.
Raises the query-continue-drag event.
Remarks
If the event is not handled, a default logic will be applied: the drag operation is canceled if the mouse button that started the drag is released or escape has been pressed, otherwise the drag will be continued.
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- evt - QueryContinueDragEventArgs
- The QueryContinueDragEventArgs instance containing the event data.
startDrag
(dragData: DragDropItem, dragDropEffects?: DragDropEffects, useCssCursors?: boolean, dragPreview?: HTMLElement | SVGElement) : Promise<boolean>Initiates a new drag operation using the provided drag data and effects.
Remarks
If
useCssCursors
is enabled, the following CSS classes are assigned to elements hovered during a drag operation, depending on the allowed drag-drop operations for these elements:yfiles-cursor-dragdrop-move
yfiles-cursor-dragdrop-link
yfiles-cursor-dragdrop-all
yfiles-cursor-dragdrop-no-drop
Parameters
options - Object
A map of options to pass to the method.
A map of options to pass to the method.
- dragData - DragDropItem
- The data to use for the drag.
- dragDropEffects - DragDropEffects
- The allowed effects.
- useCssCursors - boolean
- Whether to adjust the classes of elements being hovered over during the drag. The default is
true
. - dragPreview - HTMLElement | SVGElement
- Optional element that should be shown during dragging, e.g. outside of the GraphComponent. Note that this feature requires support for CSS pointer-events and should not be used in browsers that do not support it.
Returns
Events
Occurs when the state of the DragDropKeyStates or the DropTarget has changed to query the source whether the drag operation should be continued.