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?
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!
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!