mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-05 02:41:21 +00:00
23 lines
551 B
JavaScript
23 lines
551 B
JavaScript
iD.behavior.Select = function(mode) {
|
|
var controller = mode.controller;
|
|
|
|
function click() {
|
|
var datum = d3.select(d3.event.target).datum();
|
|
if (datum instanceof iD.Entity) {
|
|
controller.enter(iD.modes.Select([datum.id]));
|
|
} else {
|
|
controller.enter(iD.modes.Browse());
|
|
}
|
|
}
|
|
|
|
var behavior = function(selection) {
|
|
selection.on('click.select', click);
|
|
};
|
|
|
|
behavior.off = function(selection) {
|
|
selection.on('click.select', null);
|
|
};
|
|
|
|
return behavior;
|
|
};
|