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:
parent
e59eff83b9
commit
7429f66d6b
@ -961,33 +961,38 @@ RED.view = (function() {
|
|||||||
if (moving_set.length > 0) {
|
if (moving_set.length > 0) {
|
||||||
var ns = [];
|
var ns = [];
|
||||||
for (var j=0;j<moving_set.length;j++) {
|
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});
|
var n = moving_set[j];
|
||||||
moving_set[j].n.dirty = true;
|
if (n.ox !== n.n.x || n.oy !== n.n.y) {
|
||||||
moving_set[j].n.moved = true;
|
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 (ns.length > 0) {
|
||||||
if (activeSpliceLink) {
|
historyEvent = {t:"move",nodes:ns,dirty:RED.nodes.dirty()};
|
||||||
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
|
if (activeSpliceLink) {
|
||||||
var spliceLink = d3.select(activeSpliceLink).data()[0];
|
// TODO: DRY - droppable/nodeMouseDown/canvasMouseUp
|
||||||
RED.nodes.removeLink(spliceLink);
|
var spliceLink = d3.select(activeSpliceLink).data()[0];
|
||||||
var link1 = {
|
RED.nodes.removeLink(spliceLink);
|
||||||
source:spliceLink.source,
|
var link1 = {
|
||||||
sourcePort:spliceLink.sourcePort,
|
source:spliceLink.source,
|
||||||
target: moving_set[0].n
|
sourcePort:spliceLink.sourcePort,
|
||||||
};
|
target: moving_set[0].n
|
||||||
var link2 = {
|
};
|
||||||
source:moving_set[0].n,
|
var link2 = {
|
||||||
sourcePort:0,
|
source:moving_set[0].n,
|
||||||
target: spliceLink.target
|
sourcePort:0,
|
||||||
};
|
target: spliceLink.target
|
||||||
RED.nodes.addLink(link1);
|
};
|
||||||
RED.nodes.addLink(link2);
|
RED.nodes.addLink(link1);
|
||||||
historyEvent.links = [link1,link2];
|
RED.nodes.addLink(link2);
|
||||||
historyEvent.removedLinks = [spliceLink];
|
historyEvent.links = [link1,link2];
|
||||||
updateActiveNodes();
|
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) {
|
if (mouse_mode == RED.state.MOVING || mouse_mode == RED.state.MOVING_ACTIVE) {
|
||||||
@ -2185,10 +2190,10 @@ RED.view = (function() {
|
|||||||
|
|
||||||
thisNode.selectAll(".node_changed")
|
thisNode.selectAll(".node_changed")
|
||||||
.attr("x",function(d){return d.w-10})
|
.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")
|
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; });
|
.classed("hidden",function(d) { return d.valid; });
|
||||||
|
|
||||||
thisNode.selectAll(".port_input").each(function(d,i) {
|
thisNode.selectAll(".port_input").each(function(d,i) {
|
||||||
|
Loading…
Reference in New Issue
Block a user