Created
February 16, 2012 23:17
-
-
Save phated/1848675 to your computer and use it in GitHub Desktop.
idea for mouse location
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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