mirror of
https://github.com/FoggedLens/iD.git
synced 2026-06-05 22:46:38 +02:00
Rename for consistency, add logic to prevent flip if all of object not visible and if linked to hidden. Label does not render for message when not enabled
This commit is contained in:
@@ -31,4 +31,4 @@ export { actionRotateWay } from './rotate_way';
|
||||
export { actionSplit } from './split';
|
||||
export { actionStraighten } from './straighten';
|
||||
export { actionUnrestrictTurn } from './unrestrict_turn';
|
||||
export { actionReflect } from './flip';
|
||||
export { actionReflect } from './reflect.js';
|
||||
|
||||
@@ -3,7 +3,7 @@ import _ from 'lodash';
|
||||
Only operates on "area" ways
|
||||
*/
|
||||
|
||||
export function actionFlip(wayId) {
|
||||
export function actionReflect(wayId) {
|
||||
|
||||
return function (graph) {
|
||||
const targetWay = graph.entity(wayId);
|
||||
@@ -9,3 +9,4 @@ export { operationReverse } from './reverse';
|
||||
export { operationRotate } from './rotate';
|
||||
export { operationSplit } from './split';
|
||||
export { operationStraighten } from './straighten';
|
||||
export { operationReflect } from './reflect';
|
||||
@@ -2,11 +2,14 @@ import { t } from '../util/locale';
|
||||
import { actionReflect } from '../actions/index';
|
||||
|
||||
export function operationReflect(selectedIDs, context) {
|
||||
var entityId = selectedIDs[0];
|
||||
const entityId = selectedIDs[0];
|
||||
const entity = context.entity(entityId);
|
||||
const extent = entity.extent(context.graph());
|
||||
const action = actionReflect(entityId);
|
||||
|
||||
var operation = function() {
|
||||
context.perform(
|
||||
actionReflect(entityId, false),
|
||||
action,
|
||||
t('operations.reflect.annotation')
|
||||
);
|
||||
};
|
||||
@@ -17,7 +20,13 @@ export function operationReflect(selectedIDs, context) {
|
||||
};
|
||||
|
||||
operation.disabled = function() {
|
||||
return false;
|
||||
if (extent.percentContainedIn(context.extent()) < 0.8) {
|
||||
return 'too_large';
|
||||
} else if (context.hasHiddenConnections(entityId)) {
|
||||
return 'connected_to_hidden';
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
operation.tooltip = function() {
|
||||
|
||||
Reference in New Issue
Block a user