DragAndDropModifierNode

Added in 1.6.0
Deprecated in 1.8.0-alpha07

A Modifier.Node providing low level access to platform drag and drop operations. In most cases, you will want to delegate to the DragAndDropModifierNode returned by the eponymous factory method.

Summary

Public functions

Boolean

The entry point to register interest in a drag and drop session for receiving data.

Cmn
Unit
drag(
    transferData: DragAndDropTransferData,
    decorationSize: Size,
    drawDragDecoration: DrawScope.() -> Unit
)

This function is deprecated. Use DragAndDropSourceModifierNode.requestDragAndDropTransfer instead

Cmn

Inherited functions

From androidx.compose.ui.node.DelegatableNode
open Unit

Invoked when the density changes for this node.

Cmn
open Unit

Invoked when the layout direction changes for this node.

Cmn
From androidx.compose.ui.draganddrop.DragAndDropTarget
open Unit

An event in the current drag and drop session has changed within this DragAndDropTarget bounds.

Cmn
Boolean

An item has been dropped inside this DragAndDropTarget.

Cmn
open Unit

The drag and drop session has been completed.

Cmn
open Unit

An item being dropped has entered into the bounds of this DragAndDropTarget.

Cmn
open Unit

An item being dropped has moved outside the bounds of this DragAndDropTarget.

Cmn
open Unit

An item being dropped has moved within the bounds of this DragAndDropTarget.

Cmn
open Unit

A drag and drop session has just been started and this DragAndDropTarget is eligible to receive it.

Cmn

Inherited properties

From androidx.compose.ui.node.DelegatableNode
Modifier.Node

A reference of the Modifier.Node that holds this node's position in the node hierarchy.

Cmn

Public functions

acceptDragAndDropTransfer

fun acceptDragAndDropTransfer(startEvent: DragAndDropEvent): Boolean

The entry point to register interest in a drag and drop session for receiving data.

Returns
Boolean

true to indicate interest in the contents of a drag and drop session, false indicates no interest. If false is returned, this Modifier will not receive any DragAndDropTarget events.

All DragAndDropModifierNode instances in the hierarchy will be given an opportunity to participate in a drag and drop session via this method.

drag

fun drag(
    transferData: DragAndDropTransferData,
    decorationSize: Size,
    drawDragDecoration: DrawScope.() -> Unit
): Unit

Begins a drag and drop session for transferring data.

Parameters
transferData: DragAndDropTransferData

the data to be transferred after successful completion of the drag and drop gesture.

decorationSize: Size

the size of the drag decoration to be drawn.

drawDragDecoration: DrawScope.() -> Unit

provides the visual representation of the item dragged during the drag and drop gesture.