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