| javascript Programming Glossary: e.offsetyGetting mouse location in canvas http://stackoverflow.com/questions/1114465/getting-mouse-location-in-canvas  e var mouseX mouseY if e.offsetX mouseX e.offsetX mouseY e.offsetY else if e.layerX mouseX e.layerX mouseY e.layerY  do something.. 
 event.offsetX in Firefox http://stackoverflow.com/questions/11334452/event-offsetx-in-firefox  var ctx canvas.getContext 2d var x e.offsetX var y e.offsetY ctx.fillRect x y 1 1  script head body onload main div style.. layerY var x e.offsetX undefined e.layerX e.offsetX var y e.offsetY undefined e.layerY e.offsetY FIDDLE  share improve this answer.. 
 How to drag images / objects within Canvas? http://stackoverflow.com/questions/18333936/how-to-drag-images-objects-within-canvas  e clearTooltip isDown true  startCoords  e.offsetX last 0 e.offsetY last 1  canvas.onmouseup function e  isDown false  last  e.offsetX.. false  last  e.offsetX startCoords 0 set last coordinates e.offsetY startCoords 1  canvas.onmousemove function e  var x e.offsetX.. 1  canvas.onmousemove function e  var x e.offsetX  var y e.offsetY transX parseInt parseInt x parseInt startCoords 0  transY parseInt.. 
 Get pixel color from canvas, on mouseover http://stackoverflow.com/questions/6735470/get-pixel-color-from-canvas-on-mouseover  e var mouseX mouseY if e.offsetX  mouseX e.offsetX mouseY e.offsetY  else if e.layerX  mouseX e.layerX mouseY e.layerY  var c ctx.getImageData.. 
 |