X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d065f88b1a565d1b9c784d27993159bc64c926ec..567a9e5b23b07babe32381fd45647dc88ff1915e:/app/assets/javascripts/index/directions.js diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 4e2c4a895..f7ce2adc1 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -3,7 +3,7 @@ //= require qs/dist/qs OSM.Directions = function (map) { - var awaitingRoute; // true if we've asked the engine for a route and are waiting to hear back + var routeRequest = null; // jqXHR object of an ongoing route request or null var chosenEngine; var popup = L.popup({ autoPanPadding: [100, 100] }); @@ -23,7 +23,7 @@ OSM.Directions = function (map) { var endpointDragCallback = function (dragging) { if (!map.hasLayer(polyline)) return; if (dragging && !chosenEngine.draggable) return; - if (dragging && awaitingRoute) return; + if (dragging && routeRequest) return; getRoute(false, !dragging); }; @@ -201,7 +201,7 @@ OSM.Directions = function (map) { function getRoute(fitRoute, reportErrors) { // Cancel any route that is already in progress - if (awaitingRoute) awaitingRoute.abort(); + if (routeRequest) routeRequest.abort(); // go fetch geocodes for any endpoints which have not already // been geocoded. @@ -235,8 +235,8 @@ OSM.Directions = function (map) { $("#sidebar_content").html($(".directions_form .loader_copy").html()); map.setSidebarOverlaid(false); - awaitingRoute = chosenEngine.getRoute([o, d], function (err, route) { - awaitingRoute = null; + routeRequest = chosenEngine.getRoute([o, d], function (err, route) { + routeRequest = null; if (err) { map.removeLayer(polyline);