I'm trying to display a previously saved drawing in Fabric.js, and then turn it into a view only, no editing mode. Here's what I have:
canvas1.loadFromJSON(cavasData, canvas1.renderAll.bind(canvas1));
canvas1.isDrawingMode = false;
canvas1.deactivateAll();
canvas1.selection = false;
But it isn't untouchable. Displays fine, but objects are still select-able and change-able.
When loading from json
you should disable object selection,
canvas.loadFromJSON(json, canvas.renderAll.bind(canvas), function(o, object) {
object.set('selectable', false);
});
FIDDLE
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With