diff --git a/public/js/route.js b/public/js/route.js index 23dd2e1..1c590dc 100644 --- a/public/js/route.js +++ b/public/js/route.js @@ -30,6 +30,11 @@ function buildRoute(fit) wayPoints.push({latLng: points[$(el).attr('pointId')]._latlng}); }); + if (fit === true) + { + myMap.fitBounds(bounds).zoomOut(); + } + if (wayPoints.length > 1) { L.Routing.osrm().route(wayPoints, function(err, routes) { @@ -50,15 +55,9 @@ function buildRoute(fit) route.addTo(myMap); } }); - - if (fit === true) - { - closeBox(); - myMap.fitBounds(bounds).zoomOut(); - } - - routeToURL(); } + + routeToURL(); } /**