Remove highlight from map when clicking on a feature
authorTom Hughes <tom@compton.nu>
Fri, 28 Mar 2014 22:48:22 +0000 (22:48 +0000)
committerTom Hughes <tom@compton.nu>
Fri, 28 Mar 2014 22:48:22 +0000 (22:48 +0000)
app/assets/javascripts/index/query.js

index 2a84207ec55fe9b35f800cfdc0064fc9829b8be8..0edc265dcbe3c43181326ed2bfe90ba11332074a 100644 (file)
@@ -54,6 +54,9 @@ OSM.Query = function(map) {
       $(this).removeClass("selected");
     })
     .on("click", ".query-results li.query-result", function (e) {
+      var geometry = $(this).data("geometry")
+      if (geometry) map.removeLayer(geometry);
+
       if (!$(e.target).is('a')) {
         $(this).find("a").simulate("click", e);
       }