Created
December 17, 2018 06:56
-
-
Save drecodeam/5a8b734dbd0b6a9269f203a176b4e11a to your computer and use it in GitHub Desktop.
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
# Get map bounds between 2 points | |
getMapBounds = ( origin, destination ) -> | |
sw = new mapboxgl.LngLat(origin[1], origin[0]); | |
ne = new mapboxgl.LngLat(destination[1], destination[0] ); | |
llb = new mapboxgl.LngLatBounds(sw, ne); | |
return llb | |
getRoute( origin, destination ).then( | |
mapInstance.fitBounds( getMapBounds( origin, destination ), { | |
padding: 100 | |
linear: true | |
}) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment