From 7edebb897f5d943b53eb65d6544cd7e45e0d0dc6 Mon Sep 17 00:00:00 2001 From: J Guthrie Date: Mon, 8 Apr 2019 12:41:05 +0100 Subject: [PATCH] Only allow disconnect when selected ways relate to selected node --- modules/operations/disconnect.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/operations/disconnect.js b/modules/operations/disconnect.js index b9ede9fd3..fa3d78473 100644 --- a/modules/operations/disconnect.js +++ b/modules/operations/disconnect.js @@ -8,6 +8,10 @@ export function operationDisconnect(selectedIDs, context) { return context.geometry(id) === 'vertex'; }); + var ways = selectedIDs.filter(function(id) { + return context.geometry(id) !== 'vertex'; + }); + var entityID = vertices[0]; var action = actionDisconnect(entityID); @@ -23,7 +27,7 @@ export function operationDisconnect(selectedIDs, context) { operation.available = function() { - return vertices.length === 1; + return vertices.length === 1 && ways.every(function(way) { return context.graph().entity(way).nodes.includes(vertices[0]); }); };