You just need to take the ClientX and Y and subtract the position of the canvas from them.
You just need to take the ClientX and Y and subtract the position of the canvas from them. This example is unnecessarily verbose, just to show the steps: var canvas = document. GetElementById('game'); var canvasX, canvasY; canvas.
AddEventListener('click', function(event) { canvasX = canvas. OffsetLeft; canvasY = canvas. OffsetTop; var eventX = event.
ClientX; var eventY = event. ClientY; var relX = eventX - canvasX; var relY = eventY - canvasY; alert('X = ' + relX + ', Y = ' + relY); }); Working sample: jsfiddle.net/JfhJF.
I'm pretty sure you can tell what's happening. You do not have the coordinates relative to your canvas, but relative to your viewport. It also depends on your browser whether or not they include padding.
Convert them to normal coordinates. In your case this involves substracting the offset of the canvas.
OffsetX is not working in Firefox 3.6 – thomas Dec 2 '10 at 14:27 sorry, don't use offsetX, I edited the post – buddhabrot Dec 2 '10 at 14:30.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.