-
-
Notifications
You must be signed in to change notification settings - Fork 148
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
Changes in ZoomLayout's Width/Height don't update child transformation to keep center-crop working #186
Comments
I used below code to get around this.
And, another change in ZoomLayout's
Doing this helps me. Child is correctly aligned with parent to maintain centercrop functionality. But, this code births #185 issue. Clearly, now I know the reason why Pan resets(hint#global-layout). So, I am still looking for a way to tell ZoomLayout to apply transformation on child when container width/height is changed. If I keep trying using hacks, I will only have more bugs. You have worked on this, you know better than me. Please guide me. |
Thank you for the detailed report. If we want to support this, I think we need to have a discussion about how the expected behavior should look like, and how developers should be able to deviate from it. |
I like how it works right now, container size can change for many reasons and if the content was already zoomed/panned, I don't think we should re-apply the transformation. You should be able to achieve what you want like this:
Or maybe like this
We could make this easier with a syncTransformation() function or something like that |
@markusressel Okay, I understand. Also, I feel what I want to do is only using 25% potential of this library. Disabling what the library is meant to be used for is actually kind-of going against it and expecting it to work. All I need is center-crop with pan and fling. If you have anything to suggest, please do. Thanks.
@natario1 If this is expected/needed, there should be an opt-in flag to this behaviour. To me, it feels like anti of default expectation. When center-crop is applied, and container size is changed, center-crop should be maintained. Although if we aren't supporting size changes in ZoomLayout, then this wouldn't even matter. Also, I am engaged with library's code from Tuesday. I do not know Thank you for your help. I am sorry I took much longer to respond. |
@rupinderjeet I tried to reproduce your example, but when applying the modified
Am I missing something? |
Describe the bug
I am using ZoomLayout to show portrait/landscape images. I have disabled Zoom & OverScroll. I am using horizontal & vertical Pan with CenterCrop only. At one time, only one direction pan can be performed, as expected(because zoom disabled). This allows me to show a portion of image, while the other portion can be viewed using Pan.
As I have understood, centercrop works by aligning either
containerHeight
tochildHeight
orcontainerWidth
tochildWidth
. Right? Imagine loading landscape/portrait images into a square ImageView. For landscape images,childHeight
will be aligned withcontainerHeight
to perform centercrop, and now, pan can be performed horizontally. Similarly, for portrait images, pan can be performed vertically.This works fine.
But, if I change width/height of ZoomLayout like this, the transformation is not applied on child view.
To Reproduce
Steps to reproduce the behavior, possibly in the demo app:
Expected behavior
When container height changes, child transformation is applied to maintain CenterCrop.
XML layout (Extended ZoomLayout)
Screenshots
Logs
Launched
Load Horizontal Background Drawable on Child.
Increase ZoomLayout Height using above code.
Child is not transformed to maintain centercrop functionality.
APK
Will provide if needed, but very easy to use reproduction steps.
The text was updated successfully, but these errors were encountered: