Open LunaZheng opened 7 years ago
I found other ways to solve my project, but I still want to know the reason for this problem
What kind of problem does it give you ? not sure about it, but maybe you have to pass custom function to deal with 'filters' property, that is an empty array in the first example and an array of objects in the second example, and JSON stringify may be parsing it in an unexpected way for you. what happens with ?
try {
// your loadFromJSON()
} catch(err) { console.log(err) }
Please help me. The following serialized data can be loaded with loadFromJSON()
{"objects":[{"type":"image","originX":"center","originY":"center","left":72.5,"top":91.5,"width":658,"height":982,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":0.22,"scaleY":0.22,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0,"crossOrigin":"","cropX":0,"cropY":0,"src":"https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=361494400,3587695219&fm=27&gp=0.jpg","filters":[]}]}
but the following serialized data cannot be loaded with loadFromJSON()
{"objects":[{"type":"image","originX":"center","originY":"center","left":96.5,"top":186.5,"width":658,"height":982,"fill":"rgb(0,0,0)","stroke":null,"strokeWidth":0,"strokeDashArray":null,"strokeLineCap":"butt","strokeLineJoin":"miter","strokeMiterLimit":10,"scaleX":0.46,"scaleY":0.46,"angle":0,"flipX":false,"flipY":false,"opacity":1,"shadow":null,"visible":true,"clipTo":null,"backgroundColor":"","fillRule":"nonzero","globalCompositeOperation":"source-over","transformMatrix":null,"skewX":0,"skewY":0,"crossOrigin":"","cropX":0,"cropY":0,"src":"https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=361494400,3587695219&fm=27&gp=0.jpg","filters":[{"type":"Saturation","saturation":"0.913448"}]}]}
Here is my code
How do I load filtered data?