Draggable2DState
interface Draggable2DState
State of Draggable2D. Allows for granular control of how deltas are consumed by the user as well
as to write custom drag methods using drag suspend function.
Functions
suspend fun drag(
dragPriority: MutatePriority = MutatePriority.Default,
block: suspend Drag2DScope.() -> Unit,
)
Call this function to take control of drag logic.
All actions that change the logical drag position must be performed within a drag block
(even if they don't call any other methods on this object) in order to guarantee that mutual
exclusion is enforced.
If drag is called from elsewhere with the dragPriority higher or equal to ongoing drag,
ongoing drag will be canceled.
Parameters
| dragPriority | of the drag operation |
| block | to perform drag in |
fun dispatchRawDelta(delta: Offset)
Dispatch drag delta in pixels avoiding all drag related priority mechanisms.
Note: unlike drag, dispatching any delta with this method will bypass dragging of any
priority. This method will also ignore reverseDirection and other parameters set in
draggable2D.
This method is used internally for low level operations, allowing implementers of
Draggable2DState influence the consumption as suits them. Manually dispatching delta via
this method will likely result in a bad user experience, you must prefer drag method over
this one.
Parameters
| delta | amount of drag dispatched in the nested drag process |
