androidx.compose.foundation.gestures
Interfaces
PressGestureScope |
Receiver scope for detectTapGestures's |
Scrollable |
A an object representing something that can be scrolled. |
ScrollScope |
Scope used for suspending scroll blocks |
Classes
ScrollableController |
Controller to control the scrollable modifier with. |
ZoomableController |
Controller to control zoomable modifier with. |
Exceptions
GestureCancellationException |
A gesture was canceled and cannot continue, likely because another gesture has taken over the pointer input stream. |
Top-level functions summary
ScrollableController |
rememberScrollableController(interactionState: InteractionState? = null, consumeScrollDelta: (Float) -> Float) Create and remember ScrollableController for scrollable with default FlingConfig and AnimationClockObservable |
ZoomableController |
rememberZoomableController(onZoomDelta: (Float) -> Unit) Create and remember ZoomableController with default AnimationClockObservable. |
Extension functions summary
For AwaitPointerEventScope | |
suspend PointerInputChange? |
AwaitPointerEventScope.awaitDragOrCancellation(pointerId: PointerId) Reads pointer input events until a drag is detected or all pointers are up. |
suspend PointerInputChange |
AwaitPointerEventScope.awaitFirstDown(requireUnconsumed: Boolean = true) Reads events until the first down is received. |
suspend PointerInputChange? |
AwaitPointerEventScope.awaitHorizontalDragOrCancellation(pointerId: PointerId) Reads pointer input events until a horizontal drag is detected or all pointers are up. |
suspend PointerInputChange? |
AwaitPointerEventScope.awaitHorizontalTouchSlopOrCancellation(pointerId: PointerId, onTouchSlopReached: (change: PointerInputChange, overSlop: Float) -> Unit) Waits for horizontal drag motion to pass touch slop, using pointerId as the pointer to examine. |
suspend PointerInputChange? |
AwaitPointerEventScope.awaitTouchSlopOrCancellation(pointerId: PointerId, onTouchSlopReached: (change: PointerInputChange, overSlop: Offset) -> Unit) Waits for drag motion to pass touch slop, using pointerId as the pointer to examine. |
suspend PointerInputChange? |
AwaitPointerEventScope.awaitVerticalDragOrCancellation(pointerId: PointerId) Reads pointer input events until a vertical drag is detected or all pointers are up. |
suspend PointerInputChange? |
AwaitPointerEventScope.awaitVerticalTouchSlopOrCancellation(pointerId: PointerId, onTouchSlopReached: (change: PointerInputChange, overSlop: Float) -> Unit) Waits for vertical drag motion to pass touch slop, using pointerId as the pointer to examine. |
suspend Boolean |
AwaitPointerEventScope.drag(pointerId: PointerId, onDrag: (PointerInputChange) -> Unit) Reads position change events for pointerId and calls onDrag for every change in position. |
suspend Boolean |
AwaitPointerEventScope.horizontalDrag(pointerId: PointerId, onDrag: (PointerInputChange) -> Unit) Reads horizontal position change events for pointerId and calls onDrag for every change in position. |
suspend Boolean |
AwaitPointerEventScope.verticalDrag(pointerId: PointerId, onDrag: (PointerInputChange) -> Unit) Reads vertical position change events for pointerId and calls onDrag for every change in position. |
suspend PointerInputChange? |
Reads events until all pointers are up or the gesture was canceled. |
For PointerEvent | |
Offset |
PointerEvent.calculateCentroid(useCurrent: Boolean = true) Returns the centroid of all pointers that are down and were previously down. |
Float |
PointerEvent.calculateCentroidSize(useCurrent: Boolean = true) Returns the average distance from the centroid for all pointers that are currently and were previously down. |
Offset |
Returns the change in the centroid location between the previous and the current pointers that are down. |
Float |
Returns the rotation, in degrees, of the pointers between the PointerInputChange.previous and PointerInputChange.current states. |
Float |
Uses the change of the centroid size between the PointerInputChange.previous and PointerInputChange.current to determine how much zoom was intended. |
For PointerInputScope | |
suspend Unit |
PointerInputScope.detectDragGestures(onDragEnd: () -> Unit = { }, onDragCancel: () -> Unit = { }, onDrag: (change: PointerInputChange, dragAmount: Offset) -> Unit) Gesture detector that waits for pointer down and touch slop in any direction and then calls onDrag for each drag event. |
suspend Unit |
PointerInputScope.detectHorizontalDragGestures(onDragEnd: () -> Unit = { }, onDragCancel: () -> Unit = { }, onHorizontalDrag: (change: PointerInputChange, dragAmount: Float) -> Unit) Gesture detector that waits for pointer down and touch slop in the horizontal direction and then calls onHorizontalDrag for each horizontal drag event. |
suspend Unit |
PointerInputScope.detectMultitouchGestures(panZoomLock: Boolean = false, onGesture: (centroid: Offset, pan: Offset, zoom: Float, rotation: Float) -> Unit) A gesture detector for rotationg, panning, and zoom. |
suspend Unit |
PointerInputScope.detectTapGestures(onDoubleTap: () -> Unit = null, onLongPress: () -> Unit = null, onPress: suspend PressGestureScope.( |