Question

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

Was it helpful?

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();
        });
});
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top