mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-23 08:39:56 +02:00
988bfeb767
Also show correct key in operation tooltip.
35 lines
989 B
JavaScript
35 lines
989 B
JavaScript
iD.operations.Merge = function(selection, context) {
|
|
var join = iD.actions.Join(selection),
|
|
merge = iD.actions.Merge(selection);
|
|
|
|
var operation = function() {
|
|
var annotation = t('operations.merge.annotation', {n: selection.length}),
|
|
action;
|
|
|
|
if (join.enabled(context.graph())) {
|
|
action = join;
|
|
} else {
|
|
action = merge;
|
|
}
|
|
|
|
var difference = context.perform(action, annotation);
|
|
context.enter(iD.modes.Select(context, difference.extantIDs()));
|
|
};
|
|
|
|
operation.available = function() {
|
|
return selection.length >= 2;
|
|
};
|
|
|
|
operation.enabled = function() {
|
|
return join.enabled(context.graph()) ||
|
|
merge.enabled(context.graph());
|
|
};
|
|
|
|
operation.id = "merge";
|
|
operation.keys = [t('operations.merge.key')];
|
|
operation.title = t('operations.merge.title');
|
|
operation.description = t('operations.merge.description');
|
|
|
|
return operation;
|
|
};
|