Rename variable to avoid confusion in view.js

This commit is contained in:
Nick O'Leary 2024-11-18 16:20:58 +00:00
parent 47e1389548
commit 4cb3ccc984
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -2689,22 +2689,21 @@ RED.view = (function() {
addToRemovedLinks(reconnectResult.removedLinks) addToRemovedLinks(reconnectResult.removedLinks)
} }
var startDirty = RED.nodes.dirty(); const startDirty = RED.nodes.dirty();
var startChanged = false; let movingSelectedGroups = [];
var selectedGroups = [];
if (movingSet.length() > 0) { if (movingSet.length() > 0) {
for (var i=0;i<movingSet.length();i++) { for (var i=0;i<movingSet.length();i++) {
node = movingSet.get(i).n; node = movingSet.get(i).n;
if (node.type === "group") { if (node.type === "group") {
selectedGroups.push(node); movingSelectedGroups.push(node);
} }
} }
// Make sure we have identified all groups about to be deleted // Make sure we have identified all groups about to be deleted
for (i=0;i<selectedGroups.length;i++) { for (i=0;i<movingSelectedGroups.length;i++) {
selectedGroups[i].nodes.forEach(function(n) { movingSelectedGroups[i].nodes.forEach(function(n) {
if (n.type === "group" && selectedGroups.indexOf(n) === -1) { if (n.type === "group" && movingSelectedGroups.indexOf(n) === -1) {
selectedGroups.push(n); movingSelectedGroups.push(n);
} }
}) })
} }
@ -2721,7 +2720,7 @@ RED.view = (function() {
addToRemovedLinks(removedEntities.links); addToRemovedLinks(removedEntities.links);
if (node.g) { if (node.g) {
var group = RED.nodes.group(node.g); var group = RED.nodes.group(node.g);
if (selectedGroups.indexOf(group) === -1) { if (movingSelectedGroups.indexOf(group) === -1) {
// Don't use RED.group.removeFromGroup as that emits // Don't use RED.group.removeFromGroup as that emits
// a change event on the node - but we're deleting it // a change event on the node - but we're deleting it
var index = group.nodes.indexOf(node); var index = group.nodes.indexOf(node);
@ -2735,7 +2734,7 @@ RED.view = (function() {
removedLinks = removedLinks.concat(result.links); removedLinks = removedLinks.concat(result.links);
if (node.g) { if (node.g) {
var group = RED.nodes.group(node.g); var group = RED.nodes.group(node.g);
if (selectedGroups.indexOf(group) === -1) { if (movingSelectedGroups.indexOf(group) === -1) {
// Don't use RED.group.removeFromGroup as that emits // Don't use RED.group.removeFromGroup as that emits
// a change event on the node - but we're deleting it // a change event on the node - but we're deleting it
var index = group.nodes.indexOf(node); var index = group.nodes.indexOf(node);
@ -2757,8 +2756,8 @@ RED.view = (function() {
// Groups must be removed in the right order - from inner-most // Groups must be removed in the right order - from inner-most
// to outermost. // to outermost.
for (i = selectedGroups.length-1; i>=0; i--) { for (i = movingSelectedGroups.length-1; i>=0; i--) {
var g = selectedGroups[i]; var g = movingSelectedGroups[i];
removedGroups.push(g); removedGroups.push(g);
RED.nodes.removeGroup(g); RED.nodes.removeGroup(g);
} }