Implement zoom/pan options in L.Map.flyTo()
See original GitHub issueFor API consistency, L.Map.flyTo()
should take an options
argument with the common pan/zoom options.
Also for API consistency, L.Map.flyTo()
should return this
.
(Also, make L.Map.flyToBounds()
pass its options to L.Map.flyTo()
)
At least the options to not perform animations should be respected, and it would be nice to specify a custom animation time. I don’t think there’s an immediate need for the rest of the zoom/pan options.
Issue Analytics
- State:
- Created 8 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
How do I zoom/Pan to a Leaflet Map, such that the given point ...
Leaflet-active-area: This plugin allows you to use a smaller portion of the map as an active area. All positioning methods (setView, fitBounds, ...
Read more >Documentation - a JavaScript library for interactive maps
flyTo (<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?) this. Sets the view of the map (geographical center and zoom) performing a smooth pan-zoom ......
Read more >L.Map - WRLD3D
flyTo (<LatLng> latlng, <Number> zoom?, <Zoom/pan options> options?) this. Sets the view of the map (geographical center and zoom) performing a smooth pan-zoom ......
Read more >Animated setView() in Leaflet - Stack Overflow
The duration of any animated zoom is hard-coded to be 0.25s, and because setView accepts zoom/pan options, which do not include duration ...
Read more >Slowly fly to a location | Mapbox GL JS
Use flyTo with flyOptions to slowly zoom to a location. ... These options control the camera position after animation. const start = {....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
If someone stumbles here some day, a
duration
key for theoptions
object is implemented in https://github.com/Leaflet/Leaflet/blob/a54c2392389982dc618ba94b50ee8fbcb26f7949/src/map/anim/Map.FlyTo.js#L44@almereyda
I was that guy who stumbled here some day. You are a god, good sir.
Here was my implementation:
map.flyTo([41, -96], 5, { duration: 0.8, })
Works great! The lower the number, the faster the speed.