module:extras/camera.InputTracker

Back to documentation index.

### new module:extras/camera.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

### module:extras/camera~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

### module:extras/camera~InputTracker.ADD (constant)

Key code for the plus key.

Default Value: 107

### module:extras/camera~InputTracker.ALT (constant)

Key code for the return key.

Default Value: 18

### module:extras/camera~InputTracker.CTRL (constant)

Key code for the return key.

Default Value: 17

### module:extras/camera~InputTracker.DELETE (constant)

Key code for the delete key.

Default Value: 46

### module:extras/camera~InputTracker.DOWN (constant)

Key code for the down arrow key.

Default Value: 40

### module:extras/camera~InputTracker.END (constant)

Key code for the end key.

Default Value: 35

### module:extras/camera~InputTracker.ENTER (constant)

Key code for the enter key.

Default Value: 13

### module:extras/camera~InputTracker.ESC (constant)

Key code for the return key.

Default Value: 27

### module:extras/camera~InputTracker.HOME (constant)

Key code for the home key.

Default Value: 36

### module:extras/camera~InputTracker.LEFT (constant)

Key code for the left arrow key.

Default Value: 37

### module:extras/camera~InputTracker.PAGEDOWN (constant)

Key code for the page down key.

Default Value: 34

### module:extras/camera~InputTracker.PAGEUP (constant)

Key code for the page up key.

Default Value: 33

### module:extras/camera~InputTracker.RETURN (constant)

Key code for the return key.

Default Value: 10

### module:extras/camera~InputTracker.RIGHT (constant)

Key code for the right arrow key.

Default Value: 39

### module:extras/camera~InputTracker.SHIFT (constant)

Key code for the shift key.

Default Value: 16

### module:extras/camera~InputTracker.SPACE (constant)

Key code for the space bar.

Default Value: 32

### module:extras/camera~InputTracker.SUBTRACT (constant)

Key code for the minus key.

Default Value: 109

### module:extras/camera~InputTracker.TAB (constant)

Key code for the tab key.

Default Value: 9

### module:extras/camera~InputTracker.UP (constant)

Key code for the up arrow key.

Default Value: 38

### module:extras/camera~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

### module:extras/camera~InputTracker#deltaXY

Deprecated: Yes

An alias for InputTracker#mousePos.

### module:extras/camera~InputTracker#leftButton

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

Type: boolean

### module:extras/camera~InputTracker#middleButton

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

Type: boolean

### module:extras/camera~InputTracker#rightButton

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

Type: boolean

### module:extras/camera~InputTracker#dispose()

Disposes all resources used by this input tracker.

Return Value

Return value. (Type: Object)

### module:extras/camera~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)

### module:extras/camera~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:<ul>

  • cx - X coordinate of the current mouse position.
  • cx - Y coordinate of the current mouse position.
  • x - X component of the delta mouse position.
  • y - Y component of the delta mouse position.
  • ticks - The delta mouse wheel position. </ul> If this object's update method wasn't called, all these values will be 0. (Type: Object) ### module:extras/camera~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 * `func` (Type: function)
    A function. #### Return Value Return value. (Type: Object) ### module:extras/camera~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.](index.html)