Skip to content

Instantly share code, notes, and snippets.

@phated
Created February 16, 2012 23:17
Show Gist options
  • Select an option

  • Save phated/1848675 to your computer and use it in GitHub Desktop.

Select an option

Save phated/1848675 to your computer and use it in GitHub Desktop.
idea for mouse location
getMouseLoc: (event) ->
coordsM = domGeom.position @canvas
return { x: Math.round(event.clientX - coordsM.x), y: Math.round(event.clientY - coordsM.y) } unless box?
return { x: (event.clientX - coordsM.x) / @box.scale, y: (event.clientY - coordsM.y) / @box.scale }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment