Openseadragon: Get and restore zoom level and image position

Created on 10 Jun 2014  路  4Comments  路  Source: openseadragon/openseadragon

I have a series of images that I want to let the user position and zoom on and preserve the position and zoom level across images. I've figured out how to capture the zoom level and restore it, but I can't get the positioning to work. Any ideas?

question

Most helpful comment

Ok, I got this working. I'm using viewport.getBounds() to save my position and viewport.fitBounds() to restore it. Thanks guys!

All 4 comments

I believe you can use Viewport.getCenter() to save, Viewport.panTo() to restore.

I stumbled on this by accident, but it may solve what you're trying to do.
Adding preserveViewport: true allowed me to 'toggle' between two images. In this case I used the previous and next button to load them.
See it's use here: http://deepzoomchattanooga.com/1865bend.php

...
nextButton: "next",
previousButton: "previous",
preserveViewport: true,
...

You should also be able to do var box = viewer.viewport.getBounds() to get the current location and viewer.viewport.fitBounds(box) later to return to that location.

Ok, I got this working. I'm using viewport.getBounds() to save my position and viewport.fitBounds() to restore it. Thanks guys!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

darwinjob picture darwinjob  路  3Comments

xlb picture xlb  路  3Comments

maxrottersman picture maxrottersman  路  4Comments

Pim92 picture Pim92  路  3Comments

JonasGra picture JonasGra  路  6Comments