click

Function

Common
fun MouseInjectionScope.click(
    position: Offset = center,
    button: MouseButton = MouseButton.Primary,
)

Use button to click on position, or on the current mouse position if position is unspecified. The position is in the node's local coordinate system, where (0, 0) is the top left corner of the node. The default button is the primary button. There is a small 60ms delay between the press and release events to have a realistic simulation.

Parameters

positionThe position where to click, in the node's local coordinate system. If omitted, the center of the node will be used. If unspecified, clicks on the current mouse position.
buttonThe button to click with. Uses the primary by default.
Common

Deprecated Replaced by TouchInjectionScope. Use performTouchInput instead of performGesture

fun GestureScope.click(position: Offset = center) = delegateScope.touch { click(position) }

Performs a click gesture at the given position on the associated node, or in the center if the position is omitted. The position is in the node's local coordinate system, where (0, 0) is the top left corner of the node. The default position is the center of the node.

Parameters

positionThe position where to click, in the node's local coordinate system. If omitted, the center position will be used.
Common
fun TouchInjectionScope.click(position: Offset = center)

Performs a click gesture (aka a tap) on the associated node.

The click is done at the given position, or in the center if the position is omitted. The position is in the node's local coordinate system, where (0, 0) is the top left corner of the node.

Parameters

positionThe position where to click, in the node's local coordinate system. If omitted, the center of the node will be used.