mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Automatic placing of node icon
This commit is contained in:
parent
308d6889a7
commit
66fc4b536c
10
packages/node_modules/@node-red/editor-client/src/js/ui/palette.js
vendored
Normal file → Executable file
10
packages/node_modules/@node-red/editor-client/src/js/ui/palette.js
vendored
Normal file → Executable file
@ -175,13 +175,19 @@ RED.palette = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
$('<div/>',{class:"palette_label"+(def.align=="right"?" palette_label_right":"")}).appendTo(d);
|
||||
$('<div/>', {
|
||||
class: "palette_label"
|
||||
+ (((!def.align && def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " palette_label_right" : "")
|
||||
}).appendTo(d);
|
||||
|
||||
d.className="palette_node";
|
||||
|
||||
if (def.icon) {
|
||||
var icon_url = RED.utils.getNodeIcon(def);
|
||||
var iconContainer = $('<div/>',{class:"palette_icon_container"+(def.align=="right"?" palette_icon_container_right":"")}).appendTo(d);
|
||||
var iconContainer = $('<div/>', {
|
||||
class: "palette_icon_container"
|
||||
+ (((def.inputs !== 0 && def.outputs === 0) || "right" === def.align) ? " palette_icon_container_right" : "")
|
||||
}).appendTo(d);
|
||||
RED.utils.createIconElement(icon_url, iconContainer, true);
|
||||
}
|
||||
|
||||
|
13
packages/node_modules/@node-red/editor-client/src/js/ui/view.js
vendored
Normal file → Executable file
13
packages/node_modules/@node-red/editor-client/src/js/ui/view.js
vendored
Normal file → Executable file
@ -2801,6 +2801,15 @@ RED.view = (function() {
|
||||
//thisNode.selectAll(".node-gradient-top").attr("width",function(d){return d.w});
|
||||
//thisNode.selectAll(".node-gradient-bottom").attr("width",function(d){return d.w}).attr("y",function(d){return d.h-30});
|
||||
|
||||
if ((!d._def.align && d.inputs !== 0 && d.outputs === 0) || "right" === d._def.align) {
|
||||
thisNode.selectAll(".node_icon_group").classed("node_icon_group_right", true);
|
||||
thisNode.selectAll(".node_label").classed("node_label_right", true).attr("text-anchor", "end");
|
||||
} else {
|
||||
thisNode.selectAll(".node_icon_group").classed("node_icon_group_right", false);
|
||||
thisNode.selectAll(".node_label").classed("node_label_right", false).attr("text-anchor", "start");
|
||||
}
|
||||
thisNode.selectAll(".node_icon_group").attr("transform", function (d) { return "translate(0, 0)"; });
|
||||
thisNode.selectAll(".node_label").attr("x", function (d) { return 38; });
|
||||
thisNode.selectAll(".node_icon_group_right").attr("transform", function(d){return "translate("+(d.w-30)+",0)"});
|
||||
thisNode.selectAll(".node_label_right").attr("x", function(d){return d.w-38});
|
||||
//thisNode.selectAll(".node_icon_right").attr("x",function(d){return d.w-d3.select(this).attr("width")-1-(d.outputs>0?5:0);});
|
||||
@ -2951,7 +2960,9 @@ RED.view = (function() {
|
||||
|
||||
thisNode.selectAll(".node_icon").attr("y",function(d){return (d.h-d3.select(this).attr("height"))/2;});
|
||||
thisNode.selectAll(".node_icon_shade").attr("height",function(d){return d.h;});
|
||||
thisNode.selectAll(".node_icon_shade_border").attr("d",function(d){ return "M "+(("right" == d._def.align) ?0:30)+" 1 l 0 "+(d.h-2)});
|
||||
thisNode.selectAll(".node_icon_shade_border").attr("d", function (d) {
|
||||
return "M " + (((!d._def.align && d.inputs !== 0 && d.outputs === 0) || "right" === d._def.align) ? 0 : 30) + " 1 l 0 " + (d.h - 2);
|
||||
});
|
||||
thisNode.selectAll(".fa-lg").attr("y",function(d){return (d.h+13)/2;});
|
||||
|
||||
thisNode.selectAll(".node_button").attr("opacity",function(d) {
|
||||
|
Loading…
Reference in New Issue
Block a user