javascript

Drawing pointer(mouse coordinates) for canvas of HTML5  #angularjs #reactjs

  • Long & late answer, just found this as I am playing with canvas right now πŸ™‚ Hope it still helps someone.
  • How can the mouse pointer be precise inside the canvas esp.
  • Stack Overflow works best with JavaScript enabled
  • I’m using JavaScript to draw @ canvas.
  • Inside $(‘#canvasID’).mousedown(function(e) { e.offsetX and e.offsetY should have the coordinates relative to the top-left corner of the canvas.

Inside $(‘#canvasID’).mousedown(function(e) { e.offsetX and e.offsetY should have the coordinates relative to the top-left corner of the canvas. For a quick and dirty way to see everything in e(vent), dump the contents in a

with

@ng_real_ninja: Drawing pointer(mouse coordinates) for canvas of HTML5 #angularjs #reactjs

I’m having trouble in mouse coordinates when drawing at canvas of HTML5. I’m using JavaScript to draw @ canvas.

Here is my current code of locating mouse pointer inside the canvas:

Of course my pages has a lot of includes, like I include header and menu box.

How can the mouse pointer be precise inside the canvas esp. from different resolution of pc?

I didn’t post this as an answer because there is no clear question. Could you explain (in the question) what problem you are having? – Erno de Weerd Nov 24 ’11 at 7:27

A bit, a nibble or byte?

When to say “I need money” as opposed to “I need the money”?

javascript