]> git.openstreetmap.org Git - rails.git/commitdiff
Clear old routes when the route panel is reopened
authorTom Hughes <tom@compton.nu>
Sun, 1 Feb 2015 12:50:17 +0000 (12:50 +0000)
committerTom Hughes <tom@compton.nu>
Sun, 1 Feb 2015 12:58:08 +0000 (12:58 +0000)
app/assets/javascripts/index/directions.js.erb

index 93767612bba5654624e3e3a6ae8e438a2098cab5..d18fba65b65ec0d69ac0e794231380c2e324f0a4 100644 (file)
@@ -55,12 +55,13 @@ OSM.Directions = function (map) {
       // 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() {
@@ -338,6 +339,10 @@ OSM.Directions = function (map) {
 
     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(',')),