I've a readymade JSON object created for rendering on canvas in fabric.
But, when I try to set & change values of object inside a rendered canvas then it's not taking effect.
Here in code, I'm locking X & Y movements after redering but it's not applied.
What can be reasons and how to resolve it?
var canvas = new fabric.Canvas('canvasLoaded');
canvas.selection = false;
fabric.loadFromJSON(JSON_of_Canvas, function(objects) {
canvas.add.apply(canvas, objects);
canvas.renderAll();
//do the iteration here
obj = canvas.getObjects();
obj.forEach(function(item, i) {
item.set('lockMovementX', false);
item.set('lockMovementY', false);
canvass.renderAll();
});
});
this is the code, i've done so far but I'm not able to figure it out that what I'm missing.
To me, it seems like callback function inside loadFromJson method is not working properly. But, if there's any way to fix this issue then I'd be glad to know about it.
question from:
https://stackoverflow.com/questions/65640738/callback-function-inside-loadfromjson-is-not-working-in-fabric-js 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…