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.

Summary

Public functions

Unit
transformBy(zoomChange: Float, panChange: Offset, rotationChange: Float)

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

Cmn
open Unit
transformByWithCentroid(
    centroid: Offset,
    zoomChange: Float,
    panChange: Offset,
    rotationChange: Float
)

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

Cmn

Public functions

transformBy

fun transformBy(
    zoomChange: Float = 1.0f,
    panChange: Offset = Offset.Zero,
    rotationChange: Float = 0.0f
): Unit

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: Float = 1.0f

scale factor multiplier change for zoom

panChange: Offset = Offset.Zero

panning offset change, in Offset pixels

rotationChange: Float = 0.0f

change of the rotation in degrees

transformByWithCentroid

open fun transformByWithCentroid(
    centroid: Offset = Offset.Unspecified,
    zoomChange: Float = 1.0f,
    panChange: Offset = Offset.Zero,
    rotationChange: Float = 0.0f
): Unit

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: Offset = Offset.Unspecified

the centroid around which the transformation is occurring. This may be Offset.Unspecified if the transformation is not associated with any centroid.

zoomChange: Float = 1.0f

scale factor multiplier change for zoom

panChange: Offset = Offset.Zero

panning offset change, in Offset pixels

rotationChange: Float = 0.0f

change of the rotation in degrees