Skip to content

Commit

Permalink
Don't reenter Browse mode on every click
Browse files Browse the repository at this point in the history
  • Loading branch information
bhousel authored and paulmach committed Jun 8, 2015
1 parent 0fb2574 commit df39899
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions js/id/behavior/select.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,20 @@ iD.behavior.Select = function(context) {
}

function click() {
var datum = d3.event.target.__data__;
var lasso = d3.select('#surface .lasso').node();
var datum = d3.event.target.__data__,
lasso = d3.select('#surface .lasso').node(),
mode = context.mode();

if (!(datum instanceof iD.Entity)) {
if (!d3.event.shiftKey && !lasso)
if (!d3.event.shiftKey && !lasso && mode.id !== 'browse')
context.enter(iD.modes.Browse(context));

} else if (!d3.event.shiftKey && !lasso) {
// Avoid re-entering Select mode with same entity.
if (context.selectedIDs().length !== 1 || context.selectedIDs()[0] !== datum.id) {
context.enter(iD.modes.Select(context, [datum.id]));
} else {
context.mode().suppressMenu(false).reselect();
mode.suppressMenu(false).reselect();
}
} else if (context.selectedIDs().indexOf(datum.id) >= 0) {
var selectedIDs = _.without(context.selectedIDs(), datum.id);
Expand Down

0 comments on commit df39899

Please sign in to comment.