From e3ea4b84840015e9ec30c4c9dc83d1c9b4b62103 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Mon, 6 May 2019 12:57:29 -0400 Subject: [PATCH] Additional improvements to unsquare_way validation (re: #6288) - use default params for actionOrthogonalize, not relaxed epsilon - only allow autofix if there are no extra tags on the building (e.g. source) --- modules/validations/unsquare_way.js | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/modules/validations/unsquare_way.js b/modules/validations/unsquare_way.js index 076b5a920..246f59bff 100644 --- a/modules/validations/unsquare_way.js +++ b/modules/validations/unsquare_way.js @@ -48,8 +48,14 @@ export function validationUnsquareWay() { var points = nodes.map(function(node) { return context.projection(node.loc); }); if (!geoOrthoCanOrthogonalize(points, isClosed, epsilon, degreeThreshold, true)) return []; - var action = actionOrthogonalize(entity.id, context.projection, undefined, epsilon, degreeThreshold); - action.transitionable = false; // do it instantly + // only allow autofix if there are no extra tags on the building (e.g. source) - #6288 + var autoArgs; + if (Object.keys(entity.tags).length === 1) { + // note: use default params for actionOrthogonalize, not relaxed epsilon + var autoAction = actionOrthogonalize(entity.id, context.projection); + action.transitionable = false; // when autofixing, do it instantly + autoArgs = [autoAction, t('operations.orthogonalize.annotation.area')]; + } return [new validationIssue({ type: type, @@ -63,9 +69,13 @@ export function validationUnsquareWay() { new validationIssueFix({ icon: 'iD-operation-orthogonalize', title: t('issues.fix.square_feature.title'), - autoArgs: [action, t('operations.orthogonalize.annotation.area')], + autoArgs: autoArgs, onClick: function() { - context.perform(action, t('operations.orthogonalize.annotation.area')); + // note: use default params for actionOrthogonalize, not relaxed epsilon + context.perform( + actionOrthogonalize(entity.id, context.projection), + t('operations.orthogonalize.annotation.area') + ); } }) ]