Start iD.operations.Merge (#435)

It's currently limited to merging (joining) exactly two lines.

Fixes #370.
This commit is contained in:
John Firebaugh
2013-02-01 17:28:50 -05:00
parent a8410be6eb
commit f5036db978
4 changed files with 35 additions and 0 deletions
+27
View File
@@ -0,0 +1,27 @@
iD.operations.Merge = function(selection, context) {
var action = iD.actions.Join(selection[0], selection[1]);
var operation = function() {
context.perform(
action,
t('operations.merge.annotation', {n: selection.length}));
};
operation.available = function() {
return selection.length === 2 &&
_.all(selection, function (id) {
return context.geometry(id) === 'line';
});
};
operation.enabled = function() {
return action.enabled(context.graph());
};
operation.id = "merge";
operation.key = t('operations.merge.key');
operation.title = t('operations.merge.title');
operation.description = t('operations.merge.description');
return operation;
};