mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Only redraw node status when it has changed
This commit is contained in:
parent
68b94737ed
commit
8567f1655e
@ -353,6 +353,7 @@ var RED = (function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
node.status = msg;
|
node.status = msg;
|
||||||
|
node.dirtyStatus = true;
|
||||||
node.dirty = true;
|
node.dirty = true;
|
||||||
RED.view.redraw();
|
RED.view.redraw();
|
||||||
}
|
}
|
||||||
|
@ -3036,15 +3036,17 @@ RED.view = (function() {
|
|||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (d.dirtyStatus) {
|
||||||
if (!showStatus || !d.status) {
|
if (!showStatus || !d.status) {
|
||||||
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","none");
|
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","none");
|
||||||
} else {
|
} else {
|
||||||
|
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","inline");
|
||||||
var fill = status_colours[d.status.fill]; // Only allow our colours for now
|
var fill = status_colours[d.status.fill]; // Only allow our colours for now
|
||||||
if (d.status.shape == null && fill == null) {
|
if (d.status.shape == null && fill == null) {
|
||||||
thisNode.selectAll(".red-ui-flow-node-status").style("display","none");
|
thisNode.selectAll(".red-ui-flow-node-status").style("display","none");
|
||||||
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","inline").attr("transform","translate(-14,"+(d.h+3)+")");
|
thisNode.selectAll(".red-ui-flow-node-status-group").attr("transform","translate(-14,"+(d.h+3)+")");
|
||||||
} else {
|
} else {
|
||||||
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","inline").attr("transform","translate(3,"+(d.h+3)+")");
|
thisNode.selectAll(".red-ui-flow-node-status-group").attr("transform","translate(3,"+(d.h+3)+")");
|
||||||
var statusClass = "red-ui-flow-node-status-"+(d.status.shape||"dot")+"-"+d.status.fill;
|
var statusClass = "red-ui-flow-node-status-"+(d.status.shape||"dot")+"-"+d.status.fill;
|
||||||
thisNode.selectAll(".red-ui-flow-node-status").attr("class","red-ui-flow-node-status "+statusClass);
|
thisNode.selectAll(".red-ui-flow-node-status").attr("class","red-ui-flow-node-status "+statusClass);
|
||||||
}
|
}
|
||||||
@ -3054,6 +3056,8 @@ RED.view = (function() {
|
|||||||
thisNode.selectAll(".red-ui-flow-node-status-label").text("");
|
thisNode.selectAll(".red-ui-flow-node-status-label").text("");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
delete d.dirtyStatus;
|
||||||
|
}
|
||||||
|
|
||||||
d.dirty = false;
|
d.dirty = false;
|
||||||
}
|
}
|
||||||
@ -3454,7 +3458,7 @@ RED.view = (function() {
|
|||||||
}
|
}
|
||||||
function toggleStatus(s) {
|
function toggleStatus(s) {
|
||||||
showStatus = s;
|
showStatus = s;
|
||||||
RED.nodes.eachNode(function(n) { n.dirty = true;});
|
RED.nodes.eachNode(function(n) { n.dirtyStatus = true; n.dirty = true;});
|
||||||
//TODO: subscribe/unsubscribe here
|
//TODO: subscribe/unsubscribe here
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user