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

View File

@@ -106,11 +106,14 @@ en:
not_connected: There aren't enough lines/areas here to disconnect.
connected_to_hidden: This can't be disconnected because it is connected to a hidden feature.
relation: This can't be disconnected because it connects members of a relation.
flip:
flipHorizontal:
title: Flip Horizontal
description: Flip this area horizontally.
key: F
annotation: Flipped an area horizontally.
flipVertical:
title: Flip Vertical
description: Flip this area vertically.
annotation: Flipped an area vertically.
merge:
title: Merge
description: Merge these features.

View File

@@ -137,12 +137,16 @@
"connected_to_hidden": "This can't be disconnected because it is connected to a hidden feature.",
"relation": "This can't be disconnected because it connects members of a relation."
},
"flip": {
"flipHorizontal": {
"title": "Flip Horizontal",
"description": "Flip this area horizontally.",
"key": "F",
"annotation": "Flipped an area horizontally."
},
"flipVertical": {
"title": "Flip Vertical",
"description": "Flip this area vertically.",
"annotation": "Flipped an area vertically."
},
"merge": {
"title": "Merge",
"description": "Merge these features.",

View File

@@ -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;
}

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;
}

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';