Skip to content

obsius/mousetouch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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:

{
	x: '<number>',
	y: '<number>',
	event: '<original event>'
}
import Mousetouch from 'mousetouch';
const Mousetouch = require('mousetouch');

const mousetouch = new Mousetouch('<dom element to listen to>', {
	clickThreshold: '<default 200 ms>',
	dblClickThreshold: '<default 500ms>',
	moveThreshold: '<default 2px>'
});

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 license.

About

A small library to provide consistent mouse and touch interactions.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published