From 246481ad9262ea2a71316fa55ebd04cf24bc071b Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Wed, 6 Feb 2013 18:53:46 -0500 Subject: [PATCH] Switch back to mouseup, and block following click --- js/id/behavior/draw.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/js/id/behavior/draw.js b/js/id/behavior/draw.js index b0da771a4..6b1b7ff0a 100644 --- a/js/id/behavior/draw.js +++ b/js/id/behavior/draw.js @@ -27,13 +27,19 @@ iD.behavior.Draw = function(context) { target.on('mousemove.draw', null); - d3.select(window).on('click.draw', function() { + d3.select(window).on('mouseup.draw', function() { target.on('mousemove.draw', mousemove); if (iD.geo.dist(pos, point()) < closeTolerance || (iD.geo.dist(pos, point()) < tolerance && (+new Date() - time) < 500)) { click(); } + if (target.node() === d3.event.target) { + d3.select(window).on('click.draw', function() { + d3.select(window).on('click.draw', null); + d3.event.stopPropagation(); + }); + } }); } @@ -110,7 +116,7 @@ iD.behavior.Draw = function(context) { .on('mousedown.draw', null) .on('mousemove.draw', null); - d3.select(window).on('click.draw', null); + d3.select(window).on('mouseup.draw', null); d3.select(document) .call(keybinding.off)