Вот код для стробирования координат холста
Call the DumpInfo function in the html canvas tag like
<canvas id="canvas" width="600" height="200" onmousedown="DumpInfo(event)"></canvas>
Bellow two functions defined
<script type = "text/javascript" >
function DumpInfo(event) {
var info = document.getElementById("canvas");
//info.innerHTML += event.type + ", ";
var pos = getMousePos(info, event);
alert(pos.x);
alert(pos.y);
}
function getMousePos(canvas, evt) {
var rect = canvas.getBoundingClientRect();
return {
x: evt.clientX - rect.left,
y: evt.clientY - rect.top
};
}
</script>