Closed manfredjb closed 10 years ago
1.4.5 is the latest — https://github.com/kangax/fabric.js/releases/tag/v1.4.5
Hi Kangax,
I have tested it using and the backgroundImage property still going missed. I used 1.4.5 version:
https://github.com/kangax/fabric.js/blob/master/dist/fabric.min.js
Thank you in advance
@manfredjb Can you please create jsfiddle testcase. Thanks a lot!
Hello @Kienz , apologies for delay. I haven't seen your replay. Well, It took a long time to reproduce the error:
http://jsfiddle.net/manix/8GWH6/
The possible bug is basically with canvas.toJSON()
in onLoad
time. Take a look how I have set a background image (example, line 3) Then, you will see that the backgroundImage
property is lost.
Thank you for your time.
@manfredjb canvas.setBackgroundImage
is async.
If you want to serialize your canvas in the onload
event, you have to call canvas.toJSON()
in the callback function of canvas.setBackgroundImage
.
Something like that:
var canvas = new fabric.Canvas('c');
canvas.isDrawingMode = true;
canvas.setBackgroundImage("https://lh6.googleusercontent.com/-nI_6EJ8gyDU/AAAAAAAAAAI/AAAAAAABQz4/uQHZE0iWnYs/s120-c/photo.jpg", function() {
canvas.renderAll();
console.log(canvas.toJSON());
});
Updated jsfiddle: http://jsfiddle.net/Kienz/8GWH6/6/
Excellent! Works as expected. Thank you so much for clarify and time.
In order to get details of a possible bug please see this recent issue closed:
https://github.com/kangax/fabric.js/issues/1293