I am starting to experiment with canvas, this might be a basic issue but can not find the problem here.
My mouse cursor is slower than the line I draw on canvas with the mouse event coordinates. What am I missing here?
Fiddle
P.S.- Same problem if using jQuery's mouse event: http://jsfiddle.net/2q4Sd/2/
window.addEvent('mousemove', function (event) {
draw(event.event.clientX);
});
function draw(mouseX) {
ctx.beginPath();
ctx.strokeStyle = "black";
ctx.lineWidth = 1;
ctx.moveTo(mouseX, 0);
ctx.lineTo(mouseX, canvas.height);
ctx.stroke();
ctx.closePath();
}