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.dirtyStatus = true;
|
||||
node.dirty = true;
|
||||
RED.view.redraw();
|
||||
}
|
||||
|
@ -3036,23 +3036,27 @@ RED.view = (function() {
|
||||
// });
|
||||
}
|
||||
|
||||
if (!showStatus || !d.status) {
|
||||
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","none");
|
||||
} else {
|
||||
var fill = status_colours[d.status.fill]; // Only allow our colours for now
|
||||
if (d.status.shape == null && fill == null) {
|
||||
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)+")");
|
||||
if (d.dirtyStatus) {
|
||||
if (!showStatus || !d.status) {
|
||||
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","none");
|
||||
} else {
|
||||
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","inline").attr("transform","translate(3,"+(d.h+3)+")");
|
||||
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);
|
||||
}
|
||||
if (d.status.text) {
|
||||
thisNode.selectAll(".red-ui-flow-node-status-label").text(d.status.text);
|
||||
} else {
|
||||
thisNode.selectAll(".red-ui-flow-node-status-label").text("");
|
||||
thisNode.selectAll(".red-ui-flow-node-status-group").style("display","inline");
|
||||
var fill = status_colours[d.status.fill]; // Only allow our colours for now
|
||||
if (d.status.shape == null && fill == null) {
|
||||
thisNode.selectAll(".red-ui-flow-node-status").style("display","none");
|
||||
thisNode.selectAll(".red-ui-flow-node-status-group").attr("transform","translate(-14,"+(d.h+3)+")");
|
||||
} else {
|
||||
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;
|
||||
thisNode.selectAll(".red-ui-flow-node-status").attr("class","red-ui-flow-node-status "+statusClass);
|
||||
}
|
||||
if (d.status.text) {
|
||||
thisNode.selectAll(".red-ui-flow-node-status-label").text(d.status.text);
|
||||
} else {
|
||||
thisNode.selectAll(".red-ui-flow-node-status-label").text("");
|
||||
}
|
||||
}
|
||||
delete d.dirtyStatus;
|
||||
}
|
||||
|
||||
d.dirty = false;
|
||||
@ -3454,7 +3458,7 @@ RED.view = (function() {
|
||||
}
|
||||
function toggleStatus(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
|
||||
redraw();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user