X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/50ea797f33409aecb6061f3f6baceb5c499edb2a..a70b61315c2331c18123a0b36782d6ef6bb3ab3e:/app/assets/javascripts/index/query.js diff --git a/app/assets/javascripts/index/query.js b/app/assets/javascripts/index/query.js index 58750d242..e2c8699ff 100644 --- a/app/assets/javascripts/index/query.js +++ b/app/assets/javascripts/index/query.js @@ -22,9 +22,9 @@ OSM.Query = function(map) { if (queryButton.hasClass("disabled")) return; if (queryButton.hasClass("active")) { - disableQueryMode(); - - OSM.router.route("/"); + if ($("#content").hasClass("overlay-sidebar")) { + disableQueryMode(); + } } else { enableQueryMode(); } @@ -53,10 +53,20 @@ OSM.Query = function(map) { if (geometry) map.removeLayer(geometry); $(this).removeClass("selected"); }) - .on("click", ".query-results li.query-result", function (e) { - if (!$(e.target).is('a')) { - $(this).find("a").simulate("click", e); - } + .on("mousedown", ".query-results li.query-result", function (e) { + var moved = false; + $(this).one("click", function (e) { + if (!moved) { + var geometry = $(this).data("geometry") + if (geometry) map.removeLayer(geometry); + + if (!$(e.target).is('a')) { + $(this).find("a").simulate("click", e); + } + } + }).one("mousemove", function () { + moved = true; + }); }); function interestingFeature(feature, origin, radius) {