I want to draw an image to canvas and then allow user to draw some sketch on it.i'm using sketch.js jquery library.the current status is:
- the image has been loaded on the canvas successfully
- but when my mouse over the canvas, then image disappeared.
- when I dragged the mouse, some sketch shows on the empty canvas.the drown
correctly
so, i think the sketch.js did clear the canvas.but i don't know how to fix it.Any help??
canvas.html
<canvas id="tools_sketch" width="300" height="300" style="background: no-repeat center center;border:black 1px solid"></canvas>
here is my script
<script type="text/javascript">
var sigCanvas = document.getElementById('tools_sketch');
var context = sigCanvas.getContext('2d');
var imageObj = new Image();
imageObj.src = 'human-face.jpg';
imageObj.onload = function() {
context.drawImage(this, 0, 0,sigCanvas.width,sigCanvas.width);
};
$(function() {
$('#tools_sketch').sketch({defaultColor: "#FF0000"});
});
</script>