mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
fix conversion of junction to subflow
This commit is contained in:
@@ -738,6 +738,10 @@ RED.nodes = (function() {
|
||||
moveGroupToTab(node,z);
|
||||
return;
|
||||
}
|
||||
if (node.type === "junction") {
|
||||
moveJunctionToTab(node,z);
|
||||
return;
|
||||
}
|
||||
var oldZ = node.z;
|
||||
allNodes.moveNode(node,z);
|
||||
var nl = nodeLinks[node.id];
|
||||
@@ -772,6 +776,38 @@ RED.nodes = (function() {
|
||||
RED.events.emit("groups:change",group);
|
||||
}
|
||||
|
||||
function moveJunctionToTab(junction, z) {
|
||||
var index = junctionsByZ[junction.z].indexOf(junction);
|
||||
junctionsByZ[junction.z].splice(junction,1);
|
||||
junctionsByZ[z] = junctionsByZ[z] || [];
|
||||
junctionsByZ[z].push(junction);
|
||||
junction.z = z;
|
||||
|
||||
var oldZ = junction.z;
|
||||
var nl = nodeLinks[junction.id];
|
||||
if (nl) {
|
||||
nl.in.forEach(function(l) {
|
||||
var idx = linkTabMap[oldZ].indexOf(l);
|
||||
if (idx != -1) {
|
||||
linkTabMap[oldZ].splice(idx, 1);
|
||||
}
|
||||
if ((l.source.z === z) && linkTabMap[z]) {
|
||||
linkTabMap[z].push(l);
|
||||
}
|
||||
});
|
||||
nl.out.forEach(function(l) {
|
||||
var idx = linkTabMap[oldZ].indexOf(l);
|
||||
if (idx != -1) {
|
||||
linkTabMap[oldZ].splice(idx, 1);
|
||||
}
|
||||
if ((l.target.z === z) && linkTabMap[z]) {
|
||||
linkTabMap[z].push(l);
|
||||
}
|
||||
});
|
||||
}
|
||||
RED.events.emit("junctions:change",junction);
|
||||
}
|
||||
|
||||
function removeLink(l) {
|
||||
var index = links.indexOf(l);
|
||||
if (index != -1) {
|
||||
|
||||
Reference in New Issue
Block a user