mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 22:46:38 +02:00
Start iD.operations.Merge (#435)
It's currently limited to merging (joining) exactly two lines. Fixes #370.
This commit is contained in:
@@ -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;
|
||||
};
|
||||
Reference in New Issue
Block a user