From 5b646b75c322124f122a2508a246ceec9ac7944a Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Fri, 8 Feb 2013 17:53:43 -0500 Subject: [PATCH] Only lasso if mouse has moved --- js/id/behavior/lasso.js | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/js/id/behavior/lasso.js b/js/id/behavior/lasso.js index 3986b5cf2..e99b1bf14 100644 --- a/js/id/behavior/lasso.js +++ b/js/id/behavior/lasso.js @@ -10,6 +10,8 @@ iD.behavior.Lasso = function(context) { function mousedown() { if (d3.event.shiftKey === true) { + pos = [d3.event.x, d3.event.y]; + lasso = iD.ui.lasso().a(d3.mouse(context.surface().node())); context.surface().call(lasso); @@ -35,20 +37,23 @@ iD.behavior.Lasso = function(context) { } function mouseup() { + var extent = iD.geo.Extent( normalize(context.projection.invert(lasso.a()), context.projection.invert(lasso.b()))); lasso.close(); - var selected = context.graph().intersects(extent); - selection .on('mousemove.lasso', null) .on('mouseup.lasso', null); - if (selected.length) { - context.enter(iD.modes.Select(context, _.pluck(selected, 'id'))); + if (d3.event.x !== pos[0] || d3.event.y !== pos[1]) { + var selected = context.graph().intersects(extent); + + if (selected.length) { + context.enter(iD.modes.Select(context, _.pluck(selected, 'id'))); + } } }