Add flip horizontal/vertical operations

This commit is contained in:
Jon D
2016-11-05 19:27:52 +00:00
parent dd16112aa3
commit f37475fad9
5 changed files with 51 additions and 17 deletions
@@ -1,38 +1,32 @@
import { t } from '../util/locale';
import { actionFlip } from '../actions/index';
export function operationFlip(selectedIDs, context) {
export function operationFlipHorizontal(selectedIDs, context) {
var entityId = selectedIDs[0];
var operation = function() {
context.perform(
actionFlip(entityId, false, context.projection),
t('operations.flip.annotation')
t('operations.flipHorizontal.annotation')
);
};
operation.available = function() {
return selectedIDs.length === 1 &&
context.geometry(entityId) === 'area';
};
operation.disabled = function() {
return false;
};
operation.tooltip = function() {
return t('operations.flip.description');
return t('operations.flipHorizontal.description');
};
operation.id = 'flip';
operation.keys = [t('operations.flip.key')];
operation.title = t('operations.flip.title');
operation.id = 'flipHorizontal';
operation.keys = [t('operations.flipHorizontal.key')];
operation.title = t('operations.flipHorizontal.title');
return operation;
}
+32
View File
@@ -0,0 +1,32 @@
import { t } from '../util/locale';
import { actionFlip } from '../actions/index';
export function operationFlipVertical(selectedIDs, context) {
var entityId = selectedIDs[0];
var operation = function() {
context.perform(
actionFlip(entityId, true, context.projection),
t('operations.flipVertical.annotation')
);
};
operation.available = function() {
return selectedIDs.length === 1 &&
context.geometry(entityId) === 'area';
};
operation.disabled = function() {
return false;
};
operation.tooltip = function() {
return t('operations.flipVertical.description');
};
operation.id = 'flipVertical';
operation.keys = [t('operations.flipVertical.key')];
operation.title = t('operations.flipVertical.title');
return operation;
}
+2 -1
View File
@@ -9,4 +9,5 @@ export { operationReverse } from './reverse';
export { operationRotate } from './rotate';
export { operationSplit } from './split';
export { operationStraighten } from './straighten';
export { operationFlip } from './flip';
export { operationFlipHorizontal } from './flipHorizontal';
export { operationFlipVertical } from './flipVertical';