block quick second click when drawing

- doubleclicking to add point doesn't zoom
- doubleclicking on last node selects way, not node

fixes #1233
This commit is contained in:
Ansis Brammanis
2013-04-02 13:21:32 -04:00
parent 7a5fca1e8a
commit 3e75943405
+12 -5
View File
@@ -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();
}
});
}