rememberTransformableState

Functions summary

TransformableState
@Composable
rememberTransformableState(
    onTransformation: (zoomChange: Float, panChange: Offset, rotationChange: Float) -> Unit
)

This function is deprecated. Prefer remembering a TransformableState with a onTransformation lambda that takes the centroid.

Cmn
TransformableState
@Composable
rememberTransformableState(
    onTransformation: (centroid: Offset, zoomChange: Float, panChange: Offset, rotationChange: Float) -> Unit
)

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

Cmn

Functions

rememberTransformableState

@Composable
fun rememberTransformableState(
    onTransformation: (zoomChange: Float, panChange: Offset, rotationChange: Float) -> Unit
): TransformableState

Create and remember 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
onTransformation: (zoomChange: Float, panChange: Offset, rotationChange: Float) -> Unit

callback 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.

rememberTransformableState

@Composable
fun rememberTransformableState(
    onTransformation: (centroid: Offset, zoomChange: Float, panChange: Offset, rotationChange: Float) -> Unit
): TransformableState

Create and remember 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
onTransformation: (centroid: Offset, zoomChange: Float, panChange: Offset, rotationChange: Float) -> Unit

callback invoked when transformation occurs. The callback receives the change from the previous event. The centroid Offset refers to where the transformation occurs. The changes are a relative scale multiplier for zoom, Offset in pixels for pan and degrees for rotation. Callers should update their state in this lambda.