DragEvent

data class DragEvent(val key: Any, val phase: DragPhase = DragPhase.Move, val pointerXPx: Float = 0.0f, val pointerYPx: Float = 0.0f, val targetXPx: Float = pointerXPx, val targetYPx: Float = pointerYPx, val velocityXPxPerSec: Float = 0.0f, val velocityYPxPerSec: Float = 0.0f, val uptimeMillis: Long = 0)

Pointer-driven drag event payload in PhysicsBox container coordinates (pixels).

Two positions are provided:

  • pointerXPx/pointerYPx: the raw pointer location (finger/mouse) in container px.

  • targetXPx/targetYPx: the effective target used by the drag controller (may differ from pointer position due to anchoring, clamping, or other engine-defined adjustments).

Velocity components (velocityXPxPerSec, velocityYPxPerSec) represent the estimated pointer velocity in px/s near the time of the event (useful for fling on release and UI effects).

Parameters

key

Physics body key associated with this drag.

phase

Drag lifecycle phase.

pointerXPx

Raw pointer X in container px.

pointerYPx

Raw pointer Y in container px.

targetXPx

Target X in container px used by the drag controller.

targetYPx

Target Y in container px used by the drag controller.

velocityXPxPerSec

Estimated pointer velocity X in px/s.

velocityYPxPerSec

Estimated pointer velocity Y in px/s.

uptimeMillis

Event time in uptime millis (suitable for ordering and duration calculations).

Constructors

Link copied to clipboard
constructor(key: Any, phase: DragPhase = DragPhase.Move, pointerXPx: Float = 0.0f, pointerYPx: Float = 0.0f, targetXPx: Float = pointerXPx, targetYPx: Float = pointerYPx, velocityXPxPerSec: Float = 0.0f, velocityYPxPerSec: Float = 0.0f, uptimeMillis: Long = 0)
constructor(key: Any, xPx: Float, yPx: Float)

Convenience constructor for a simple move/update event where the drag target equals the pointer position.

Properties

Link copied to clipboard
val key: Any
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard