X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/d3ab0c9a8a01161a5f701e3fafbc16d08716dd40..f9ea6aa718a5babc16bb5195098b504a1bd43e32:/app/assets/javascripts/index/directions.js diff --git a/app/assets/javascripts/index/directions.js b/app/assets/javascripts/index/directions.js index 8d9263323..ae01cb566 100644 --- a/app/assets/javascripts/index/directions.js +++ b/app/assets/javascripts/index/directions.js @@ -25,10 +25,13 @@ OSM.Directions = function (map) { getRoute(false, !dragging); } }; + var endpointGeocodeCallback = function () { + getRoute(true, true); + }; var endpoints = [ - Endpoint($("input[name='route_from']"), OSM.MARKER_GREEN, endpointDragCallback), - Endpoint($("input[name='route_to']"), OSM.MARKER_RED, endpointDragCallback) + Endpoint($("input[name='route_from']"), OSM.MARKER_GREEN, endpointDragCallback, endpointGeocodeCallback), + Endpoint($("input[name='route_to']"), OSM.MARKER_RED, endpointDragCallback, endpointGeocodeCallback) ]; var expiry = new Date(); @@ -48,7 +51,7 @@ OSM.Directions = function (map) { select.append(""); }); - function Endpoint(input, iconUrl, dragCallback) { + function Endpoint(input, iconUrl, dragCallback, geocodeCallback) { var endpoint = {}; endpoint.marker = L.marker([0, 0], { @@ -119,7 +122,7 @@ OSM.Directions = function (map) { input.val(json[0].display_name); - getRoute(true, true); + geocodeCallback(); }); };