-
Notifications
You must be signed in to change notification settings - Fork 33
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
How to prevent resize below original size? #4
Comments
Ok, this is bizarre. With one source I cannot make it misbehave, with another I can..... looking into why now... Found it -- if you rotate the device you're hosed. This appears to be related to use in a fragment (which is where one of my use cases is and why it didn't show up with some sources and instances of my attempts to use it but did with others); onRestoreInstanceState is not called on rotation in that case, and minScale winds up being zero. This obvious hack around this problem is to recognize the zero value and set it to "1.0f", but I'll see if I can come up with a better answer. |
Me too |
Biggest issue right now is figuring out why a "reset to default" (double-tap) isn't working correctly. I get the correct size but not the correct 0,0 x/y origin back -- and am not at all sure why. |
Pull request sent. |
@tickerguy : If Is it possible take a look at to my issue. |
Setting "minScale='1'" does not do it. You can still resize below the original TextureView size, which looks very odd and also glitches badly if you have a light theme background.
I have figured out how to set the original view's parameters to maintain the aspect ratio (which for a SurfaceView appears to initialize properly automatically, but does not for a TextureView even with orientation set explicitly to vertical) but I cannot find the original scale value of the view in initView and, if someone tries to resize the view smaller than that cap the scale to the original level when the view was established.
It appears that "minScale" and "maxScale" are intended to prevent this but they don't -- the code looks right in onScale but isn't preventing the problem.
In addition it would be nice to have a double-tap reset scaling to the original value.
Example code demonstrating the problem -- play something in landscape and try to pinch it smaller. You can't. Then pinch zoom it LARGER, then back to smaller below the original "fills the screen" width. You should not be able to with the minScale set to 1 but you can in fact shrink the view below the screen width.
and the XML for this:
The text was updated successfully, but these errors were encountered: