Clear old routes when the route panel is reopened

This commit is contained in:
Tom Hughes 2015-02-01 12:50:17 +00:00
parent 44a0835487
commit a2527b79ff

View file

@ -55,12 +55,13 @@ OSM.Directions = function (map) {
// make text the same in both text boxes // make text the same in both text boxes
var value = e.target.value; var value = e.target.value;
endpoint.setValue(value) endpoint.setValue(value)
endpoint.getGeocode();
}); });
endpoint.setValue = function(value) { endpoint.setValue = function(value) {
endpoint.value = value; endpoint.value = value;
delete endpoint.latlng;
input.val(value); input.val(value);
endpoint.getGeocode();
} }
endpoint.getGeocode = function() { endpoint.getGeocode = function() {
@ -338,6 +339,10 @@ OSM.Directions = function (map) {
if (params.from) { if (params.from) {
endpoints[0].setValue(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(',')), var o = route[0] && L.latLng(route[0].split(',')),