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