Skip to content

Instantly share code, notes, and snippets.

@skydoves
Created March 28, 2026 01:15
Show Gist options
  • Select an option

  • Save skydoves/417abdf4f15f4ea934d07f7a7eec1343 to your computer and use it in GitHub Desktop.

Select an option

Save skydoves/417abdf4f15f4ea934d07f7a7eec1343 to your computer and use it in GitHub Desktop.
ZoomablePlugin implementation
@Immutable
public data class ZoomablePlugin(
public val state: ZoomableState? = null,
public val enabled: Boolean = true,
public val onTransformChanged: ((ContentTransformation) -> Unit)? = null,
) : ImagePlugin.ComposablePlugin {
@Composable
override fun compose(content: @Composable () -> Unit) {
val zoomableState = state ?: rememberZoomableState()
val transformation = zoomableState.transformation
onTransformChanged?.invoke(transformation)
ZoomableContent(
zoomableState = zoomableState,
config = zoomableState.config,
enabled = enabled,
content = content,
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment