From 3e7594340585034ec2e9cad0e88591f8d709c17b Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Tue, 2 Apr 2013 13:21:32 -0400 Subject: [PATCH] block quick second click when drawing - doubleclicking to add point doesn't zoom - doubleclicking on last node selects way, not node fixes #1233 --- js/id/behavior/draw.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/js/id/behavior/draw.js b/js/id/behavior/draw.js index 0a2816943..3c5d1243d 100644 --- a/js/id/behavior/draw.js +++ b/js/id/behavior/draw.js @@ -33,13 +33,20 @@ iD.behavior.Draw = function(context) { if (iD.geo.dist(pos, point()) < closeTolerance || (iD.geo.dist(pos, point()) < tolerance && (+new Date() - time) < 500)) { - click(); - } - if (eventTarget === d3.event.target) { - d3.select(window).on('click.draw', function() { - d3.select(window).on('click.draw', null); + + // Prevent a quick second click + d3.select(window).on('click.draw-block', function() { d3.event.stopPropagation(); }, true); + + context.map().dblclickEnable(false); + + window.setTimeout(function() { + context.map().dblclickEnable(true); + d3.select(window).on('click.draw-block', null); + }, 500); + + click(); } }); }