John
John

Reputation: 2033

Load from JSON is not working with Patterns in the latest version of Fabric.js

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? I even 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.

I am using version 1.3.7.

Upvotes: 0

Views: 1054

Answers (1)

PaulLing
PaulLing

Reputation: 2160

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);

Upvotes: 2

Related Questions