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

Tweak group margin to fit node status and look better

This commit is contained in:
Nick O'Leary 2020-06-29 20:43:25 +01:00
parent 362554ad3b
commit 44da085e0b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9

View File

@ -4228,17 +4228,18 @@ RED.view = (function() {
var minY = Number.POSITIVE_INFINITY;
var maxX = 0;
var maxY = 0;
var margin = 26;
d.nodes.forEach(function(n) {
if (n.type !== "group") {
minX = Math.min(minX,n.x-n.w/2-35-((n._def.button && n._def.align!=="right")?20:0));
minY = Math.min(minY,n.y-n.h/2-35);
maxX = Math.max(maxX,n.x+n.w/2+35+((n._def.button && n._def.align=="right")?20:0));
maxY = Math.max(maxY,n.y+n.h/2+35);
minX = Math.min(minX,n.x-n.w/2-margin-((n._def.button && n._def.align!=="right")?20:0));
minY = Math.min(minY,n.y-n.h/2-margin);
maxX = Math.max(maxX,n.x+n.w/2+margin+((n._def.button && n._def.align=="right")?20:0));
maxY = Math.max(maxY,n.y+n.h/2+margin);
} else {
minX = Math.min(minX,n.x-35)
minY = Math.min(minY,n.y-35)
maxX = Math.max(maxX,n.x+n.w+35)
maxY = Math.max(maxY,n.y+n.h+35)
minX = Math.min(minX,n.x-margin)
minY = Math.min(minY,n.y-margin)
maxX = Math.max(maxX,n.x+n.w+margin)
maxY = Math.max(maxY,n.y+n.h+margin)
}
});
@ -4261,9 +4262,12 @@ RED.view = (function() {
}
}
d.w = Math.max(d.minWidth,d.w);
if (d.style.label && d.labels.length > 1) {
var h = (d.labels.length-1) * 16;
if (d.style.label && d.labels.length > 0) {
var labelPos = d.style["label-position"] || "nw";
var h = (d.labels.length-1) * 16;
if (labelPos[0] === "s") {
h += 8;
}
d.h += h;
if (labelPos[0] === "n") {
if (d.nodes.length > 0) {