//= require_self
-//= require_tree ./directions_engines
+//= require_tree ./directions
OSM.Directions = function (map) {
var awaitingGeocode; // true if the user has requested a route, but we're waiting on a geocode result
// make text the same in both text boxes
var value = e.target.value;
endpoint.setValue(value)
- endpoint.getGeocode();
});
endpoint.setValue = function(value) {
endpoint.value = value;
+ delete endpoint.latlng;
input.val(value);
+ endpoint.getGeocode();
}
endpoint.getGeocode = function() {
$(".directions_form a.directions_close").on("click", function(e) {
e.preventDefault();
- var route_from = endpoint[0].value;
+ var route_from = endpoints[0].value;
if (route_from) {
OSM.router.route("/?query=" + encodeURIComponent(route_from) + OSM.formatHash(map));
} else {
if (params.from) {
endpoints[0].setValue(params.from);
+ endpoints[1].setValue("");
+ } else {
+ endpoints[0].setValue("");
+ endpoints[1].setValue("");
}
var o = route[0] && L.latLng(route[0].split(',')),