zoomable

fun Modifier.zoomable(state: ZoomableState, gestures: EnabledZoomGestures, onClick: (clickedAt: Offset) -> Unit? = null, onLongClick: (clickedAt: Offset) -> Unit? = null, onDoubleClick: DoubleClickToZoomListener? = DoubleClickToZoomListener.cycle(), clipToBounds: Boolean = true): Modifier

A Modifier for handling pan & zoom gestures, designed to be shared across all your media composables so that your users can use the same familiar gestures throughout your app. It offers,

  • Pinch to zoom and flings

  • Double click to zoom

  • Single finger zoom (double click and hold)

  • Haptic feedback for over/under zoom

  • Compatibility with nested scrolling

  • Click listeners

  • Keyboard and mouse shortcuts

  • State preservation across config changes (including screen rotations)

Because Modifier.zoomable() consumes all gestures including double-taps, Modifier.clickable and Modifier.combinedClickable will not work on the composable this modifier is applied to. As an alternative, onClick and onLongClick parameters can be used instead.

Parameters

clipToBounds

defaults to true to act as a reminder that this layout should probably fill all available space. Otherwise, gestures made outside the composable's layout bounds will not be registered.


fun Modifier.zoomable(state: ZoomableState, onClick: (clickedAt: Offset) -> Unit? = null, onLongClick: (clickedAt: Offset) -> Unit? = null, clipToBounds: Boolean = true, onDoubleClick: DoubleClickToZoomListener? = DoubleClickToZoomListener.cycle()): Modifier


fun Modifier.zoomable(state: ZoomableState, enabled: Boolean = true, onClick: (clickedAt: Offset) -> Unit? = null, onLongClick: (clickedAt: Offset) -> Unit? = null, clipToBounds: Boolean = true, onDoubleClick: DoubleClickToZoomListener? = DoubleClickToZoomListener.cycle()): Modifier

Deprecated

Use the 'gestures' parameter instead. Replace `enabled = true` with `gestures = ZoomInteractions.ZoomAndPan`, or `enabled = false` with `gestures = ZoomInteractions.None`.