---
title: "dragAndDrop"
description: "Use [button] to drag and drop something from [start] to [end] in [durationMillis] milliseconds.
The trackpad position is [updated][TrackpadInjectionScope.updatePointerTo] to the start position
before starting the gesture. The positions defined by the [start] and [end] are in the node's
local coordinate system, where (0, 0) is the top left corner of the node."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun TrackpadInjectionScope.dragAndDrop(
    start: Offset,
    end: Offset,
    button: TrackpadButton = TrackpadButton.Primary,
    durationMillis: Long = DefaultTrackpadGestureDurationMillis,
)
```


Use `button` to drag and drop something from `start` to `end` in `durationMillis` milliseconds.
The trackpad position is `updated` to the start position
before starting the gesture. The positions defined by the `start` and `end` are in the node's
local coordinate system, where (0, 0) is the top left corner of the node.

#### Parameters

| | |
| --- | --- |
| start | The position where to press the primary button and initiate the drag, in the node's local coordinate system. |
| end | The position where to release the primary button and end the drag, in the node's local coordinate system. |
| button | The button to drag with. Uses the `primary` by default. |
| durationMillis | The duration of the gesture. By default 300 milliseconds. |




<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun MouseInjectionScope.dragAndDrop(
    start: Offset,
    end: Offset,
    button: MouseButton = MouseButton.Primary,
    durationMillis: Long = DefaultMouseGestureDurationMillis,
)
```


Use `button` to drag and drop something from `start` to `end` in `durationMillis` milliseconds.
The mouse position is `updated` to the start position before
starting the gesture. The positions defined by the `start` and `end` are in the node's local
coordinate system, where (0, 0) is the top left corner of the node.

#### Parameters

| | |
| --- | --- |
| start | The position where to press the primary mouse button and initiate the drag, in the node's local coordinate system. |
| end | The position where to release the primary mouse button and end the drag, in the node's local coordinate system. |
| button | The button to drag with. Uses the `primary` by default. |
| durationMillis | The duration of the gesture. By default 300 milliseconds. |




