diff --git a/public/icons/alert.png b/public/icons/alert.png index 8a5ae76e5..a86311109 100644 Binary files a/public/icons/alert.png and b/public/icons/alert.png differ diff --git a/public/icons/arduino.png b/public/icons/arduino.png index 8ce39ab9d..43e7d4be6 100644 Binary files a/public/icons/arduino.png and b/public/icons/arduino.png differ diff --git a/public/icons/arrow-in.png b/public/icons/arrow-in.png index c937436b6..e38f39146 100644 Binary files a/public/icons/arrow-in.png and b/public/icons/arrow-in.png differ diff --git a/public/icons/bluetooth.png b/public/icons/bluetooth.png index f94e92f19..1967b064f 100644 Binary files a/public/icons/bluetooth.png and b/public/icons/bluetooth.png differ diff --git a/public/icons/bonjour.png b/public/icons/bonjour.png deleted file mode 100644 index a99c2c57c..000000000 Binary files a/public/icons/bonjour.png and /dev/null differ diff --git a/public/icons/bridge-dash.png b/public/icons/bridge-dash.png index e101aaf08..beaf8e65e 100644 Binary files a/public/icons/bridge-dash.png and b/public/icons/bridge-dash.png differ diff --git a/public/icons/bridge.png b/public/icons/bridge.png index b87a61db0..2011292d6 100644 Binary files a/public/icons/bridge.png and b/public/icons/bridge.png differ diff --git a/public/icons/db.png b/public/icons/db.png index c07daaeaa..5e74f7480 100644 Binary files a/public/icons/db.png and b/public/icons/db.png differ diff --git a/public/icons/envelope.png b/public/icons/envelope.png index eb125663e..fb0d36b95 100644 Binary files a/public/icons/envelope.png and b/public/icons/envelope.png differ diff --git a/public/icons/feed.png b/public/icons/feed.png index 2f9d7e385..9f2671c53 100644 Binary files a/public/icons/feed.png and b/public/icons/feed.png differ diff --git a/public/icons/file.png b/public/icons/file.png index cce694818..78ee09f79 100644 Binary files a/public/icons/file.png and b/public/icons/file.png differ diff --git a/public/icons/function.png b/public/icons/function.png index 84445fa45..909505000 100644 Binary files a/public/icons/function.png and b/public/icons/function.png differ diff --git a/public/icons/hash.png b/public/icons/hash.png index 00f18ae41..e68e45df1 100644 Binary files a/public/icons/hash.png and b/public/icons/hash.png differ diff --git a/public/icons/inject.png b/public/icons/inject.png index 515ef144e..dbf4711a3 100644 Binary files a/public/icons/inject.png and b/public/icons/inject.png differ diff --git a/public/icons/light.png b/public/icons/light.png index 4478ea8a4..ce21542bb 100644 Binary files a/public/icons/light.png and b/public/icons/light.png differ diff --git a/public/icons/mongodb.png b/public/icons/mongodb.png index d1fbf9378..3a1fc11be 100644 Binary files a/public/icons/mongodb.png and b/public/icons/mongodb.png differ diff --git a/public/icons/range.png b/public/icons/range.png index f4a71485d..2e7183ce8 100644 Binary files a/public/icons/range.png and b/public/icons/range.png differ diff --git a/public/icons/redis.png b/public/icons/redis.png index b9601b697..92e82fd26 100644 Binary files a/public/icons/redis.png and b/public/icons/redis.png differ diff --git a/public/icons/rpi.png b/public/icons/rpi.png index b9301e016..162b99dc1 100644 Binary files a/public/icons/rpi.png and b/public/icons/rpi.png differ diff --git a/public/icons/serial.png b/public/icons/serial.png index f2376c79c..f4bcedc3b 100644 Binary files a/public/icons/serial.png and b/public/icons/serial.png differ diff --git a/public/icons/sun.png b/public/icons/sun.png deleted file mode 100644 index c4918e562..000000000 Binary files a/public/icons/sun.png and /dev/null differ diff --git a/public/icons/swap.png b/public/icons/swap.png index f93e6490d..e9e70efbd 100644 Binary files a/public/icons/swap.png and b/public/icons/swap.png differ diff --git a/public/icons/switch.png b/public/icons/switch.png index b64c6e592..4d172de66 100644 Binary files a/public/icons/switch.png and b/public/icons/switch.png differ diff --git a/public/icons/template.png b/public/icons/template.png index 55b8d9927..1db6f273d 100644 Binary files a/public/icons/template.png and b/public/icons/template.png differ diff --git a/public/icons/timer.png b/public/icons/timer.png index 507d76d4d..4f02f4656 100644 Binary files a/public/icons/timer.png and b/public/icons/timer.png differ diff --git a/public/icons/twitter.png b/public/icons/twitter.png index fb21b7bf9..d06059453 100644 Binary files a/public/icons/twitter.png and b/public/icons/twitter.png differ diff --git a/public/icons/watch.png b/public/icons/watch.png index 3139baf6f..a6c1b9451 100644 Binary files a/public/icons/watch.png and b/public/icons/watch.png differ diff --git a/public/icons/white-globe.png b/public/icons/white-globe.png index 881094046..8a19079bf 100644 Binary files a/public/icons/white-globe.png and b/public/icons/white-globe.png differ diff --git a/public/red/ui/palette.js b/public/red/ui/palette.js index 49660097e..b75766591 100644 --- a/public/red/ui/palette.js +++ b/public/red/ui/palette.js @@ -21,7 +21,7 @@ RED.palette = function() { d.id = "pn_"+nt; d.type = nt; - var label = /^(.*?)( in| out)?$/.exec(nt)[1]; + var label = /^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1]; d.innerHTML = '
'+label+"
"; d.className="palette_node"; if (def.icon) { diff --git a/public/red/ui/view.js b/public/red/ui/view.js index dda0e46b8..19f598e76 100644 --- a/public/red/ui/view.js +++ b/public/red/ui/view.js @@ -750,7 +750,7 @@ RED.view = function() { document.body.appendChild(sp); var w = sp.offsetWidth; document.body.removeChild(sp); - return 35+w; + return 50+w; } function resetMouseVars() { @@ -1032,22 +1032,68 @@ RED.view = function() { //node.append("rect").attr("class", "node-gradient-bottom").attr("rx", 6).attr("ry", 6).attr("height",30).attr("stroke","none").attr("fill","url(#gradient-bottom)").style("pointer-events","none"); if (d._def.icon) { - var icon = node.append("image") + + var icon_group = node.append("g") + .attr("class","node_icon_group") + .attr("x",0).attr("y",0); + + var icon_shade = icon_group.append("rect") + .attr("x",0).attr("y",0) + .attr("class","node_icon_shade") + .attr("width","30") + .attr("stroke","none") + .attr("fill","#000") + .attr("fill-opacity","0.05") + .attr("height",function(d){return Math.min(50,d.h-4);}); + + var icon = icon_group.append("image") .attr("xlink:href","icons/"+d._def.icon) .attr("class","node_icon") - .attr("x",0).attr("y",function(d){return (d.h-Math.min(50,d.h))/2;}) - .attr("width","15") - .attr("height", function(d){return Math.min(50,d.h);}); + .attr("x",0) + .attr("width","30") + .attr("height","30"); + + var icon_shade_border = icon_group.append("path") + .attr("d",function(d) { return "M 30 1 l 0 "+(d.h-2)}) + .attr("class","node_icon_shade_border") + .attr("stroke-opacity","0.1") + .attr("stroke","#000") + .attr("stroke-width","2"); - if (d._def.align) { - icon.attr('class','node_icon node_icon_'+d._def.align); + if ("right" == d._def.align) { + icon_group.attr('class','node_icon_group node_icon_group_'+d._def.align); + icon_shade_border.attr("d",function(d) { return "M 0 1 l 0 "+(d.h-2)}) + //icon.attr('class','node_icon node_icon_'+d._def.align); + //icon.attr('class','node_icon_shade node_icon_shade_'+d._def.align); + //icon.attr('class','node_icon_shade_border node_icon_shade_border_'+d._def.align); } - if (d._def.inputs > 0) { - icon.attr("x",8); + + //if (d._def.inputs > 0 && d._def.align == null) { + // icon_shade.attr("width",35); + // icon.attr("transform","translate(5,0)"); + // icon_shade_border.attr("transform","translate(5,0)"); + //} + //if (d._def.outputs > 0 && "right" == d._def.align) { + // icon_shade.attr("width",35); //icon.attr("x",5); + //} + + var img = new Image(); + img.src = "icons/"+d._def.icon; + img.onload = function() { + icon.attr("width",Math.min(img.width,30)); + icon.attr("height",Math.min(img.height,30)); + icon.attr("x",15-Math.min(img.width,30)/2); + //if ("right" == d._def.align) { + // icon.attr("x",function(d){return d.w-img.width-1-(d.outputs>0?5:0);}); + // icon_shade.attr("x",function(d){return d.w-30}); + // icon_shade_border.attr("d",function(d){return "M "+(d.w-30)+" 1 l 0 "+(d.h-2);}); + //} } - icon.style("pointer-events","none"); + + //icon.style("pointer-events","none"); + icon_group.style("pointer-events","none"); } - var text = node.append('svg:text').attr('class','node_label').attr('x', 23).attr('dy', '.35em').attr('text-anchor','start'); + var text = node.append('svg:text').attr('class','node_label').attr('x', 38).attr('dy', '.35em').attr('text-anchor','start'); if (d._def.align) { text.attr('class','node_label node_label_'+d._def.align); text.attr('text-anchor','end'); @@ -1073,7 +1119,7 @@ RED.view = function() { //node.append("circle").attr({"class":"centerDot","cx":0,"cy":0,"r":5}); if (d._def.inputs > 0) { - text.attr("x",30); + text.attr("x",38); node.append("rect").attr("class","port port_input").attr("rx",3).attr("ry",3).attr("x",-5).attr("width",10).attr("height",10) .on("mousedown",function(d){portMouseDown(d,1,0);}) .on("touchstart",function(d){portMouseDown(d,1,0);}) @@ -1109,9 +1155,13 @@ 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}); - thisNode.selectAll(".node_label_right").attr('x', function(d){return d.w-23-(d.outputs>0?5:0);}); - thisNode.selectAll(".node_icon_right").attr("x",function(d){return d.w-16-(d.outputs>0?5:0);}); + 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);}); + //thisNode.selectAll(".node_icon_shade_right").attr("x",function(d){return d.w-30;}); + //thisNode.selectAll(".node_icon_shade_border_right").attr("d",function(d){return "M "+(d.w-30)+" 1 l 0 "+(d.h-2)}); + var numOutputs = d.outputs; var y = (d.h/2)-((numOutputs-1)/2)*13; d.ports = d.ports || d3.range(numOutputs); @@ -1163,8 +1213,12 @@ RED.view = function() { var port = d3.select(this); port.attr("y",function(d){return (d.h/2)-5;}) }); - thisNode.selectAll(".node_icon").attr("height",function(d){return Math.min(50,d.h);}).attr("y",function(d){return (d.h-Math.min(50,d.h))/2;}); + 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_right_button').attr("transform",function(d){ var x = d.w-6; if (d._def.button.toggle && !d[d._def.button.toggle]) {