-
-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update worldmap.js to allow "flying" to new bounds (#225)
* Update worldmap.js to allow "flying" to new bounds When the bounds command is used, give the option to "fly" (a Leaflet term meaning to animate the change of bounds: zoom out, pan, zoom in) to the new bounds rather than simply repositioning the map. This is done very simply by providing a "fly" flag that, with a truthy value, calls map.flyToBounds instead of map.fitBounds. There are 10 other places where map.fitBounds is used, but for my purposes, I only want to "fly" to the new bounds when I explicitly set the bounds through this command. So perhaps these changes could/should be used in other scenarios too. * Update worldmap.js to allow flying to bounds I've changed almost every instance of fitBounds so that, if the "fly" property is true, then it will use flyToBounds instead. I didn't change the search, where it does fitBounds and then panTo, as it wasn't clear how/whether "fly" could be provided there. I also fixed a few bugs where it was checking for "fit" being a property, but then didn't check its value! So you could provide fit:false and it would still be treated as fit:true!
- Loading branch information
Showing
1 changed file
with
26 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters