zoomable

fun Modifier.zoomable(state: ZoomableState, enabled: Boolean = true, onClick: (Offset) -> Unit? = null, onLongClick: (Offset) -> Unit? = null, clipToBounds: Boolean = true, onDoubleClick: DoubleClickToZoomListener = DoubleClickToZoomListener.ToggleBetweenMinAndMax): 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

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

Parameters

enabled

whether or not gestures are enabled.

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.