From e8a227fc59fff5034d1a4d2682617d6cd01ae713 Mon Sep 17 00:00:00 2001 From: Quincy Morgan Date: Mon, 8 Jun 2020 10:08:52 -0400 Subject: [PATCH] Allow straightening a selected line between two points if the two points are visible, regardless of how long the line is --- modules/operations/straighten.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/modules/operations/straighten.js b/modules/operations/straighten.js index d685df4cd..cc6293255 100644 --- a/modules/operations/straighten.js +++ b/modules/operations/straighten.js @@ -64,6 +64,13 @@ export function operationStraighten(context, selectedIDs) { wayNodeIDs.indexOf(nodeIDs[0]) === -1 || wayNodeIDs.indexOf(nodeIDs[1]) === -1 )) return null; + if (nodeIDs.length) { + // If we're only straightenting between two points, we only need that extent visible + extent = utilGetAllNodes(nodeIDs, context.graph()).reduce(function(extent, node) { + return extent.extend(node.extent(context.graph())); + }, geoExtent()); + } + geometry = wayIDs.length === 1 ? 'line' : 'lines'; return actionStraightenWay(selectedIDs, context.projection); }