mirror of
https://github.com/FoggedLens/iD.git
synced 2026-05-24 00:54:03 +02:00
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)
This commit is contained in:
@@ -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')
|
||||
);
|
||||
}
|
||||
})
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user