zoomableWithScroll

fun Modifier.zoomableWithScroll(zoomState: ZoomState, zoomEnabled: Boolean = true, enableOneFingerZoom: Boolean = true, scrollGesturePropagation: ScrollGesturePropagation = ScrollGesturePropagation.ContentEdge, onTap: (position: Offset) -> Unit? = null, onDoubleTap: suspend (position: Offset) -> Unit? = { position -> if (zoomEnabled) zoomState.toggleScale(2.5f, position) }, onLongPress: (position: Offset) -> Unit? = null, mouseWheelZoom: MouseWheelZoom = MouseWheelZoom.EnabledWithCtrlKey): Modifier

A modifier function that allows scrollable content to be zoomable.

It can be applied to lazy composable functions such as LazyColumn and LazyRow.

It can also be applied in combination with Modifier.verticalScroll for Columns, or Modifier.horizontalScroll for Rows. In these case, please write it before verticalScroll or horizontalScroll in the modifier chain.

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.

onLongPress

will be called when time elapses without the pointer moving

mouseWheelZoom

specifies mouse wheel zoom behaviour.