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

Merge branch 'master' into dev

This commit is contained in:
Nick O'Leary 2023-02-03 09:11:46 +00:00
commit 90d1bb0ae4
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -609,11 +609,28 @@ RED.view = (function() {
var group = $(ui.helper).data("group");
if (group) {
var oldX = group.x;
var oldY = group.y;
RED.group.addToGroup(group, nn);
var moveEvent = null;
if ((group.x !== oldX) ||
(group.y !== oldY)) {
moveEvent = {
t: "move",
nodes: [{n: group,
ox: oldX, oy: oldY,
dx: group.x -oldX,
dy: group.y -oldY}],
dirty: true
};
}
historyEvent = {
t: 'multi',
events: [historyEvent],
};
if (moveEvent) {
historyEvent.events.push(moveEvent)
}
historyEvent.events.push({
t: "addToGroup",
@ -1385,19 +1402,35 @@ RED.view = (function() {
RED.editor.validateNode(nn);
if (targetGroup) {
var oldX = targetGroup.x;
var oldY = targetGroup.y;
RED.group.addToGroup(targetGroup, nn);
var moveEvent = null;
if ((targetGroup.x !== oldX) ||
(targetGroup.y !== oldY)) {
moveEvent = {
t: "move",
nodes: [{n: targetGroup,
ox: oldX, oy: oldY,
dx: targetGroup.x -oldX,
dy: targetGroup.y -oldY}],
dirty: true
};
}
if (historyEvent.t !== "multi") {
historyEvent = {
t:'multi',
events: [historyEvent]
}
};
}
historyEvent.events.push({
t: "addToGroup",
group: targetGroup,
nodes: nn
})
});
if (moveEvent) {
historyEvent.events.push(moveEvent);
}
}
if (spliceLink) {
@ -1735,6 +1768,7 @@ RED.view = (function() {
// Check link splice or group-add
if (movingSet.length() === 1 && movingSet.get(0).n.type !== "group") {
//}{//NIS
node = movingSet.get(0);
if (spliceActive) {
if (!spliceTimer) {
@ -2094,11 +2128,25 @@ RED.view = (function() {
if (mouse_mode == RED.state.MOVING_ACTIVE) {
if (movingSet.length() > 0) {
var addedToGroup = null;
var moveEvent = null;
if (activeHoverGroup) {
var oldX = activeHoverGroup.x;
var oldY = activeHoverGroup.y;
for (var j=0;j<movingSet.length();j++) {
var n = movingSet.get(j);
RED.group.addToGroup(activeHoverGroup,n.n);
}
if ((activeHoverGroup.x !== oldX) ||
(activeHoverGroup.y !== oldY)) {
moveEvent = {
t: "move",
nodes: [{n: activeHoverGroup,
ox: oldX, oy: oldY,
dx: activeHoverGroup.x -oldX,
dy: activeHoverGroup.y -oldY}],
dirty: true
};
}
addedToGroup = activeHoverGroup;
activeHoverGroup.hovered = false;
@ -2144,6 +2192,12 @@ RED.view = (function() {
historyEvent.addToGroup = addedToGroup;
}
RED.nodes.dirty(true);
if (moveEvent) {
historyEvent = {
t: "multi",
events: [moveEvent, historyEvent]
};
}
RED.history.push(historyEvent);
}
}
@ -3513,11 +3567,25 @@ RED.view = (function() {
updateActiveNodes();
}
var moveEvent = null;
if (activeHoverGroup) {
var oldX = activeHoverGroup.x;
var oldY = activeHoverGroup.y;
for (var j=0;j<movingSet.length();j++) {
var n = movingSet.get(j);
RED.group.addToGroup(activeHoverGroup,n.n);
}
if ((activeHoverGroup.x !== oldX) ||
(activeHoverGroup.y !== oldY)) {
moveEvent = {
t: "move",
nodes: [{n: activeHoverGroup,
ox: oldX, oy: oldY,
dx: activeHoverGroup.x -oldX,
dy: activeHoverGroup.y -oldY}],
dirty: true
};
}
historyEvent.addedToGroup = activeHoverGroup;
activeHoverGroup.hovered = false;
@ -3526,7 +3594,6 @@ RED.view = (function() {
activeGroup.selected = true;
activeHoverGroup = null;
}
if (mouse_mode == RED.state.DETACHED_DRAGGING) {
var ns = [];
for (var j=0;j<movingSet.length();j++) {
@ -3537,7 +3604,15 @@ RED.view = (function() {
n.n.moved = true;
}
}
RED.history.replace({t:"multi",events:[historyEvent,{t:"move",nodes:ns}],dirty: historyEvent.dirty})
var event = {t:"multi",events:[historyEvent,{t:"move",nodes:ns}],dirty: historyEvent.dirty};
if (moveEvent) {
event.events.push(moveEvent);
}
RED.history.replace(event)
}
else if(moveEvent) {
var event = {t:"multi", events:[historyEvent, moveEvent], dirty: true};
RED.history.replace(event);
}
updateSelection();