mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 14:38:05 +02:00
Add flip horizontal/vertical operations
This commit is contained in:
@@ -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;
|
||||
}
|
||||
@@ -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