lundi 20 avril 2015

FabricJS - referencing after loading serialized canvas

I serialize my canvas with the following code:

var user_canvas = JSON.stringify(canvas.toDatalessObject());

All works fine. I then load the serialized canvas with the following code where 'serial' is the var for the serialized canvas:

canvas.loadFromJSON(serial,canvas.renderAll.bind(canvas));

All elements are displayed on the page as expected. From here though I cannot figure out how to reference these objects, canvas.getObjects() comes up as a blank array, however if I console.log(canvas) I can see the elements inside, I just cannot reference them. How can I do this?

Aucun commentaire:

Enregistrer un commentaire