简体   繁体   English

SVG图像使用FabricJS在Canvas上呈现的方式有所不同

[英]SVG image renders differently on Canvas with FabricJS

While loading a SVG file on a FabricJs Canvas I found out that it was rendering it with different colours than what it was actually designed for. 当在FabricJs Canvas上加载SVG文件时,我发现它用与实际设计不同的颜色渲染该文件。

This is how it looks if i open it on browser. 是它的外观,如果我打开它的浏览器。 This is how it renders on the canvas. 就是它在画布上的渲染方式。

Here is the gist of my code. 是我的代码的要点。

I found a similar post on SVG here where the problem was solved with removing the fill-rule="evenodd"; 我发现SVG类似的帖子这里是哪里的问题与移除填充规则=“EVENODD”解决; however that trick did not work for me. 但是,这个技巧对我没有用。

I am struggling with this for past 2 days. 我在过去的2天中一直在为此苦苦挣扎。 Need a fresh angle on this. 需要一个新的角度。 I would really appreciate any inputs. 我真的很感谢任何投入。

Turns out I was using the same id two different paths. 原来我在两个不同的路径上使用相同的ID。 Renamed them, works fine now. 重命名它们,现在可以正常工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM