Prevent zoom percentage lower than 1% - #60
Conversation
|
🚢 |
|
I don't think this fixes #59, if you look at my gif of repro the zoom percentage is 23/38 when it gets stuck not very small. I'm just guessing here but does the zoom factor multiply with the displayed size of the image and chrome doesn't display the image as 3.75x3.75 but rather as 3x3 and the same goes for 2.25x2.25 being displayed as 3x3 until you resize the window then it is 3x2, 2x3 or 2x2 depending on how you resized? |
|
I'm pretty sure this fixes the problem. At least when I tried to reproduce the problem, what I experienced was a rounding off "error" which occured when continuously zooming out. The result was the zoom percentage being rounded off to 0%, after which there was no way to recover since we would always multiply by something that was numerically equivalent to zero. Please test if this fixes the problem you experienced. At the very least this fixes a tangential issue. |
|
Sorry, I should have mentioned that I did test and my problem does persist. Can you try to zoom out with the spec image in the image-view repository and see what results you get? https://github.com/atom/image-view/blob/master/spec/fixtures/binary-file.png For me it gets stuck at 23% zooming out and I can't zoom back in more than once up to 38% or sometimes it gets stuck at 15% zooming out and I can't zoom back in more than once up to 25%. Depending on the size of the Atom window? But I am using dev mode out of safe mode with Atom 1.8.0 and a weird computer when testing, so maybe something is wrong on my side. I can test on latest master later to see what results I get there. |
|
Thanks for the follow-up! 🙇 |
|
Currently the scaling is based on the "physical" Maybe we can remember the original size of an image and then scale based on that? |
|
Problem is the current system is a little bit flawed due to rounding-off errors and such. I'm working on a PR that transitions to a system with predefined "zoom levels", and thus zooming in and out simply transitions betweens those percentages. Side note: this means we always use the original width and height, hence we are not subjected to accumulated rounding-off errors, etc. |
How would this work with the suggested enhancements of manually writing zoom level? Discussed here: |
|
That will still work, along the same lines as "zoom to fit". Of course we'd need to determine what should happen when the user clicks zoom in or out after having set a custom percentage, but that's trivial. |
Fixes #59
/cc @atom/feedback