openseadragon / bookmark-url

An OpenSeadragon plugin for updating the zoom/pan in the page URL.
BSD 3-Clause "New" or "Revised" License
9 stars 4 forks source link

Able to Ease-in to bookmark from full view? #4

Open bdrichards opened 3 years ago

bdrichards commented 3 years ago

A request: Is there a way to have the bookmark plugin "ease-in" to the view coordinates from a home view upon loading?

thanks for any response... BDR

iangilman commented 3 years ago

This plugin does not support animating to the new location, but it would be quite straightforward to add that... basically you just need to replace the true at the end of:

https://github.com/openseadragon/bookmark-url/blob/447051ea1898222cfafdd22b7d6d1a41621e4014/openseadragon-bookmark-url.js#L61

...and:

https://github.com/openseadragon/bookmark-url/blob/447051ea1898222cfafdd22b7d6d1a41621e4014/openseadragon-bookmark-url.js#L65

...to a variable that's either true (for no animation) or false (for animation).

You can modify your own copy of the plugin for that purpose, but if you're up for making a pull request here to add that feature, that would be lovely!

bdrichards commented 3 years ago

Hello Ian, Thank you for the response. Your suggestion is exactly what I have already tried in advance. It does not actually provide an "ease-in" behavior, it is rather rapid. Below is the total image (first link) and the second link is the plugin modified, I also changed the panTo and zoomTo order in the plugin code: overall image, no BookmakrURL plugin usedhttps://br1.nic.edu/giga/?id=fieldtrip01stop01&dz=0.90&scale=1500 bookmarkURL "panTo" and "zoomTo" set to falsehttps://br1.nic.edu/giga/?id=fieldtrip01stop01&scale=1500&bmurl#zoom=20.07053393007071&x=0.7857389766478017&y=0.16460225736434897

I was hoping for a way to slow the process down so the user can follow the motion a little better, sort of "animate" it.

"You can modify your own copy of the plugin for that purpose, but if you're up for making a pull request here to add that feature, that would be lovely!" Would love to do that, but I am novice on this platform (old-time programmer back to punch-card days). In fact, I thought I had made a pull request for other changes I have implemented regarding preserving the URL "search" items........ maybe some hand-holding on that process...

Bill D. Richards Associate Professor Dept. of Geosciences North Idaho College 1000 W. Garden Ave. Coeur d'Alene, ID 83814 208-769-3477

North Idaho College Weatherstation @ WeatherUndergroundhttps://www.wunderground.com/dashboard/pws/KIDCOEUR46


From: Ian Gilman @.> Sent: Friday, April 9, 2021 11:35 AM To: openseadragon/bookmark-url @.> Cc: Bill Richards BDRichards@NIC.EDU; Author @.***> Subject: Re: [openseadragon/bookmark-url] Able to Ease-in to bookmark from full view? (#4)

This plugin does not support animating to the new location, but it would be quite straightforward to add that... basically you just need to replace the true at the end of:

https://github.com/openseadragon/bookmark-url/blob/447051ea1898222cfafdd22b7d6d1a41621e4014/openseadragon-bookmark-url.js#L61

...and:

https://github.com/openseadragon/bookmark-url/blob/447051ea1898222cfafdd22b7d6d1a41621e4014/openseadragon-bookmark-url.js#L65

...to a variable that's either true (for no animation) or false (for animation).

You can modify your own copy of the plugin for that purpose, but if you're up for making a pull request here to add that feature, that would be lovely!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/openseadragon/bookmark-url/issues/4#issuecomment-816880606, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEKLBRGJWN3JHY3LC5VVRS3TH5CIXANCNFSM4ZDKRH2Q.

iangilman commented 3 years ago

I see! Well, the easiest way to change the animation speed is adjust the animationTime and springStiffness options when creating your OpenSeadragon viewer. They affect all animations, not just the starting animation, so you would probably want to update them after the initial load to get back to snappier response... that involves going into the viewport and modifying its springs... I can fill you in on that if that's the way you want to go. Anyway, animationTime defaults to 1.2 (seconds) and springStiffness defaults to 6.5... making the former bigger and the latter smaller should make things slower.

The springs always have an easeOut style to them... if you want easeInOut instead, you'll have to do your own animation loop, interpolating your target location and setting it per frame.

I guess I would suggest trying the options above and see if you can get the effect you want, and then I can help you with next steps.