https://github.com/obsius/mousetouch
A small library to provide consistent mouse and touch interactions.
https://github.com/obsius/mousetouch
Last synced: about 1 year ago
JSON representation
A small library to provide consistent mouse and touch interactions.
- Host: GitHub
- URL: https://github.com/obsius/mousetouch
- Owner: obsius
- Created: 2019-03-08T02:46:24.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-07-23T02:25:31.000Z (almost 2 years ago)
- Last Synced: 2025-04-09T19:18:25.081Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 83 KB
- Stars: 3
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Mousetouch
Mousetouch is a small, lightweight library to provide consistent mouse and touch interactions.
It only support touch interactions that can be done with the mouse also.
## Integrating
Mousetouch has defined defaults and can be used by constructing it.
### Reference
Events fired are of the format:
```js
{
x: '',
y: '',
event: ''
}
```
```js
import Mousetouch from 'mousetouch';
const Mousetouch = require('mousetouch');
const mousetouch = new Mousetouch('', {
clickThreshold: '',
dblClickThreshold: '',
moveThreshold: ''
});
mousetouch.on('mousemove', (e) => { console.log(e) }); // { x, y, event }
mousetouch.on('mousedown', (e) => {});
mousetouch.on('mouseup', (e) => {});
mousetouch.on('click', (e) => {});
mousetouch.on('dblclick', (e) => {});
```
## Contributing
Feel free to make changes and submit pull requests whenever.
## License
Mousetouch uses the [MIT](https://opensource.org/licenses/MIT) license.