usuiat / Zoomable

Jetpack Compose library that enables contents zooming with pinch gesture.
https://usuiat.github.io/Zoomable/
Apache License 2.0
325 stars 15 forks source link

Key param #192

Open T8RIN opened 3 months ago

T8RIN commented 3 months ago

It would be really helpful to have key parameter which by it's changing resets zoom state to initial position

T8RIN commented 3 months ago

in rememberZoomableState ofc

usuiat commented 3 months ago

I don't think a key parameter is necessary for rememberZoomableState. You can use ZoomState.reset instead.

This approach is the same as the Compose official library. For example, rememberScrollState does not have a key parameter. If you want to return the scroll state to the initial state, you can use ScrollState.scrollTo.

T8RIN commented 3 months ago

reset doesn't reset the state fully, isn't it?

usuiat commented 3 months ago

reset() does reset scale, offsetX, and offsetY.

T8RIN commented 3 months ago

And if i change the zoom container size, will it help to maintain usability?

usuiat commented 3 months ago

Changing contentSize will not reset the scale and offset. I did not assume to change contentSize dynamically. Do you want to change the image dynamically?

T8RIN commented 3 months ago

Yes, that's why key param are useful for me