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

Mark nodes that have really moved as changed

This commit is contained in:
Nick O'Leary 2017-06-29 23:23:16 +01:00
parent e59eff83b9
commit 7429f66d6b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -961,33 +961,38 @@ RED.view = (function() {
if (moving_set.length > 0) {
var ns = [];
for (var j=0;j<moving_set.length;j++) {
ns.push({n:moving_set[j].n,ox:moving_set[j].ox,oy:moving_set[j].oy,moved:moving_set[j].n.moved});
moving_set[j].n.dirty = true;
moving_set[j].n.moved = true;
var n = moving_set[j];
if (n.ox !== n.n.x || n.oy !== n.n.y) {
ns.push({n:n.n,ox:n.ox,oy:n.oy,moved:n.n.moved});
n.n.dirty = true;
n.n.moved = true;
}
}
historyEvent = {t:"move",nodes:ns,dirty:RED.nodes.dirty()};
if (activeSpliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
var spliceLink = d3.select(activeSpliceLink).data()[0];
RED.nodes.removeLink(spliceLink);
var link1 = {
source:spliceLink.source,
sourcePort:spliceLink.sourcePort,
target: moving_set[0].n
};
var link2 = {
source:moving_set[0].n,
sourcePort:0,
target: spliceLink.target
};
RED.nodes.addLink(link1);
RED.nodes.addLink(link2);
historyEvent.links = [link1,link2];
historyEvent.removedLinks = [spliceLink];
updateActiveNodes();
if (ns.length > 0) {
historyEvent = {t:"move",nodes:ns,dirty:RED.nodes.dirty()};
if (activeSpliceLink) {
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
var spliceLink = d3.select(activeSpliceLink).data()[0];
RED.nodes.removeLink(spliceLink);
var link1 = {
source:spliceLink.source,
sourcePort:spliceLink.sourcePort,
target: moving_set[0].n
};
var link2 = {
source:moving_set[0].n,
sourcePort:0,
target: spliceLink.target
};
RED.nodes.addLink(link1);
RED.nodes.addLink(link2);
historyEvent.links = [link1,link2];
historyEvent.removedLinks = [spliceLink];
updateActiveNodes();
}
RED.nodes.dirty(true);
RED.history.push(historyEvent);
}
RED.nodes.dirty(true);
RED.history.push(historyEvent);
}
}
if (mouse_mode == RED.state.MOVING || mouse_mode == RED.state.MOVING_ACTIVE) {
@ -2185,10 +2190,10 @@ RED.view = (function() {
thisNode.selectAll(".node_changed")
.attr("x",function(d){return d.w-10})
.classed("hidden",function(d) { return !d.changed; });
.classed("hidden",function(d) { return !(d.changed||d.moved); });
thisNode.selectAll(".node_error")
.attr("x",function(d){return d.w-10-(d.changed?13:0)})
.attr("x",function(d){return d.w-10-((d.changed||d.moved)?13:0)})
.classed("hidden",function(d) { return d.valid; });
thisNode.selectAll(".port_input").each(function(d,i) {