I'm having trouble in mouse coordinates when drawing at canvas of HTML5. I'm using JavaScript to draw @ canvas.
Here is my current code of locating mouse pointer inside the canvas:
$('#canvasID').mousedown(function(e) {
// Mouse down location
var mouseX = e.pageX - this.offsetLeft;
var mouseY = e.pageY -
this.offsetTop;
});
Of course my pages has a lot of includes, like I include header and menu box.
How can the mouse pointer be precise inside the canvas esp. from different resolution of pc?