Drag Experimental
Enables transferring data between and within applications per drag and drop.
modifier Drag
import { Drag, Text } from ui
export var main = Text("Drag Me") with {
Drag(
start: fun (event: DragEvent) {
event.set_data("Hello, from Komplete UI", for_type: "text/plain")
}
)
}
Constructor
(start:complete:minimum_distance:preview)
start: (DragEvent) -> ()
Called when the drag starts and allows to set the data to be transferred.
See DragEvent.
complete: () -> ()
Called when the drag has finished.
minimum_distance: Float = 10
The minimum distance the cursor has to move after the tap down before the gesture starts responding.
This is important if you want to combine both
TapGesture
andDrag
on the same component.
preview: Template() = template()
The preview displayed at the cursor during the drag operation.
If the template is empty the preview is based on the OS and the data transferred.
Layout Behavior
None.
DragEvent
class DragEvent
Methods
set_data(_ data: String, for_type mime_type: String)
Sets data for a given MIME type.
It is possible to set multiple data entries for different types in order to support multiple formats, which the target can select from.
See this article for more information on MIME types.