Class representing the history of a Fabric.js canvas, allowing undo and redo operations.
Creates an instance of FabricCanvasHistory.
The Fabric.js canvas instance to track.
Optional
Optional callback function to be called on history change.
Checks if a redo operation can be performed.
True if redo can be performed, otherwise false.
Checks if an undo operation can be performed.
True if undo can be performed, otherwise false.
Clears the undo and redo stacks.
Initializes the history tracking by enabling events and saving the initial state.
Redoes the last undone operation, restoring the canvas to the state before the last undo. If there is no state to redo, the method does nothing.
Sets the callback function to be called on history change.
The callback function.
Undoes the last operation, reverting the canvas to the previous state. If there is no previous state, the method does nothing.
Class representing the history of a Fabric.js canvas, allowing undo and redo operations.