I am making a paint application using jQuery and I ran into a problem.
CodePen: https://codepen.io/mistahdukk/pen/dmaKOV
canvas.mousedown(function(e){
down = true;
draw(e);
}).mouseover(function(e){
ctx.beginPath();
draw(e);
}).mouseout(function(e){
ctx.beginPath();
}).mousemove(draw).mouseup(function(){
down =false;
ctx.beginPath();
});
If the mouse leaves the canvas and the click is released and the mouse re-enters the canvas, the app will continue to draw, but I only want to make it so that it draws only when the mouse has been clicked. I don't really know how to solve this issue. Thanks.