question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Need help with fitbounds event sequences.

See original GitHub issue

I use the fitbounds method to direct the viewport to a set of coordinates via click(function) of a class. It works well. Now I want to apply a delay between a series of coordinates - creating an automatic chained set of movements. My lack of JavaScript proficiency has prevented me from figuring this out on my own.

In this case, I’m also using it as a background to a header and made it non-interactive.

Demo here that fires the event upon ‘open’. And two buttons that fire different viewport coordinates just for demonstration (will not want to use buttons). http://deepzoomchattanooga.com/dzdemo.php

Relevant code below for the open and click. Need to know how to open, then after a number of seconds, fire the next one, etc.

Thank you.

        var box1 = new OpenSeadragon.Rect(0.13, 0.05, 0.03, 0.01);
        var box5 = new OpenSeadragon.Rect(0.87, 0.05, 0.05, 0.02);
            viewer.addHandler('open', function() {
              viewer.viewport.zoomSpring.animationTime = 280.0;
              viewer.viewport.zoomSpring.springStiffness = 5;
              viewer.viewport.centerSpringX.animationTime = 280.0;
              viewer.viewport.centerSpringX.springStiffness = 5;
              viewer.viewport.centerSpringY.animationTime = 280.0;
              viewer.viewport.centerSpringY.springStiffness = 5;
              viewer.viewport.fitBounds(box5);
            });
			
			$('.loc1').click(function() {
              viewer.viewport.zoomSpring.animationTime = 280.0;
              viewer.viewport.zoomSpring.springStiffness = 5;
              viewer.viewport.centerSpringX.animationTime = 280.0;
              viewer.viewport.centerSpringX.springStiffness = 5;
              viewer.viewport.centerSpringY.animationTime = 280.0;
              viewer.viewport.centerSpringY.springStiffness = 5;
			  viewer.viewport.fitBounds(box1);
			});

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:29 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
SamHallcommented, Dec 19, 2018

You’re one step ahead. I’m sure I would have asked about that next. And yes, I’ll do some testing and let you know if I do find a provable issue on the vars.

Thanks again.

1reaction
SamHallcommented, Dec 13, 2018

I’ll ‘digest’ this and see what I can do. Thanks for the tip on the URL. I think I’ve made that mistake more than once.

I’ll follow up when progress is made (or not).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Do not fire 'zoom_changed' event when calling fitBounds ...
I am having an issue where I need to do a search on the server from client when there is a zoom change...
Read more >
leaflet - how does one reset map.fitbounds (zoomtofeature ...
I have a lovely map setup using Leaflet with MapBox tiles (only). It is a United States map with polygons for each state...
Read more >
Fit a map to a bounding box | Mapbox GL JS
This example zooms and pans the map so the new visible area of the map fits within the specified geographical bounds.
Read more >
Folium 0.12.1 documentation
Can choose from a list of built-in tiles, pass a custom URL or pass None to create a map without tiles. For more...
Read more >
Upgrading Your Maps JavaScript API Application from V2 to V3
The event model for the Maps JavaScript API v3 is similar to that used in v2, though much has changed under the hood....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found