TransformableState

Function

Common
fun TransformableState(
    onTransformation: (zoomChange: Float, panChange: Offset, rotationChange: Float) -> Unit
): TransformableState

Default implementation of TransformableState interface that contains necessary information about the ongoing transformations and provides smooth transformation capabilities.

This is the simplest way to set up a transformable modifier. When constructing this TransformableState, you must provide a onTransformation lambda, which will be invoked whenever pan, zoom or rotation happens (by gesture input or any TransformableState.transform call) with the deltas from the previous event.

Parameters

onTransformationcallback invoked when transformation occurs. The callback receives the change from the previous event. It's relative scale multiplier for zoom, Offset in pixels for pan and degrees for rotation. Callers should update their state in this lambda.