From: Tom Hughes Date: Mon, 31 Mar 2014 10:25:40 +0000 (+0100) Subject: Ignore clicks on history entries if the mouse has moved X-Git-Tag: live~4428 X-Git-Url: https://git.openstreetmap.org/rails.git/commitdiff_plain/883a375d1a06f7215c0e929a0bf5dd566c9462cc?hp=5c58f00c2e80bfe0e5b0665b74e5a973fabb2db4 Ignore clicks on history entries if the mouse has moved Ignore click events on history events if the mouse moves so that drag selection can work. Fixes #581. --- diff --git a/app/assets/javascripts/index/history.js b/app/assets/javascripts/index/history.js index 8103f047e..cb1f6f8d5 100644 --- a/app/assets/javascripts/index/history.js +++ b/app/assets/javascripts/index/history.js @@ -11,10 +11,15 @@ OSM.History = function(map) { .on("mouseout", "[data-changeset]", function () { unHighlightChangeset($(this).data("changeset").id); }) - .on("click", "[data-changeset]", function (e) { - if (!$(e.target).is('a')) { - clickChangeset($(this).data("changeset").id, e); - } + .on("mousedown", "[data-changeset]", function () { + var moved = false; + $(this).one("click", function (e) { + if (!moved && !$(e.target).is('a')) { + clickChangeset($(this).data("changeset").id, e); + } + }).one("mousemove", function () { + moved = true; + }); }); var group = L.featureGroup()