From dc16376152bc5ec7ad0e9f743252212324f8783b Mon Sep 17 00:00:00 2001 From: Bruno Feurer Date: Sun, 28 Aug 2022 15:19:29 +0200 Subject: [PATCH] If there is an input/output, give the icon more space. --- .../@node-red/editor-client/src/js/ui/view.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index 08abe5f2e..656ea95a2 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -4756,7 +4756,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 ? 33 : 30))+",0)"); } this.__textGroup__.classList.add("red-ui-flow-node-label-right"); this.__textGroup__.setAttribute("transform", "translate("+(d.w-38)+","+yp+")"); @@ -4892,9 +4892,12 @@ RED.view = (function() { icon.attr("y",function(){return (d.h-d3.select(this).attr("height"))/2;}); + const rightAlign = "right" === d._def.align + if (d.inputs && !rightAlign) icon.attr("x",3); + if (d.outputs && rightAlign) icon.attr("x",-3); const iconShadeHeight = d.h - const iconShadeWidth = 30 + const iconShadeWidth = d.inputs && d.outputs ? 33 : 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 ? @@ -4904,7 +4907,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); }