mirror of https://github.com/node-red/node-red.git
Merge pull request #4491 from ralphwetzel/master_fix_icon_resize
Fix icon scaling for non .svg iconspull/4530/head
commit
9030b7d27c
|
@ -4155,10 +4155,15 @@ RED.view = (function() {
|
|||
scaleFactor = 30/largestEdge;
|
||||
}
|
||||
var width = img.width * scaleFactor;
|
||||
if (width > 20) {
|
||||
scalefactor *= 20/width;
|
||||
width = 20;
|
||||
}
|
||||
var height = img.height * scaleFactor;
|
||||
icon.attr("width",width);
|
||||
icon.attr("height",height);
|
||||
icon.attr("x",15-width/2);
|
||||
icon.attr("y",(30-height)/2);
|
||||
}
|
||||
icon.attr("xlink:href",iconUrl);
|
||||
icon.style("display",null);
|
||||
|
|
Loading…
Reference in New Issue