zoomable

fun Modifier.zoomable(zoomState: ZoomState, zoomEnabled: Boolean = true, enableOneFingerZoom: Boolean = true, scrollGesturePropagation: ScrollGesturePropagation = ScrollGesturePropagation.ContentEdge, onTap: (position: Offset) -> Unit = {}, onDoubleTap: suspend (position: Offset) -> Unit = { position -> if (zoomEnabled) zoomState.toggleScale(2.5f, position) }): Modifier

Modifier function that make the content zoomable.

Parameters

zoomState

A ZoomState object.

zoomEnabled

specifies if zoom behaviour is enabled or disabled. Even if this is false, onTap and onDoubleTap will be called.

enableOneFingerZoom

If true, enable one finger zoom gesture, double tap followed by vertical scrolling.

scrollGesturePropagation

specifies when scroll gestures are propagated to the parent composable element.

onTap

will be called when single tap is detected on the element.

onDoubleTap

will be called when double tap is detected on the element. This is a suspend function and called in a coroutine scope. The default is to toggle the scale between 1.0f and 2.5f with animation.