Google is committed to advancing racial equity for Black communities. See how.

androidx.compose.ui.gesture

Interfaces

DragObserver

Defines the callbacks associated with dragging.

LongPressDragObserver

RawScaleObserver

Observes various events sent by rawScaleGestureFilter.

ScaleObserver

Observes various events sent by scaleGestureFilter.

ScrollCallback

Defines the callbacks associated with scrolling.

Enums

Direction

Top-level properties summary

Duration

The minimum time from the end of the first tap to the start of the second tap in a double-tap gesture.

Dp

Distance between the initial position of the first touch and the start position of a potential second touch for the second touch to be considered the second touch of a double-tap gesture.

Duration

The maximum time from the start of the first tap to the start of the second tap in a double-tap gesture.

Dp

The maximum distance that the first touch in a double-tap gesture can travel before deciding that it is not part of a double-tap gesture.

Dp

Maximum distance between the down and up pointers for a tap.

Duration

Maximum length of time between a tap down and a tap up for the gesture to be considered a tap.

Duration

The maximum time from the start of the first tap to the start of the second tap in a jump-tap gesture.

Duration

The time before a long press gesture attempts to win.

Dp

Drag gesture fling velocities are clipped to this value.

Dp

The minimum velocity for a touch to consider that touch to trigger a fling gesture.

Dp

The distance a touch has to travel for the framework to be confident that the gesture is a paging gesture.

Dp

The distance a touch has to travel for the framework to be confident that the gesture is a panning gesture.

Duration

The time that must elapse before a tap gesture sends onTapDown, if there's any doubt that the gesture is a tap.

Dp

The absolute cumulative average change in distance of all pointers from the average pointer over time that must be surpassed to indicate the user is trying to scale.

Dp

The distance a touch has to travel for the framework to be confident that the gesture is a scroll gesture, or, inversely, the maximum distance that a touch can travel before the framework becomes confident that it is not a tap.

Dp

The margin around a dialog, popup menu, or other window-like composable inside which we do not consider a tap to dismiss the composable.

Duration

The time for which zoom controls (e.

Extension functions summary

For kotlin.collections.List
Boolean
List<PointerInputChange>.anyPointersInBounds(bounds: IntSize)

Utility method that determines if any pointers are currently in bounds.

For Modifier
Modifier

Responds to pointers going down and up (tap) and then down and up again (another tap) with minimal gap of time between the first up and the second down.

Modifier
Modifier.dragGestureFilter(dragObserver: DragObserver, canDrag: (Direction) -> Boolean = null, startDragImmediately: Boolean = false)

This gesture detector detects dragging in any direction.

Modifier
Modifier.dragSlopExceededGestureFilter(onDragSlopExceeded: () -> Unit, canDrag: (Direction) -> Boolean = null, orientation: Orientation? = null)

This gesture filter detects when the average distance change of all pointers surpasses the touch slop.

Modifier

This gesture detector detects dragging in any direction, but only after a long press has first occurred.

Modifier

Responds to a pointer being "down" for an extended amount of time.

Modifier
Modifier.pressIndicatorGestureFilter(onStart: (Offset) -> Unit = null, onStop: () -> Unit = null, onCancel: () -> Unit = null, enabled: Boolean = true)

This gesture detector has callbacks for when a press gesture starts and ends for the purposes of displaying visual feedback for those two states.

Modifier
Modifier.rawDragGestureFilter(dragObserver: DragObserver, canStartDragging: () -> Boolean = null, orientation: Orientation? = null)

This gesture detector detects dragging in any direction.

Modifier
Modifier.rawPressStartGestureFilter(onPressStart: (Offset) -> Unit, enabled: Boolean = false, executionPass: PointerEventPass = PointerEventPass.Main)

Reacts if the first pointer input change it sees is an unconsumed down change, and if it reacts, consumes all further down changes.

Modifier
Modifier.rawScaleGestureFilter(scaleObserver: RawScaleObserver, canStartScaling: () -> Boolean = null)

This gesture detector detects scaling.

Modifier

This gesture detector detects scaling.

Modifier
Modifier.scaleSlopExceededGestureFilter(onScaleSlopExceeded: () -> Unit)

This gesture detector detects when a user's pointer input is intended to include scaling.

Modifier
Modifier.scrollGestureFilter(scrollCallback: ScrollCallback, orientation: Orientation, canDrag: (Direction) -> Boolean = null, startDragImmediately: Boolean = false)

Like Modifier.dragGestureFilter, this gesture filter will detect dragging, but will only do so along the given orientation.

Modifier

This gesture detector fires a callback when a traditional press is being released.

Top-level properties

DoubleTapMinTime

val DoubleTapMinTime: Duration

The minimum time from the end of the first tap to the start of the second tap in a double-tap gesture. (Currently not honored by the DoubleTapGestureFilter.)

DoubleTapSlop

val DoubleTapSlop: Dp

Distance between the initial position of the first touch and the start position of a potential second touch for the second touch to be considered the second touch of a double-tap gesture.

DoubleTapTimeout

val DoubleTapTimeout: Duration

The maximum time from the start of the first tap to the start of the second tap in a double-tap gesture.

DoubleTapTouchSlop

val DoubleTapTouchSlop: Dp

The maximum distance that the first touch in a double-tap gesture can travel before deciding that it is not part of a double-tap gesture. DoubleTapGestureFilter also restricts the second touch to this distance.

HoverTapSlop

val HoverTapSlop: Dp

Maximum distance between the down and up pointers for a tap. (Currently not honored by the TapGestureFilter.

HoverTapTimeout

val HoverTapTimeout: Duration

Maximum length of time between a tap down and a tap up for the gesture to be considered a tap. (Currently not honored by the TapGestureFilter.)

JumpTapTimeout

val JumpTapTimeout: Duration

The maximum time from the start of the first tap to the start of the second tap in a jump-tap gesture.

LongPressTimeout

val LongPressTimeout: Duration
<