TransformScope

Interface
Common
@JvmDefaultWithCompatibility
interface TransformScope

Scope used for suspending transformation operations.

Implementers of this interface should override both transformBy and transformByWithCentroid, treating a call to transformBy as a call to transformByWithCentroid with a Offset.Unspecified centroid. To maintain compatibility, the default implementation of transformByWithCentroid will call transformBy, dropping the centroid information.

Overriding the newer transformByWithCentroid and using the centroid, if specified, allows implementing more natural transformations around the point where the transformation occurs.

Functions

fun transformBy(
        zoomChange: Float = 1f,
        panChange: Offset = Offset.Zero,
        rotationChange: Float = 0f,
    )

Attempts to transform by zoomChange in relative multiplied value, by panChange in pixels and by rotationChange in degrees.

Prefer calling the version of transformBy by that takes a centroid Offset, especially if the zooming or rotation should happen around a particular point. This allows for more natural transformations around a specific point. If there is no appropriate Offset to use, you can pass Offset.Unspecified.

Implementations of TransformScope need to support both for compatibility, and can be expected to interpret calls to transformBy without a centroid as equivalent to a call to transformByWithCentroid with an Offset.Unspecified centroid.

Parameters

zoomChange scale factor multiplier change for zoom
panChange panning offset change, in Offset pixels
rotationChange change of the rotation in degrees
fun transformByWithCentroid(
        centroid: Offset = Offset.Unspecified,
        zoomChange: Float = 1f,
        panChange: Offset = Offset.Zero,
        rotationChange: Float = 0f,
    ) = transformBy(zoomChange = zoomChange, panChange = panChange, rotationChange = rotationChange)

Attempts to transform by zoomChange in relative multiplied value, by panChange in pixels and by rotationChange in degrees.

The default implementation calls transformBy, dropping the centroid.

Parameters

centroid the centroid around which the transformation is occurring. This may be Offset.Unspecified if the transformation is not associated with any centroid.
zoomChange scale factor multiplier change for zoom
panChange panning offset change, in Offset pixels
rotationChange change of the rotation in degrees