Remove some repeated-query funkiness
authorRichard Fairhurst <richard@systemeD.net>
Thu, 23 Jan 2014 22:53:07 +0000 (22:53 +0000)
committerRichard Fairhurst <richard@systemeD.net>
Thu, 23 Jan 2014 22:53:07 +0000 (22:53 +0000)
app/assets/javascripts/routing.js.erb

index 26d2a8b394053dfb6bea023658ad49d44657e172..b6bf9f4a0cac80fa3f0070f71155d2c1e6802715 100644 (file)
@@ -218,9 +218,11 @@ OSM.Routing=function(map,name,jqSearch) {
        
        r.close=function() {
                $("#content").addClass("overlay-sidebar");
-               var remove=[r.polyline,r.popup,r.marker_from,r.marker_to];
+               r.route_from=r.route_to=null;
+               $(".query_wrapper.routing input").val("");
+               var remove=['polyline','popup','marker_from','marker_to'];
                for (var i=0; i<remove.length; i++) {
-                       if (remove[i]) map.removeLayer(remove[i]);
+                       if (r[remove[i]]) { map.removeLayer(r[remove[i]]); r[remove[i]]=null; }
                }
        };