These are chat archives for openseadragon/openseadragon

9th
Sep 2016
Samuel Allen
@dehuszar
Sep 09 2016 16:06
@iangilman Your suggestion for getBounds() works great, but I've hit one (hopefully) last hurdle. When I zoom or pan, I get exactly the result I want, but if I just drop an overlay without making any adjustments, I'm getting the problem I originally stated where the center of the bounds is not being measured against the current viewport bounds, but the image bounds (or so I'm guessing anyway). Even though my viewport bounds width and height are x: 0.8 and y: 0.30612377850162864, the getBounds.getCenter() returns 0.5:0.5 which doesn't match the viewport ratio. If I then zoom, or pan the context returned is correct, but not before then. Is there something I need to fire right away to set the context without actually having to zoom first?
Ian Gilman
@iangilman
Sep 09 2016 16:30
@dehuszar Are you doing a getBounds before the open event fires? If so, it won't be accurate
Samuel Allen
@dehuszar
Sep 09 2016 16:43
Ahh. Possibly.
Ian Gilman
@iangilman
Sep 09 2016 16:44
You want viewer.addHandler('open', handler)
Until the file is opened, it doesn't know the aspect ratio so it just assumes 1, 1
Samuel Allen
@dehuszar
Sep 09 2016 17:58
@iangilman That was it, thanks!
Ian Gilman
@iangilman
Sep 09 2016 18:15
Excellent