From 43f5386dad26b7d4e7fb7a2819cb42e2eea6a75f Mon Sep 17 00:00:00 2001 From: Quincy Morgan <2046746+quincylvania@users.noreply.github.com> Date: Wed, 2 Sep 2020 13:14:19 -0400 Subject: [PATCH] Ignore unaffected nodes when determining if Disconnect is disabled due to lack of visibility (close #7944) --- modules/operations/disconnect.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/operations/disconnect.js b/modules/operations/disconnect.js index 8f71731b1..b62c325c7 100644 --- a/modules/operations/disconnect.js +++ b/modules/operations/disconnect.js @@ -58,12 +58,13 @@ export function operationDisconnect(context, selectedIDs) { }); _nodes = utilGetAllNodes(_wayIDs, context.graph()); _coords = _nodes.map(function(n) { return n.loc; }); - _extent = utilTotalExtent(ways, context.graph()); // actions for connected nodes shared by at least two selected ways var sharedActions = []; + var sharedNodes = []; // actions for connected nodes var unsharedActions = []; + var unsharedNodes = []; _nodes.forEach(function(node) { var action = actionDisconnect(node.id).limitWays(_wayIDs); @@ -80,8 +81,10 @@ export function operationDisconnect(context, selectedIDs) { if (count > 1) { sharedActions.push(action); + sharedNodes.push(node); } else { unsharedActions.push(action); + unsharedNodes.push(node); } } }); @@ -92,11 +95,13 @@ export function operationDisconnect(context, selectedIDs) { if (sharedActions.length) { // if any nodes are shared, only disconnect the selected ways from each other _actions = sharedActions; + _extent = utilTotalExtent(sharedNodes, context.graph()); _descriptionID += 'conjoined'; _annotationID = 'from_each_other'; } else { // if no nodes are shared, disconnect the selected ways from all connected ways _actions = unsharedActions; + _extent = utilTotalExtent(unsharedNodes, context.graph()); if (_wayIDs.length === 1) { _descriptionID += context.graph().geometry(_wayIDs[0]); } else {