Files
iD/js/id/behavior/select.js
John Firebaugh 7e68e8e114 Add iD.Context
This is a facade interface that ties together a bunch of
different internal objects and will make it easier to write
tests for behaviors, modes, and operations.
2013-02-01 12:40:15 -05:00

21 lines
525 B
JavaScript

iD.behavior.Select = function(context) {
function click() {
var datum = d3.select(d3.event.target).datum();
if (datum instanceof iD.Entity) {
context.enter(iD.modes.Select(context, [datum.id]));
} else {
context.enter(iD.modes.Browse(context));
}
}
var behavior = function(selection) {
selection.on('click.select', click);
};
behavior.off = function(selection) {
selection.on('click.select', null);
};
return behavior;
};