An open API service indexing awesome lists of open source software.

https://github.com/codewell/get-canvas-mouse-position

Get the position of a mouse on a canvas triggered by an event
https://github.com/codewell/get-canvas-mouse-position

Last synced: 11 months ago
JSON representation

Get the position of a mouse on a canvas triggered by an event

Awesome Lists containing this project

README

          

# @codewell/get-canvas-mouse-position
Get the position of a mouse on a canvas triggered by an event.

## Installation
```
npm install @codewell/get-canvas-mouse-position
```

## Basic usage
```JavaScript
import getCanvasMousePosition from '@codewell/get-canvas-mouse-position':

const handleClick = (event) => {
const mousePosition = getCanvasMousePosition(event);
const {x, y} = mousePosition; // The coordinate that was clicked on the canvas
}

return (

)

```