Merge 21ac30b557cb79f5290e172a92cdf5ab70f799c0 into 918943816f44c743148baf8a5b5f081fdff4814d

This commit is contained in:
Bruno Feurer 2023-12-19 08:10:49 -05:00 committed by GitHub
commit 1e57814170
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -4128,20 +4128,22 @@ RED.view = (function() {
iconUrl = RED.settings.apiRootUrl+"icons/"+iconPath.module+"/"+iconPath.file;
}
}
const rightAlign = "right" === d._def.align
const offsetX = d.inputs && !rightAlign ? 2 : d.outputs && rightAlign ? -2 : 0
if (fontAwesomeUnicode) {
// Since Node-RED workspace uses SVG, i tag cannot be used for font-awesome icon.
// On SVG, use text tag as an alternative.
icon_group.append("text")
.attr("xlink:href",iconUrl)
.attr("class","fa-lg")
.attr("x",15)
.attr("x",15+offsetX)
.text(fontAwesomeUnicode);
} else {
var icon = icon_group.append("image")
.style("display","none")
.attr("xlink:href",iconUrl)
.attr("class","red-ui-flow-node-icon")
.attr("x",0)
.attr("x",0+offsetX)
.attr("width","30")
.attr("height","30");
@ -4158,7 +4160,7 @@ RED.view = (function() {
var height = img.height * scaleFactor;
icon.attr("width",width);
icon.attr("height",height);
icon.attr("x",15-width/2);
icon.attr("x",15-width/2+offsetX);
}
icon.attr("xlink:href",iconUrl);
icon.style("display",null);
@ -4760,7 +4762,7 @@ RED.view = (function() {
if ((!d._def.align && d.inputs !== 0 && d.outputs === 0) || "right" === d._def.align) {
if (this.__iconGroup__) {
this.__iconGroup__.classList.add("red-ui-flow-node-icon-group-right");
this.__iconGroup__.setAttribute("transform", "translate("+(d.w-30)+",0)");
this.__iconGroup__.setAttribute("transform", "translate("+(d.w-(d.outputs ? 32 : 30))+",0)");
}
this.__textGroup__.classList.add("red-ui-flow-node-label-right");
this.__textGroup__.setAttribute("transform", "translate("+(d.w-38)+","+yp+")");
@ -4896,9 +4898,8 @@ RED.view = (function() {
icon.attr("y",function(){return (d.h-d3.select(this).attr("height"))/2;});
const iconShadeHeight = d.h
const iconShadeWidth = 30
const iconShadeWidth = d.inputs && d.outputs ? 32 : 30
this.__iconShade__.setAttribute("d", hideLabel ?
`M5 0 h${iconShadeWidth-10} a 5 5 0 0 1 5 5 v${iconShadeHeight-10} a 5 5 0 0 1 -5 5 h-${iconShadeWidth-10} a 5 5 0 0 1 -5 -5 v-${iconShadeHeight-10} a 5 5 0 0 1 5 -5` : (
"right" === d._def.align ?
@ -4908,7 +4909,7 @@ RED.view = (function() {
)
this.__iconShadeBorder__.style.display = hideLabel?'none':''
this.__iconShadeBorder__.setAttribute("d",
"M " + (((!d._def.align && d.inputs !== 0 && d.outputs === 0) || "right" === d._def.align) ? 0.5 : 29.5) + " "+(d.selected?1:0.5)+" l 0 " + (d.h - (d.selected?2:1))
"M " + (((!d._def.align && d.inputs !== 0 && d.outputs === 0) || "right" === d._def.align) ? 0.5 : iconShadeWidth-0.5) + " "+(d.selected?1:0.5)+" l 0 " + (d.h - (d.selected?2:1))
);
faIcon.attr("y",(d.h+13)/2);
}