From: Tom Hughes Date: Fri, 28 Mar 2014 22:48:22 +0000 (+0000) Subject: Remove highlight from map when clicking on a feature X-Git-Tag: live~4326^2~12 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/ca07fe853cd743f6d17ebcd02b6e8794e548e2a4?hp=8642e4c1f337c5088c84b2d3a6c0448ef704ed40 Remove highlight from map when clicking on a feature --- diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index 2a84207ec..0edc265dc 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -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); }