I load my canvas from a JSON object and call toDataURL
but I need a callback which will be executed after canvas loaded because if there is image on canvas, toDataURL
function returns a blank page since it's called before image is loaded.
canvas.loadFromJSON(json);
// I need an event handler here which will be executed after canvas is loaded
var dataURL = canvas.toDataURL();
You can use a callback from loadFromJSON(url,callback)
<pre>
canvas.loadFromJSON(url, function () {
//first render
canvas.renderAll.bind(canvas);
//before call to zoomOut();
zoomOut();
});
function zoomOut() {
var objects = canvas.getObjects();
console.debug(objects);
......
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.