mirror of
https://github.com/FoggedLens/iD.git
synced 2026-02-13 17:23:02 +00:00
This is because, like tooltip(), it doesn't always make sense to call it, and it should never get called if the operation is not available.
41 lines
979 B
JavaScript
41 lines
979 B
JavaScript
import { t } from '../util/locale';
|
|
import { actionReverse } from '../actions/index';
|
|
import { behaviorOperation } from '../behavior/index';
|
|
|
|
|
|
export function operationReverse(selectedIDs, context) {
|
|
var entityId = selectedIDs[0];
|
|
|
|
var operation = function() {
|
|
context.perform(actionReverse(entityId), operation.annotation());
|
|
};
|
|
|
|
|
|
operation.available = function() {
|
|
return selectedIDs.length === 1 && context.geometry(entityId) === 'line';
|
|
};
|
|
|
|
|
|
operation.disabled = function() {
|
|
return false;
|
|
};
|
|
|
|
|
|
operation.tooltip = function() {
|
|
return t('operations.reverse.description');
|
|
};
|
|
|
|
|
|
operation.annotation = function() {
|
|
return t('operations.reverse.annotation');
|
|
};
|
|
|
|
|
|
operation.id = 'reverse';
|
|
operation.keys = [t('operations.reverse.key')];
|
|
operation.title = t('operations.reverse.title');
|
|
operation.behavior = behaviorOperation(context).which(operation);
|
|
|
|
return operation;
|
|
}
|