mirror of
https://github.com/FoggedLens/iD.git
synced 2026-03-07 11:51:35 +00:00
Add flip horizontal/vertical operations
This commit is contained in:
@@ -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.
|
||||
|
||||
8
dist/locales/en.json
vendored
8
dist/locales/en.json
vendored
@@ -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.",
|
||||
|
||||
@@ -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
modules/operations/flipVertical.js
Normal file
32
modules/operations/flipVertical.js
Normal 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;
|
||||
}
|
||||
@@ -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';
|
||||
Reference in New Issue
Block a user