Function
Common
fun TrackpadInjectionScope.pan(offset: Offset)

Sends a pan gesture with the given total offset. The event will be sent starting at the current event time.

To send a pan gesture with a curve, use pan(curve, durationMillis, keyTimes).

Parameters

offset The amount of pan
Common
fun TrackpadInjectionScope.pan(
    curve: (timeMillis: Long) -> Offset,
    durationMillis: Long = 200,
    keyTimes: List<Long> = emptyList(),
)

Sends a pan gesture with the offsets in the panning coordinate space following the given curve. It is expected that the curve starts at Offset.Zero, as a pan gesture starts with no delta, and then move outward from the origin.

To send a pan with just a single amount, use pan(offset).

Parameters

curve The function that describes the gesture. The argument passed to the function is the time in milliseconds since the start of the swipe, and the return value is the location of the pan from the origin at that point in time.
durationMillis The duration of the gesture
keyTimes An optional list of timestamps in milliseconds at which a pan move event must be sampled

Code Examples

trackpadInputPan

fun trackpadInputPan() {
    composeTestRule.onNodeWithTag("verticalScrollable").performTrackpadInput {
        pan(Offset(0f, 100f))
    }
}