zrender icon indicating copy to clipboard operation
zrender copied to clipboard

导入的svg不支持linearGradient,造成显示异常

Open wishinlife opened this issue 6 years ago • 3 comments

1、通过parseSVG导入svg文件,因svg文件中用了渐变效果,导入后无法显示渐变效果,严重的造成部分图形无法显示出来,望增加支持; 2、导入的svg对象,无法添加阴影等效果。

wishinlife avatar Jun 13 '19 04:06 wishinlife

请提供一下调用的方法。

Ovilia avatar Jun 17 '19 09:06 Ovilia

// 从svg文件导入方法如下:
fetch('./components/data/process/Fiberglass-Fan-Air.svg') .then(response => response.text()) .then(zrender.parseSVG) .then((result) => { console.log(result.root); // result.root.scale = [0.5, 0.5]; result.root.position = [100, 100]; result.root.children()[0].attr({style: { fill: 'red', shadowBlur: 5, shadowColor: 'blue', shadowOffsetX: 10, shadowOffsetY: 10 }}); zr.add(result.root); });

svg文件内容如下: <svg title="Fiberglass Fan: Air" class="Blowers" xmlns:xlink="http://www.w3.org/1999/xlink" height="130" xmlns="http://www.w3.org/2000/svg" width="154" viewBox="0 0 154 130.017"> <linearGradient x1="0%" y2="0%" x2="100%" y1="0%" id="lg1"> </linearGradient> <linearGradient x1="0%" y2="0%" x2="100%" y1="0%" id="lg2"> </linearGradient>

wishinlife avatar Jun 27 '19 00:06 wishinlife

引用的颜色好像都加载不出来,就黑白,2023年了,不知道解决了吗 ಠ_ಠ

nanfb avatar Jun 30 '23 02:06 nanfb