How would I get the coordinates of a mouse click on an HTML5 canvas using Javascript?
Sorry I don't have a code example or anything, but this is a pretty simple question.
How would I get the coordinates of a mouse click on an HTML5 canvas using Javascript?
Sorry I don't have a code example or anything, but this is a pretty simple question.
$("canvas").mousedown(function(e) {
console.log('Clicked: ' + e.offsetX + ', ' + e.offsetY);
});
P.S. This solution assumes that you're using jQuery. This is definitely doable without jQuery.