2

我有带有结构 Rect 对象的JSON数据。当我尝试使用LoadFromJSON将此JSON数据加载到织物画布上时,形状正在完美加载,但形状中填充的图案没有呈现。仅在单击形状后才会呈现图案。

我已经在fabric Kitchen sink执行模块中复制了我的代码,并尝试执行它。但它也没有按预期工作。

我的代码:

var jsonD = '{"objects":[{"type":"rect","originX":"center","originY":"center","left":222.92,"top":237,"width":100,"height":100,"fill":{"source":"http://www.convertingquarterly.com/Portals/1/images/industry-news/Brushfoil%20cross-hatch,%20Tru-Stainless%20paaterns.jpg","repeat":"repeat","offsetX":0,"offsetY":0},"overlayFill":null,"stroke":"black","strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":1,"scaleY":1,"angle":0,"flipX":false,"flipY":false,"opacity":1,"selectable":true,"hasControls":true,"hasBorders":true,"hasRotatingPoint":true,"transparentCorners":true,"perPixelTargetFind":false,"shadow":null,"visible":true,"clipTo":null,"rx":0,"ry":0,"x":0,"y":0}],"background":""}';
canvas.loadFromJSON(jsonD);
canvas.renderAll();

如何解决这个问题呢?

4

1 回答 1

0

我刚刚从 1.1.6 更新到 1.2.9,使用 loadFromJson 时我的图片资源也没有显示!

到底变了什么?!

于 2013-08-22T10:44:27.673 回答