javajavascriptimagesketching

Continue edit sketching image using sketch.js


I am using example from sketch.js(http://intridea.github.io/sketch.js/) to draw sketching and able to save it in directory as an image file.

The problem is how to continue editing the sketching image after I able to render it?

Any suggestion or solution is appreciated.

Thanks


Solution

  • //declare an array
    var canvas;
    
    $('#buttonSave').click(function () {
       //saves all actions you made in your canvas
       canvas = $('#canvasId').sketch().actions 
    });
    
    $('#buttonRetrieve').click(function () {
        //iterates through your array, adds and redraws each action
        $.each(canvas, function (i, val) {
            $('#canvasId').sketch().actions.push(val);
            $('#canvasId').sketch().redraw();
            });
    });