PointerInputChange

data class PointerInputChange
kotlin.Any
   ↳ androidx.ui.core.PointerInputChange

Describes a change that has occurred for a particular pointer, as well as how much of the change has been consumed (meaning, used by a node in the UI).

The current data always represents the position of the pointer relative to the element that this PointerInputChange is being dispatched to.

The previous data, however, represents the position of the pointer offset to the current position of the pointer relative to the screen.

This means that current and previous can always be used to understand how much a pointer has moved relative to an element, even if that element is moving along with the changes to the pointer. For example, if a pointer touches a 1x1 pixel box in the middle, current will report a position of (0, 0) when dispatched to it. If the next event moves x position 5 pixels, current will report (5, 0) and previous will report (0, 0). If the box moves all 5 pixels, and the next event represents the pointer moving along the x axis for 5 more pixels, current will again report (5, 0) and previous will report (0, 0).

Summary

Public constructors

<init>(id: PointerId, current: PointerInputData, previous: PointerInputData, consumed: ConsumedData)

Describes a change that has occurred for a particular pointer, as well as how much of the change has been consumed (meaning, used by a node in the UI).

Extension functions

From androidx.ui.core
Boolean

True if any aspect of this PointerInputChange has been consumed.

Boolean

True if any of this PointerInputChange's movement has been consumed.

Boolean

True if this PointerInputChange represents a pointer coming in contact with the screen and that change has not been consumed.

Boolean

True if this PointerInputChange represents a pointer coming in contact with the screen, whether or not that change has been consumed.

Boolean

True if this PointerInputChange represents a pointer breaking contact with the screen and that change has not been consumed.

Boolean

True if this PointerInputChange represents a pointer breaking contact with the screen, whether or not that change has been consumed.

PointerInputChange

Consumes all changes associated with the PointerInputChange

PointerInputChange

Consume the up or down change of this PointerInputChange if there is an up or down change to consume.

PointerInputChange
PointerInputChange.consumePositionChange(consumedDx: Px, consumedDy: Px)

Consumes some portion of the position change of this PointerInputChange.

PxPosition

The distance that the pointer has moved on the screen minus any distance that has been consumed.

PxPosition

The distance that the pointer has moved on the screen, ignoring any distance that may have been consumed.

Boolean

True if this PointerInputChange represents a pointer moving on the screen and some of that movement has not been consumed.

Boolean

True if this PointerInputChange represents a pointer moving on the screen ignoring how much of that movement may have been consumed.

From androidx.ui.testutils
PointerInputChange
PointerInputChange.consume(dx: Float = 0f, dy: Float = 0f, downChange: Boolean = false)

PointerInputChange
PointerInputChange.moveBy(duration: Duration, dx: Float = 0f, dy: Float = 0f)

PointerInputChange
PointerInputChange.moveTo(duration: Duration, x: Float = 0f, y: Float = 0f)

PointerInputChange

Properties

ConsumedData

Which aspects of this change have been consumed.

PointerInputData

The PointerInputData that represents the current state of this pointer.

PointerId

The unique id of the pointer associated with this PointerInputChange.

PointerInputData

The PointerInputData that represents the previous state of this pointer.

Public constructors

<init>

PointerInputChange(
    id: PointerId,
    current: PointerInputData,
    previous: PointerInputData,
    consumed: ConsumedData)

Describes a change that has occurred for a particular pointer, as well as how much of the change has been consumed (meaning, used by a node in the UI).

The current data always represents the position of the pointer relative to the element that this PointerInputChange is being dispatched to.

The previous data, however, represents the position of the pointer offset to the current position of the pointer relative to the screen.

This means that current and previous can always be used to understand how much a pointer has moved relative to an element, even if that element is moving along with the changes to the pointer. For example, if a pointer touches a 1x1 pixel box in the middle, current will report a position of (0, 0) when dispatched to it. If the next event moves x position 5 pixels, current will report (5, 0) and previous will report (0, 0). If the box moves all 5 pixels, and the next event represents the pointer moving along the x axis for 5 more pixels, current will again report (5, 0) and previous will report (0, 0).

Parameters
id: PointerId The unique id of the pointer associated with this PointerInputChange.
current: PointerInputData The PointerInputData that represents the current state of this pointer.
previous: PointerInputData The PointerInputData that represents the previous state of this pointer.
consumed: ConsumedData Which aspects of this change have been consumed.

Properties

consumed

val consumed: ConsumedData

Which aspects of this change have been consumed.

current

val current: PointerInputData

The PointerInputData that represents the current state of this pointer.

id

val id: PointerId

The unique id of the pointer associated with this PointerInputChange.

previous

val previous: PointerInputData

The PointerInputData that represents the previous state of this pointer.