I am working with 1.5 version and I get some weird issue. I get JSON and my custom properties are exported and saved in my server side
canvas.includeDefaultValues = false;
var json = canvas.toJSON(['centeredRotation', 'selectable']);
return JSON.stringify(json);
But after load the canvas JSON the custom properties disappear I don't know why I load the json as following:
function loadCanvasFromJson(canvasM) {
var jsonCanvas = $('#jsonCanvas').val();
var jsonObject = JSON.parse(jsonCanvas);
jsonCanvas = JSON.stringify(jsonObject);
canvasM.loadFromJSON(jsonCanvas, canvasM.renderAll.bind(canvasM));
setTimeout(function () {
var objects = canvas.getObjects();
console.log(objects);
for (var i in objects) {
var positions = calcPixelsByPercentage(objects[i].percentage_left, objects[i].percentage_top, canvas);//percentages positions
var size = calcPixelsByPercentage(objects[i].percentage_width, objects[i].percentage_height, canvasM); //percentages size
/*calculating new scale objects responsive*/
var scale = size.left / objects[i].width;
objects[i].scaleX = scale;
objects[i].scaleY = scale;
objects[i].left = positions.left;
objects[i].top = positions.top;
objects[i].setCoords();
}
canvasM.renderAll();
console.log('after load Canvas');
console.log(canvasM.toJSON(['centeredRotation', 'selectable']));
}, 1000);
}
thanks for your help I guess there is a bug somewhere.