From 86928bbb2d41c3a927a25cd7c3d5b7d003e99950 Mon Sep 17 00:00:00 2001 From: Hiroyasu Nishiyama Date: Fri, 26 Jul 2019 23:06:56 +0900 Subject: [PATCH] fix converting selection to subflow --- .../@node-red/editor-client/src/js/nodes.js | 13 +++++++++++++ .../@node-red/editor-client/src/js/ui/subflow.js | 2 +- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/nodes.js b/packages/node_modules/@node-red/editor-client/src/js/nodes.js index 63027aed1..c14126a00 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/nodes.js +++ b/packages/node_modules/@node-red/editor-client/src/js/nodes.js @@ -301,6 +301,17 @@ RED.nodes = (function() { return {links:removedLinks,nodes:removedNodes}; } + function moveNodeToTab(node, z) { + if (nodeTabMap[node.z]) { + delete nodeTabMap[node.z][node.id]; + } + if (!nodeTabMap[z]) { + nodeTabMap[z] = {}; + } + nodeTabMap[z][node.iz] = node; + node.z = z; + } + function removeLink(l) { var index = links.indexOf(l); if (index != -1) { @@ -1466,6 +1477,8 @@ RED.nodes = (function() { remove: removeNode, clear: clear, + moveNodeToTab: moveNodeToTab, + addLink: addLink, removeLink: removeLink, diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js b/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js index e136f7df6..a8be067d6 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/subflow.js @@ -723,7 +723,7 @@ RED.subflow = (function() { } n.x -= offsetX; n.y -= offsetY; - n.z = subflow.id; + RED.nodes.moveNodeToTab(n, subflow.id); } RED.history.push({