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

Back Image to the center after movements #165

Closed
Yahor10 opened this issue Jun 25, 2020 · 5 comments
Closed

Back Image to the center after movements #165

Yahor10 opened this issue Jun 25, 2020 · 5 comments

Comments

@Yahor10
Copy link

Yahor10 commented Jun 25, 2020

How do I?

I set aligment to none and after some MOVE Actions want toback my image to center (origin position).

Image does not move back with code zoomLayout.setAlignment(Alignment.CENTER); to the center.

How to do it correct?

Version used

Last Version

@natario1
Copy link
Owner

We don't have an API to re-apply the transformation by you can try re-setting the size: zoomLayout.engine.setContainerSize(zoomLayout.width, zoomLayout.height, true). Note the true at the end.

@markusressel
Copy link
Collaborator

@natario1 what do you think about adding a helper function to the to the api for this use case, like f.ex. moveToCenter(zoom: Float? = null)? It seems like a hard thing to do for newcomers, probably because of the way moveTo uses the left upper corner as a reference, instead of the center of the view.

@Yahor10
Copy link
Author

Yahor10 commented Jun 26, 2020

zoomLayout.engine.setContainerSize(zoomLayout.width, zoomLayout.height, true)
Works better. Effect is sharp still.

How to do it with smooth animation?

@natario1
Copy link
Owner

@Yahor10 you have to use the move APIs to zoom where you want.
@markusressel please do if you want. We could also maintain a docs page with "recipes", since we can't cover all cases with APIs and we should really encourage people to do calculations and go through a few minutes of thinking, concepts are simple and understanding them will unlock all the possibilities.

markusressel added a commit that referenced this issue Jun 29, 2020
* added moveToCenter api method

* added moveToCenter implementation
@markusressel
Copy link
Collaborator

Closing this since everything has been said.

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

No branches or pull requests

3 participants