更新时间:2022-11-15 09:41:57
我通过将SVG形状组合到一条路径(没有任何其他svg对象的任何多边形)中解决了我的问题,然后将svg坐标传递到了fabircJS路径中.有效的SVG坐标看起来像是"M0,0H63.7V63.7H0Z"
I resolved my problem by combining the SVG shape into one path (without any polygons any other svg objects), then I pass the svg coords into fabircJS path. The valid SVG coords looks like that "M0,0H63.7V63.7H0Z"
fabric.loadSVGFromURL('object.svg', function (objects, options) {
let img1 = new fabric.Path(objects[0].d, {
fill: '#333',
opacity: 1,
hasBorders: true,
hasControls: true,
hasRotatingPoint: true,
selectable: true,
preserveObjectStacking: true,
objectCaching: false,
});
}
我希望它会对其他人有所帮助:)
I hope it will help someone else :)