These are chat archives for openseadragon/openseadragon

31st
May 2017
Matthew Jack
@matthew-jack
May 31 2017 20:08

Hi all, I'm trying to 'pin' an image to the corner of a viewer so it remains in place when the viewport is zoomed.
I have two viewers, side by side. The left image I want to pin to the top right; the right image I want to pin to the top left.
For the right image, I do:

var bounds = viewport.getBounds();
var vector = new OpenSeadragon.Point(-bounds.x,-bounds.y);  // same as negate()
viewport.panBy(vector);

and for the left:

var bounds = viewport.getBounds();
var vector = new OpenSeadragon.Point(bounds.x,-bounds.y);  // I'm only flipping the y-coordinate
viewport.panBy(vector);

Is there a better way to approach this?
Thank you!

Matthew Jack
@matthew-jack
May 31 2017 20:21
sorry, that was a very vague question...what I mean specifically is a way to get the absolute point that I can pan to rather than a vector that changes as the viewport changes.
My guess would be to get the center of the image and the viewport coordinate of the corner, and subtract the distance between the center and the corner of the image, but so far I haven't figured out how to do that.