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

Fix vertical align of subflow port labels

This commit is contained in:
Nick O'Leary 2022-01-25 17:08:04 +00:00
parent ab2ced5c37
commit 42358419ad
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 13 additions and 13 deletions

View File

@ -503,7 +503,7 @@
hasNonBlankLabel = hasNonBlankLabel || v!== ""; hasNonBlankLabel = hasNonBlankLabel || v!== "";
// mark changed output port labels as dirty // mark changed output port labels as dirty
if (node.type === "subflow" && node.outputLabels[index] !== v) { if (node.type === "subflow" && (!node.outputLabels || node.outputLabels[index] !== v)) {
node.out[index].dirty = true; node.out[index].dirty = true;
} }

View File

@ -3994,7 +3994,6 @@ RED.view = (function() {
subflowOutputs.exit().remove(); subflowOutputs.exit().remove();
var outGroup = subflowOutputs.enter().insert("svg:g").attr("class","red-ui-flow-node red-ui-flow-subflow-port-output") var outGroup = subflowOutputs.enter().insert("svg:g").attr("class","red-ui-flow-node red-ui-flow-subflow-port-output")
outGroup.each(function(d,i) { outGroup.each(function(d,i) {
var node = d3.select(this); var node = d3.select(this);
var nodeContents = document.createDocumentFragment(); var nodeContents = document.createDocumentFragment();
@ -4020,6 +4019,7 @@ RED.view = (function() {
var output_groupEl = document.createElementNS("http://www.w3.org/2000/svg","g"); var output_groupEl = document.createElementNS("http://www.w3.org/2000/svg","g");
output_groupEl.setAttribute("x",0); output_groupEl.setAttribute("x",0);
output_groupEl.setAttribute("y",0); output_groupEl.setAttribute("y",0);
node[0][0].__outputLabelGroup__ = output_groupEl;
var output_output = document.createElementNS("http://www.w3.org/2000/svg","text"); var output_output = document.createElementNS("http://www.w3.org/2000/svg","text");
output_output.setAttribute("class","red-ui-flow-port-label"); output_output.setAttribute("class","red-ui-flow-port-label");
@ -4061,6 +4061,7 @@ RED.view = (function() {
port.setAttribute("width",10); port.setAttribute("width",10);
port.setAttribute("height",10); port.setAttribute("height",10);
portEl.appendChild(port); portEl.appendChild(port);
port.__data__ = d;
d3.select(port) d3.select(port)
.on("mousedown", function(d,i){portMouseDown(d,PORT_TYPE_INPUT,0);} ) .on("mousedown", function(d,i){portMouseDown(d,PORT_TYPE_INPUT,0);} )
@ -4206,9 +4207,8 @@ RED.view = (function() {
this.__outputBorder__.setAttribute("d","M 40 1 l 0 "+(hideLabel?0:(d.h - 2))); this.__outputBorder__.setAttribute("d","M 40 1 l 0 "+(hideLabel?0:(d.h - 2)));
this.__port__.setAttribute("transform","translate(-5,"+((d.h/2)-5)+")"); this.__port__.setAttribute("transform","translate(-5,"+((d.h/2)-5)+")");
this.__outputNumber__.setAttribute("transform","translate(20,"+Math.max(28, (d.h/2)+2)+")"); this.__outputOutput__.setAttribute("transform","translate(20,"+((d.h/2)-8)+")");
this.__outputOutput__.setAttribute("transform","translate(20,"+Math.max(12, (d.h/2)-14)+")"); this.__outputNumber__.setAttribute("transform","translate(20,"+((d.h/2)+7)+")");
} }
d.dirty = false; d.dirty = false;
} }