mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3653 from node-red-hitachi/fix-undo-junction-to-subflow
Fix undoing junction to subflow
This commit is contained in:
commit
6c49d1aa3f
@ -22,6 +22,14 @@ RED.history = (function() {
|
|||||||
var undoHistory = [];
|
var undoHistory = [];
|
||||||
var redoHistory = [];
|
var redoHistory = [];
|
||||||
|
|
||||||
|
function nodeOrJunction(id) {
|
||||||
|
var node = RED.nodes.node(id);
|
||||||
|
if (node) {
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
return RED.nodes.junction(id);
|
||||||
|
}
|
||||||
|
|
||||||
function undoEvent(ev) {
|
function undoEvent(ev) {
|
||||||
var i;
|
var i;
|
||||||
var len;
|
var len;
|
||||||
@ -514,6 +522,7 @@ RED.history = (function() {
|
|||||||
var z = ev.activeWorkspace;
|
var z = ev.activeWorkspace;
|
||||||
var fullNodeList = RED.nodes.filterNodes({z:ev.subflow.subflow.id});
|
var fullNodeList = RED.nodes.filterNodes({z:ev.subflow.subflow.id});
|
||||||
fullNodeList = fullNodeList.concat(RED.nodes.groups(ev.subflow.subflow.id))
|
fullNodeList = fullNodeList.concat(RED.nodes.groups(ev.subflow.subflow.id))
|
||||||
|
fullNodeList = fullNodeList.concat(RED.nodes.junctions(ev.subflow.subflow.id))
|
||||||
fullNodeList.forEach(function(n) {
|
fullNodeList.forEach(function(n) {
|
||||||
n.x += ev.subflow.offsetX;
|
n.x += ev.subflow.offsetX;
|
||||||
n.y += ev.subflow.offsetY;
|
n.y += ev.subflow.offsetY;
|
||||||
@ -523,7 +532,7 @@ RED.history = (function() {
|
|||||||
});
|
});
|
||||||
inverseEv.subflows = [];
|
inverseEv.subflows = [];
|
||||||
for (i=0;i<ev.nodes.length;i++) {
|
for (i=0;i<ev.nodes.length;i++) {
|
||||||
inverseEv.subflows.push(RED.nodes.node(ev.nodes[i]));
|
inverseEv.subflows.push(nodeOrJunction(ev.nodes[i]));
|
||||||
RED.nodes.remove(ev.nodes[i]);
|
RED.nodes.remove(ev.nodes[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user