InputTracker

Back to documentation index.

InputTracker(element)

A class for tracking key press, mouse, touch, and mouse wheel events.

This class is considered a supplementary class to the Public Domain HTML 3D Library and is not considered part of that library.

Parameters

Members

Methods

InputTracker.A (constant)

Key code for the A key. Add 1 through 25 to get the keys for the other letters of the English alphabet.

Default Value: 65

InputTracker.ADD (constant)

Key code for the plus key.

Default Value: 107

InputTracker.ALT (constant)

Key code for the return key.

Default Value: 18

InputTracker.CTRL (constant)

Key code for the return key.

Default Value: 17

InputTracker.DELETE (constant)

Key code for the delete key.

Default Value: 46

InputTracker.DOWN (constant)

Key code for the down arrow key.

Default Value: 40

InputTracker.END (constant)

Key code for the end key.

Default Value: 35

InputTracker.ENTER (constant)

Key code for the enter key.

Default Value: 13

InputTracker.ESC (constant)

Key code for the return key.

Default Value: 27

InputTracker.HOME (constant)

Key code for the home key.

Default Value: 36

InputTracker.LEFT (constant)

Key code for the left arrow key.

Default Value: 37

InputTracker.PAGEDOWN (constant)

Key code for the page down key.

Default Value: 34

InputTracker.PAGEUP (constant)

Key code for the page up key.

Default Value: 33

InputTracker.RETURN (constant)

Key code for the return key.

Default Value: 10

InputTracker.RIGHT (constant)

Key code for the right arrow key.

Default Value: 39

InputTracker.SHIFT (constant)

Key code for the shift key.

Default Value: 16

InputTracker.SPACE (constant)

Key code for the space bar.

Default Value: 32

InputTracker.SUBTRACT (constant)

Key code for the minus key.

Default Value: 109

InputTracker.TAB (constant)

Key code for the tab key.

Default Value: 9

InputTracker.UP (constant)

Key code for the up arrow key.

Default Value: 38

InputTracker.ZERO (constant)

Key code for the 0 key. Add 1 through 9 to get the keys for the other basic digits 1 through 9.

Default Value: 48

InputTracker#deltaXY

Deprecated: Yes

An alias for InputTracker#mousePos.

InputTracker#dispose()

Disposes all resources used by this input tracker.

Return Value

Return value. (Type: Object)

InputTracker#getKey()

Gets whether a key is pressed, as detected by this input tracker.

Return Value

key Key code of the key to check. (Type: number)

InputTracker#mousePos()

Returns the current mouse position, delta mouse position, and delta mouse wheel position (see the "update" method).

Return Value

An object containing the following keys:

If this object's update method wasn't called, all these values will be 0. (Type: Object)

InputTracker#mousewheel(func)

Deprecated: Will be removed in the future. Use the mousePos method to find out whether the user has rotated the mouse wheel.

Sets a function to handle mouse wheel events.

Parameters

Return Value

Return value. (Type: Object)

InputTracker#update()

Retrieves the current position of the mouse within the page's client area, as detected by the input tracker and calculates the "delta mouse position", or the difference between those values and the values they had the last time this method was called. If this method wasn't called before for this tracker, the delta mouse position is (0, 0). If the current position of the mouse is unknown, it's (0, 0) instead.

Also retrieves the "delta mouse wheel position", or the offset, in "ticks", from the mouse wheel position at the last time this method was called (or the time this tracker was created if it wasn't) to the current mouse wheel position.

Return Value

This object. (Type: InputTracker)

Back to documentation index.