Created
March 28, 2026 01:15
-
-
Save skydoves/417abdf4f15f4ea934d07f7a7eec1343 to your computer and use it in GitHub Desktop.
ZoomablePlugin implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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