diff --git a/js/id/behavior/select.js b/js/id/behavior/select.js index 3f7961974..9d30236bb 100644 --- a/js/id/behavior/select.js +++ b/js/id/behavior/select.js @@ -22,8 +22,8 @@ iD.behavior.Select = function(context) { function mousedown() { var datum = d3.event.target.__data__; + pos = [d3.event.x, d3.event.y]; if (datum instanceof iD.Entity || (datum && datum.type === 'midpoint')) { - pos = [d3.event.x, d3.event.y]; selection .on('mousemove.select', mousemove) .on('touchmove.select', mousemove); @@ -46,8 +46,6 @@ iD.behavior.Select = function(context) { // save the event for the click handler })(d3.event), 200); } - } else { - context.enter(iD.modes.Browse(context)); } } @@ -61,6 +59,10 @@ iD.behavior.Select = function(context) { function mouseup() { selection.on('mousemove.select', null); + if (d3.event.x === pos[0] && d3.event.y === pos[1] && + !(d3.event.target.__data__ instanceof iD.Entity)) { + context.enter(iD.modes.Browse(context)); + } } selection diff --git a/js/id/modes/select.js b/js/id/modes/select.js index 95eb3e78a..5732b58df 100644 --- a/js/id/modes/select.js +++ b/js/id/modes/select.js @@ -9,6 +9,7 @@ iD.modes.Select = function(context, selection, initial) { behaviors = [ iD.behavior.Hover(), iD.behavior.Select(context), + iD.behavior.Lasso(context), iD.behavior.DragNode(context)], radialMenu; diff --git a/test/spec/behavior/select.js b/test/spec/behavior/select.js index cfb7b95b1..5e9bf9ea3 100644 --- a/test/spec/behavior/select.js +++ b/test/spec/behavior/select.js @@ -42,6 +42,7 @@ describe("iD.behavior.Select", function() { context.enter(iD.modes.Select(context, [a.id])); happen.click(context.surface().node()); happen.mousedown(context.surface().node()); + happen.mouseup(context.surface().node()); window.setTimeout(function() { expect(context.selection()).to.eql([]); done();