From 883a375d1a06f7215c0e929a0bf5dd566c9462cc Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Mon, 31 Mar 2014 11:25:40 +0100 Subject: [PATCH] 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. --- app/assets/javascripts/index/history.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) 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() -- 2.39.5