Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key param #192

Open
T8RIN opened this issue Mar 23, 2024 · 7 comments
Open

Key param #192

T8RIN opened this issue Mar 23, 2024 · 7 comments

Comments

@T8RIN
Copy link

T8RIN commented Mar 23, 2024

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

@T8RIN
Copy link
Author

T8RIN commented Mar 23, 2024

in rememberZoomableState ofc

T8RIN added a commit to T8RIN/Zoomable that referenced this issue Mar 23, 2024
@usuiat
Copy link
Owner

usuiat commented Mar 25, 2024

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
Copy link
Author

T8RIN commented Mar 25, 2024

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

@usuiat
Copy link
Owner

usuiat commented Mar 25, 2024

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

@T8RIN
Copy link
Author

T8RIN commented Mar 26, 2024

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

@usuiat
Copy link
Owner

usuiat commented Mar 26, 2024

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
Copy link
Author

T8RIN commented Mar 26, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants