Reputation: 1121
I want to create an IText on my fabricjs canvas.
var text = new fabric.IText(textValue, { left: 0, top: 0 , fill: color, fillColor:color,});
Now I want to lock modification in some steps of my script and restore them later, Is it possible??
Sorry for my bad english.
Upvotes: 0
Views: 271
Reputation: 14741
If you are trying to achieve a "UNDO" mechanism, you can use the methods:
toObject
and fromObject
.
Those allows you yo serialize the object in a string that you can save in a var array and recover walking the array later using some LIFO technic.
The method will recover also position and orientation of the object, if you are interested just in the text and style situation, you can do a partial restore combining the old text and style property with the current position and orientation ( and scaling , flipping , skewing... ) of the object.
Upvotes: 1