Menu - Top - Home - Donate to Me

H3DU.InputTracker

Back to documentation index.

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

To use this class, you must include the script "extras/camera.js"; the class is not included in the "h3du_min.js" file which makes up the HTML 3D Library. Example:

<script type="text/javascript" src="extras/camera.js"></script>

Parameters

Members

Methods

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

H3DU.InputTracker.ADD (constant)

Key code for the plus key.

Default Value: 107

H3DU.InputTracker.ALT (constant)

Key code for the return key.

Default Value: 18

H3DU.InputTracker.CTRL (constant)

Key code for the return key.

Default Value: 17

H3DU.InputTracker.DELETE (constant)

Key code for the delete key.

Default Value: 46

H3DU.InputTracker.DOWN (constant)

Key code for the down arrow key.

Default Value: 40

H3DU.InputTracker.END (constant)

Key code for the end key.

Default Value: 35

H3DU.InputTracker.ENTER (constant)

Key code for the enter key.

Default Value: 13

H3DU.InputTracker.ESC (constant)

Key code for the return key.

Default Value: 27

H3DU.InputTracker.HOME (constant)

Key code for the home key.

Default Value: 36

H3DU.InputTracker.LEFT (constant)

Key code for the left arrow key.

Default Value: 37

H3DU.InputTracker.PAGEDOWN (constant)

Key code for the page down key.

Default Value: 34

H3DU.InputTracker.PAGEUP (constant)

Key code for the page up key.

Default Value: 33

H3DU.InputTracker.RETURN (constant)

Key code for the return key.

Default Value: 10

H3DU.InputTracker.RIGHT (constant)

Key code for the right arrow key.

Default Value: 39

H3DU.InputTracker.SHIFT (constant)

Key code for the shift key.

Default Value: 16

H3DU.InputTracker.SPACE (constant)

Key code for the space bar.

Default Value: 32

H3DU.InputTracker.SUBTRACT (constant)

Key code for the minus key.

Default Value: 109

H3DU.InputTracker.TAB (constant)

Key code for the tab key.

Default Value: 9

H3DU.InputTracker.UP (constant)

Key code for the up arrow key.

Default Value: 38

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

H3DU.InputTracker#deltaXY

Deprecated: Yes

An alias for H3DU.InputTracker#mousePos.

H3DU.InputTracker#leftButton

True if the left mouse button was detected as being down.

Type: Boolean

H3DU.InputTracker#middleButton

True if the middle mouse button was detected as being down.

Type: Boolean

H3DU.InputTracker#rightButton

True if the right mouse button was detected as being down.

Type: Boolean

H3DU.InputTracker#dispose()

Disposes all resources used by this input tracker.

Return Value

Return value. (Type: Object)

H3DU.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)

H3DU.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)

H3DU.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)

H3DU.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: H3DU.InputTracker)

Back to documentation index.