1.5.1 • Published 7 years ago

tinytouch v1.5.1

Weekly downloads
38
License
MIT
Repository
github
Last release
7 years ago

tinytouch

Tiny JavaScript touch library designed to work with mouse and touch devices.

Usage

import { DOWN, MOVE, UP, CANCEL, DRAG }, createTouch from 'tinytouch'

const touch = createTouch(document.body)
const printEvent = (event) => console.log

touch
  .on(DOWN, printEvent)
  .on(MOVE, printEvent)
  .on(DRAG, printEvent)
  .on(UP, printEvent)
  .on(CANCEL, printEvent)

Events

Note: only a single (first) touch event is handled.

NameDescription
DOWNmousedown or touchstart
MOVEmousemove or touchmove
UPmouseup or touchend
CANCELmouseout or touchcancel
DRAGDOWN combined with MOVE

Each event has the following properties:

PropertyDescription
sourceSource event from browser
xx pixel position
yy pixel position
dxChange in x from previous event (or zero)
dyChange in y from previous event (or zero)
txTotal change in x from initial DOWN event (or zero)
tyTotal change in y from initial DOWN event (or zero)
typeMouse or Touch

Note DRAG is DOWN combined with MOVE.

1.5.1

7 years ago

1.5.0

7 years ago

1.4.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago