From bf02ead5ccc9ed7d66f6671d45c0ddb416d9d047 Mon Sep 17 00:00:00 2001 From: Bryan Housel Date: Thu, 28 Feb 2019 23:12:04 -0500 Subject: [PATCH] Allow orthogonalize to work on unclosed lines (re: 5093, but see comment https://github.com/openstreetmap/iD/pull/5999#issuecomment-468535581) --- modules/operations/orthogonalize.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/modules/operations/orthogonalize.js b/modules/operations/orthogonalize.js index d4d7a6bf3..62b212c6e 100644 --- a/modules/operations/orthogonalize.js +++ b/modules/operations/orthogonalize.js @@ -6,11 +6,11 @@ import { behaviorOperation } from '../behavior/index'; export function operationOrthogonalize(selectedIDs, context) { - var entityId = selectedIDs[0], - entity = context.entity(entityId), - extent = entity.extent(context.graph()), - geometry = context.geometry(entityId), - action = actionOrthogonalize(entityId, context.projection); + var entityID = selectedIDs[0]; + var entity = context.entity(entityID); + var extent = entity.extent(context.graph()); + var geometry = context.geometry(entityID); + var action = actionOrthogonalize(entityID, context.projection); var operation = function() { @@ -21,7 +21,6 @@ export function operationOrthogonalize(selectedIDs, context) { operation.available = function() { return selectedIDs.length === 1 && entity.type === 'way' && - entity.isClosed() && _uniq(entity.nodes).length > 2; }; @@ -30,7 +29,7 @@ export function operationOrthogonalize(selectedIDs, context) { var reason; if (extent.percentContainedIn(context.extent()) < 0.8) { reason = 'too_large'; - } else if (context.hasHiddenConnections(entityId)) { + } else if (context.hasHiddenConnections(entityID)) { reason = 'connected_to_hidden'; } return action.disabled(context.graph()) || reason;