Allow orthogonalize to work on unclosed lines

(re: 5093, but see comment
https://github.com/openstreetmap/iD/pull/5999#issuecomment-468535581)
This commit is contained in:
Bryan Housel
2019-02-28 23:12:04 -05:00
parent b47ab4ac50
commit bf02ead5cc

View File

@@ -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;