mapbox / mapbox.js

Mapbox JavaScript API, a Leaflet Plugin
mapbox.com/mapbox.js/
Other
1.92k stars 386 forks source link

Let fitBounds return a promise #1256

Open bart-1990 opened 6 years ago

bart-1990 commented 6 years ago

Is it possible to let the fitBounds function return a promise? I think it could be handy in some use cases. For example we want to make an image of a map using map.getCanvas().toDataURL(), but the image should only be taken as soon as we zoomed in to the features the map contains (using map.fitBounds()). The problem is that we can't find a way to let us know that the fitBounds action is completed. We tried using fitBounds.then(), but realised it doesn't return a promise.