1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

simplify code structure

This commit is contained in:
Hiroyasu Nishiyama 2020-05-28 10:23:50 +09:00
parent 05f816fc5d
commit 3345f2f3b8

View File

@ -1943,14 +1943,10 @@ if (DEBUG_EVENTS) { console.warn("clearSelection", mouse_mode); }
if (moving_set.length > 0) { if (moving_set.length > 0) {
for (var i=0;i<moving_set.length;i++) { for (var i=0;i<moving_set.length;i++) {
var node = moving_set[i].n; var node = moving_set[i].n;
node.selected = false;
if (node.type === "group") { if (node.type === "group") {
selectedGroups.push(node); selectedGroups.push(node);
} } else if (node.type != "subflow") {
}
for (var i=0;i<moving_set.length;i++) {
var node = moving_set[i].n;
node.selected = false;
if ((node.type !== "group") && (node.type != "subflow")) {
if (node.x < 0) { if (node.x < 0) {
node.x = 25 node.x = 25
} }
@ -1960,14 +1956,9 @@ if (DEBUG_EVENTS) { console.warn("clearSelection", mouse_mode); }
removedLinks = removedLinks.concat(removedEntities.links); removedLinks = removedLinks.concat(removedEntities.links);
if (node.g) { if (node.g) {
var group = RED.nodes.group(node.g); var group = RED.nodes.group(node.g);
if (!group.selected || group.active) { if ((!group.selected || group.active) && (selectedGroups.indexOf(group) < 0)) {
var isSelectedGroup = selectedGroups.find(function (ng) { RED.group.removeFromGroup(group,node);
return (ng.id === node.g); node.g = group.id;
});
if (!isSelectedGroup) {
RED.group.removeFromGroup(group,node);
node.g = group.id;
}
} }
} }
} else { } else {