Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get and restore zoom level and image position #418

Closed
LarissaSmith opened this issue Jun 10, 2014 · 4 comments
Closed

Get and restore zoom level and image position #418

LarissaSmith opened this issue Jun 10, 2014 · 4 comments
Labels

Comments

@LarissaSmith
Copy link
Contributor

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?

@msalsbery
Copy link
Member

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

@SamHall
Copy link

SamHall commented Jun 11, 2014

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,
...

@iangilman
Copy link
Member

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.

@LarissaSmith
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants