Undo/Redo functionality in CamanJS?

650 Views Asked by At

Hi Im a newbie in camanjs.

I manipulate canvas with this code.

        function vintage(id){
    Caman(id, function(){

    //I just added this code to reset the canvas to its original state
    this.revert();
    //----------------------------

    this.vintage();
    this.render();

    });
    } 

With the code this.revert(); , I can turn the canvas back to its original state. What if I use multiple effects and presets and just I want to revert the canvas few steps back to my last used effect?

1

There are 1 best solutions below

0
On

I don't see a way to do that, but you can stash the canvas in a hidden span, and then replace it as part of an undo chain.

use clone to stash it