C

DragSource

Helper class for drag and drop support that is used for the source of drag and drop operations.
Inheritance Hierarchy

Members

Show:

Constructors

Initializes a new instance of the DragSource class, optionally setting the source property to the given element.

Parameters

source?: any
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.
The effects, the default value is ALL.
conversionfinal

See Also

API
item
Gets or sets the data that will be used for the drag operation.
If this data is not a DragDropItem, the expected format of the automatic drag operation will be code.
final

Property Value

The drag data, the default value is null.

See Also

API
effectAllowed
Gets or sets the source element from which drags can originate.
readonlyfinal

Methods

Cleans up by removing the association with the source element.
final
Raises the query-continue-drag event.
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.
protected

Parameters

evt: QueryContinueDragEventArgs
The QueryContinueDragEventArgs instance containing the event data.
Initiates a new drag operation using the provided drag data and effects.
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

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?: any
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.

Return Value

Promise<boolean>
A Promise<TResult> that resolves when the drag operation is done. It resolves to true on a successful drop and to false if the drag operation was canceled or otherwise unsuccessful.

Events

Occurs when the state of the DragDropKeyStates or the DropTarget has changed to query the source whether the drag operation should be continued.
Handlers should adjust the handled and action properties accordingly.
action: DragAction
writable
Gets or sets the action.
dropTarget: DropTarget
Gets the current dropTarget or null of there is no drop target.
escapePressed: boolean
Gets a value indicating whether the escape key had been pressed.
handled: boolean
writable
Gets or sets a value indicating whether this QueryContinueDragEventArgs is handled.
keyStates: DragDropKeyStates
Gets the current state of the keys.