Merge pull request #4491 from ralphwetzel/master_fix_icon_resize

Fix icon scaling for non .svg icons
pull/4530/head
Nick O'Leary 2024-01-15 17:20:14 +00:00 committed by GitHub
commit 9030b7d27c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 0 deletions

View File

@ -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);