diff --git a/editor/extensions/helloworld-icon.xml b/editor/extensions/helloworld-icon.xml index 68b6d964..0b1ba1a0 100644 --- a/editor/extensions/helloworld-icon.xml +++ b/editor/extensions/helloworld-icon.xml @@ -5,11 +5,10 @@ in the extension. The SVG inside the group makes up the actual icon, and needs use a viewBox instead of width/height for it to scale properly. - Multiple icons can be included, each within their own group. A final element - with ID "svg_eof" must be included too. + Multiple icons can be included, each within their own group. --> - + Layer 1 @@ -19,5 +18,4 @@ - \ No newline at end of file diff --git a/editor/svgicons/jquery.svgicons.js b/editor/svgicons/jquery.svgicons.js index 4ead0a9c..f12b6917 100644 --- a/editor/svgicons/jquery.svgicons.js +++ b/editor/svgicons/jquery.svgicons.js @@ -293,6 +293,17 @@ $(function() { var svgroot = svgdoc.createElementNS(svgns, "svg"); svgroot.setAttributeNS(svgns, 'viewBox', [0,0,icon_w,icon_h].join(' ')); + // Make flexible by converting width/height to viewBox + var w = svg.getAttribute('width'); + var h = svg.getAttribute('height'); + svg.removeAttribute('width'); + svg.removeAttribute('height'); + + var vb = svg.getAttribute('viewBox'); + if(!vb) { + svg.setAttribute('viewBox', [0,0,w,h].join(' ')); + } + $(svgroot).attr({ "xmlns": svgns, "width": icon_w,