Class: TapCounter

TapCounter

Counts presses in a quick sequence at one spot, as a multi-click: the second within the window and the distance is a double click, the third a triple click, and anything else starts over.

The component keeps its own count rather than using Pixi's detail, which counts per pointer id — touch browsers issue a new id for every touch, so it stays at 1 there — and counts any quick clicks on the component wherever they land.

Internal to Input; not exported from the package.

new TapCounter ()

Methods

next (x, y, touch, now) number

Records a press and returns its place in the sequence, starting at 1.

Name Type Default Description
x number

horizontal position of the press; any space, as long as it is the same throughout.

y number

vertical position of the press.

touch boolean false

whether it is a finger, which gets a wider spot and a shorter window.

now

time of the press, in milliseconds.

Returns:
Type Description
number