Files
iD/js/id/operations/split.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

25 lines
692 B
JavaScript

iD.operations.Split = function(selection, context) {
var entityId = selection[0],
action = iD.actions.SplitWay(entityId);
var operation = function() {
context.perform(action, t('operations.split.annotation'));
};
operation.available = function() {
return selection.length === 1 &&
context.geometry(entityId) === 'vertex';
};
operation.enabled = function() {
return action.enabled(context.graph());
};
operation.id = "split";
operation.key = t('operations.split.key');
operation.title = t('operations.split.title');
operation.description = t('operations.split.description');
return operation;
};