When am trying to load the JSON data onto the canvas, every shape is getting loaded but the patterns that are filled in the shapes are loaded only after I click on the shape.
Could some one please explain why this is happening ? Even i checked this:
canvas2.loadFromJSON(json,canvas2.renderAll.bind(canvas2));
Also, the same problem is with the clone() function : The Object is duplicated. But the pattern filled in the object is shown only after I click on the object.
Iam using version 1.3.7
I have found a "temporary" solution, and it works for me in IE9 and google chrome.
My solution is delay the renderAll() of the canvas object right after the loadFromJSON() function is called.
setTimeout(function(){
canvas.renderAll();
}, 1);
来源:https://stackoverflow.com/questions/18311448/loadfromjson-function-is-loading-objects-filled-with-pattern-only-after-click