mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-09 03:25:37 +02:00
33 lines
966 B
JavaScript
33 lines
966 B
JavaScript
iD.operations.Split = function(selection, context) {
|
|
var entityId = selection[0],
|
|
action = iD.actions.Split(entityId);
|
|
|
|
var operation = function() {
|
|
var annotation = t('operations.split.annotation'),
|
|
difference = context.perform(action, annotation);
|
|
context.enter(iD.modes.Select(context, difference.extantIDs()));
|
|
};
|
|
|
|
operation.available = function() {
|
|
return selection.length === 1 &&
|
|
context.geometry(entityId) === 'vertex';
|
|
};
|
|
|
|
operation.disabled = function() {
|
|
return action.disabled(context.graph());
|
|
};
|
|
|
|
operation.tooltip = function() {
|
|
var disable = operation.disabled();
|
|
return disable ?
|
|
t('operations.split.' + disable) :
|
|
t('operations.split.description');
|
|
};
|
|
|
|
operation.id = "split";
|
|
operation.keys = [t('operations.split.key')];
|
|
operation.title = t('operations.split.title');
|
|
|
|
return operation;
|
|
};
|