Continue edit sketching image using sketch.js

前端 未结 1 517
不思量自难忘°
不思量自难忘° 2021-01-24 15:28

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 conti

1条回答
  •  抹茶落季
    2021-01-24 16:23

    //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();
            });
    });
    

    0 讨论(0)
提交回复
热议问题