These are chat archives for openseadragon/openseadragon

9th
Mar 2018
Kampenuss
@Kampenuss_twitter
Mar 09 2018 23:14
Hi! I am struggling with the minZoomFactor and I am hoping that someone can point me to the right direction. In this screenshot (https://www.dropbox.com/s/765157pusfgwjh8/Screen%20Shot%202018-03-09%20at%202.54.50%20PM.png?dl=0) you can see two scenarios - version 1 is with an image in portrait and version 2 is with an image in landscape. The dashed lines define some specific offset from the top and bottom of the canvas and user should not be able to zoom out more than the distance between those dashed lines. In other words.. when user zooms in, the dashed lines become useless, but when user zooms out, the image should not zoom out smaller than the space between the dashed lines like in scenario 1 OR should not zoom one once the image is fully visible horizontally like in case 2. So basically user should not be able to zoom out once the image is fully visible in the area between the dashed lines. I hope that makes sense. In this nice helper (http://msalsbery.github.io/openseadragonimaginghelper/index.html) the minZoomFactor is set to 0.05. Our thought was to come up with a formula that would override that value. We can calculate the dashed space size using browser size and subtracting the offsets. When we get this space in pixels, how do we convert it to the corresponding zoom level integer so that we know at what value it should stop zooming out?
Ian Gilman
@iangilman
Mar 09 2018 23:29
@Kampenuss_twitter OSD zoom level is expressed as the ratio between the width of the image and the width of the viewport. If the image is exactly touching the left and right edges of the viewport (as in version 2), the zoom level is 1.
In version 1 it looks like the width of the image is about 1/4 of the width of the viewport, so the zoom level is 0.25.
You'll need to do some math to convert between the required vertical ratio and the horizontal ratio, based on the image's aspect ratio.
Does that make sense?
Kampenuss
@Kampenuss_twitter
Mar 09 2018 23:31
Thanks, I will play around with this thought/ info
Yea.. will mess around thx a lot!
Ian Gilman
@iangilman
Mar 09 2018 23:31
Thanks for including the diagram, by the way... Makes a big difference to understand!
Cool :)
Kampenuss
@Kampenuss_twitter
Mar 09 2018 23:31
:)