mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge pull request #4425 from node-red/4418-fix-empty-status-background
Hide node status background when there is no status to show
This commit is contained in:
commit
3f4d96f4cd
@ -4187,7 +4187,7 @@ RED.view = (function() {
|
|||||||
nodeEl.__statusGroup__.style.display = "none";
|
nodeEl.__statusGroup__.style.display = "none";
|
||||||
} else {
|
} else {
|
||||||
nodeEl.__statusGroup__.style.display = "inline";
|
nodeEl.__statusGroup__.style.display = "inline";
|
||||||
let backgroundWidth = 12
|
let backgroundWidth = 15
|
||||||
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) {
|
||||||
backgroundWidth = 0
|
backgroundWidth = 0
|
||||||
@ -4207,7 +4207,11 @@ RED.view = (function() {
|
|||||||
nodeEl.__statusLabel__.textContent = "";
|
nodeEl.__statusLabel__.textContent = "";
|
||||||
}
|
}
|
||||||
const textSize = nodeEl.__statusLabel__.getBBox()
|
const textSize = nodeEl.__statusLabel__.getBBox()
|
||||||
nodeEl.__statusBackground__.setAttribute('width', backgroundWidth + textSize.width + 6)
|
backgroundWidth += textSize.width
|
||||||
|
if (backgroundWidth > 0 && textSize.width > 0) {
|
||||||
|
backgroundWidth += 6
|
||||||
|
}
|
||||||
|
nodeEl.__statusBackground__.setAttribute('width', backgroundWidth)
|
||||||
}
|
}
|
||||||
delete d.dirtyStatus;
|
delete d.dirtyStatus;
|
||||||
}
|
}
|
||||||
@ -4619,8 +4623,8 @@ RED.view = (function() {
|
|||||||
statusBackground.setAttribute("y",-1);
|
statusBackground.setAttribute("y",-1);
|
||||||
statusBackground.setAttribute("width",200);
|
statusBackground.setAttribute("width",200);
|
||||||
statusBackground.setAttribute("height",13);
|
statusBackground.setAttribute("height",13);
|
||||||
statusBackground.setAttribute("rx",1);
|
statusBackground.setAttribute("rx",2);
|
||||||
statusBackground.setAttribute("ry",1);
|
statusBackground.setAttribute("ry",2);
|
||||||
|
|
||||||
statusEl.appendChild(statusBackground);
|
statusEl.appendChild(statusBackground);
|
||||||
node[0][0].__statusBackground__ = statusBackground;
|
node[0][0].__statusBackground__ = statusBackground;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user