发现一bug:如果只是点击一下不会有痕迹出现,下面是我的改善的部分代码,大家可以参考一下:
var isMouseMove = false;
canvas.onmouseup = function(e)
{ if(isMouseMove != true)
{
context.beginPath();
context.arc(curLoc.x, curLoc.y, 15, 0 ,2*Math.PI);
context.fillStyle = drawColor;
context.fill();
}
isMouseMove = false;
}
var isMouseMove = false;
canvas.onmouseup = function(e)
{ if(isMouseMove != true)
{
context.beginPath();
context.arc(curLoc.x, curLoc.y, 15, 0 ,2*Math.PI);
context.fillStyle = drawColor;
context.fill();
}
isMouseMove = false;
}
2016-01-26