我每次创建对象时都尝试设置includeDefaultValues:false
,但是,图像的保存字符串仍然是:
[{"type":"image","originX":"center","originY":"center","left":396.16,"top":108.16,"width":2475,"height":675,"fill":"rgb(0,0,0)","overlayFill":null,"stroke":null,"strokeWidth":1,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":0.32,"scaleY":0.32,"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,"src":"http://localhost/fabricjstest/designs/images/ds130814014834.png?t=1376502517","filters":[]}],"background":"#FFF"}
我很确定其中大多数是默认值,所以我怎样才能让它工作? 也许我保存错误,所以这是我的保存代码:
var obj = canvas.toObject();
var jsn = JSON.stringify(obj);
alert(jsn);
以下是直接来自js文件的版本:var fabric=fabric||{version:"1.2.9"};
所以问题是:如何禁用默认值。