mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Fix icon scaling for non .svg icons
This commit is contained in:
parent
0e8d312794
commit
c31e622160
@ -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