mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge 260ac94dc722b61162ffb7c2db8cec84d308df5a into 9694c8bdfac141b7a044c4bbe68cfc9528b008a7
This commit is contained in:
commit
0cdda26765
@ -47,6 +47,7 @@ RED.view = (function() {
|
||||
var workspaceScrollPositions = {};
|
||||
|
||||
var gridSize = 20;
|
||||
var widthSize = 20;
|
||||
var snapGrid = false;
|
||||
|
||||
var activeSpliceLink;
|
||||
@ -4740,7 +4741,7 @@ RED.view = (function() {
|
||||
if (hideLabel) {
|
||||
d.w = node_height;
|
||||
} else {
|
||||
d.w = Math.max(node_width,20*(Math.ceil((labelParts.width+50+(d._def.inputs>0?7:0))/20)) );
|
||||
d.w = Math.max(node_width,widthSize*(Math.ceil((labelParts.width+50+(d._def.inputs>0?7:0))/widthSize)) );
|
||||
}
|
||||
if (ow !== undefined) {
|
||||
d.x += (d.w-ow)/2;
|
||||
@ -5442,9 +5443,9 @@ RED.view = (function() {
|
||||
return
|
||||
}
|
||||
if (n.type !== "group") {
|
||||
minX = Math.min(minX,n.x-n.w/2-margin-((n._def.button && n._def.align!=="right")?20:0));
|
||||
minX = Math.min(minX,n.x-n.w/2-margin-((n._def.button && n._def.align!=="right")?widthSize: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));
|
||||
maxX = Math.max(maxX,n.x+n.w/2+margin+((n._def.button && n._def.align=="right")?widthSize:0));
|
||||
maxY = Math.max(maxY,n.y+n.h/2+margin);
|
||||
} else {
|
||||
minX = Math.min(minX,n.x-margin)
|
||||
@ -6186,23 +6187,23 @@ RED.view = (function() {
|
||||
function calculateNodeDimensions(node) {
|
||||
var result = [node_width,node_height];
|
||||
try {
|
||||
var isLink = (node.type === "link in" || node.type === "link out")
|
||||
var hideLabel = node.hasOwnProperty('l')?!node.l : isLink;
|
||||
var label = RED.utils.getNodeLabel(node, node.type);
|
||||
var labelParts = getLabelParts(label, "red-ui-flow-node-label");
|
||||
if (hideLabel) {
|
||||
result[1] = Math.max(node_height,(node.outputs || 0) * 15);
|
||||
} else {
|
||||
result[1] = Math.max(6+24*labelParts.lines.length,(node.outputs || 0) * 15, 30);
|
||||
var isLink = (node.type === "link in" || node.type === "link out")
|
||||
var hideLabel = node.hasOwnProperty('l')?!node.l : isLink;
|
||||
var label = RED.utils.getNodeLabel(node, node.type);
|
||||
var labelParts = getLabelParts(label, "red-ui-flow-node-label");
|
||||
if (hideLabel) {
|
||||
result[1] = Math.max(node_height,(node.outputs || 0) * 15);
|
||||
} else {
|
||||
result[1] = Math.max(6+24*labelParts.lines.length,(node.outputs || 0) * 15, 30);
|
||||
}
|
||||
if (hideLabel) {
|
||||
result[0] = node_height;
|
||||
} else {
|
||||
result[0] = Math.max(node_width,widthSize*(Math.ceil((labelParts.width+50+(node._def.inputs>0?7:0))/widthSize)) );
|
||||
}
|
||||
} catch(err) {
|
||||
console.log("Error",node);
|
||||
}
|
||||
if (hideLabel) {
|
||||
result[0] = node_height;
|
||||
} else {
|
||||
result[0] = Math.max(node_width,20*(Math.ceil((labelParts.width+50+(node._def.inputs>0?7:0))/20)) );
|
||||
}
|
||||
}catch(err) {
|
||||
console.log("Error",node);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -6383,6 +6384,8 @@ RED.view = (function() {
|
||||
return gridSize;
|
||||
} else {
|
||||
gridSize = Math.max(5,v);
|
||||
widthSize = gridSize;
|
||||
while (widthSize > 50) { widthSize = Math.round(widthSize/2); }
|
||||
updateGrid();
|
||||
}
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user