Answer the question
In order to leave comments, you need to log in
Click on canvas - how to get coordinates correctly?
The question is generally obvious, but I did not find a convenient code (I'm just a fan of programming in JavaScript)
Regarding the window and the document, the coordinates are obtained easily. How about canvas?
Answer the question
In order to leave comments, you need to log in
x = pageY - canvasElement.offsetLeft;
y = pageX - canvasElement.offsetTop;
where pageY and pageX are coordinates relative to the document.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question