Skip to main content

class.ControllerInput

API > ControllerInput

Class: ControllerInput

The input source of camera controllers.

Remarks

This class abstract away input gestures, such as mouse, keyboard and touch event into a unified model. It does this by defining a set of axes that represents an imagined gamepad/joystick input device for each class of input gestures. The assumption is that each of these axes may be bound to a pair of keyboard keys, e.g. A and D, or some input position coordinate, e.g. the mouse x position for left/right motion. All of these axes are updated independently, i.e. it is possible to move a camera with both keyboard and mouse simultaneously. It is up to each camera controller to scale and apply each of these axes into an actual motion of the camera.

Constructors

constructor

new ControllerInput(domElement?): ControllerInput

Parameters

ParameterTypeDescription
domElement?HTMLElementThe HTMLElement to subscribe to input events from.

Returns

ControllerInput

Source

@novorender/web_app/controller/input.ts:50

Properties

axes

readonly axes: ControllerAxes

The current values of each input axis.

Source

@novorender/web_app/controller/input.ts:21


callbacks

callbacks: undefined | ContollerInputContext

A set of optional callbacks for controllers that wants to handle certain input events themselves.

Source

@novorender/web_app/controller/input.ts:18


disableWheelOnShift

disableWheelOnShift: boolean = false

Ignore wheel events when shift is pressed. Default is false

Source

@novorender/web_app/controller/input.ts:45


domElement

readonly domElement: HTMLElement

The underlying HTMLElement providing input events.

Source

@novorender/web_app/controller/input.ts:15


mouseMoveSensitivity

mouseMoveSensitivity: number = 0

Consider mouse started moving after mouse passed this distance. Default is 0

Source

@novorender/web_app/controller/input.ts:42


touchPoints

touchPoints: readonly TouchContactPoint[] = []

The current list of individual touch contact points.

Source

@novorender/web_app/controller/input.ts:24


usePointerLock

usePointerLock: boolean = true

Whether to use mouse pointer lock or not.

Source

@novorender/web_app/controller/input.ts:39

Accessors

hasShift

get hasShift(): boolean

Whether the shift key is currently pressed or not.

Returns

boolean

Source

@novorender/web_app/controller/input.ts:83


height

get height(): number

Return the client height of the input domElement.

Returns

number

Source

@novorender/web_app/controller/input.ts:68


multiplier

get multiplier(): number

Current multiplier applied to motion via the Control/Alt keys.

Returns

number

Source

@novorender/web_app/controller/input.ts:73


width

get width(): number

Return the client width of the input domElement.

Returns

number

Source

@novorender/web_app/controller/input.ts:63


zoomPos

get zoomPos(): number[]

The pixel position centering zoom gestures.

Returns

number[]

Source

@novorender/web_app/controller/input.ts:94

Remarks

This is typically the current cursor position while using the mouse scroll wheel, or the center position between touch points in a pinch gesture.

Methods

animate

animate(elapsedTime): void

Apply time-related state updates.

Parameters

ParameterTypeDescription
elapsedTimenumberThe amount of milliseconds passed since the last call to this function.

Returns

void

Source

@novorender/web_app/controller/input.ts:389


axesEmpty

axesEmpty(): boolean

Determine if axes are all at their default/neutral state.

Returns

boolean

Source

@novorender/web_app/controller/input.ts:435


connect

protected connect(): void

Subscribe to input events from domElement.

Returns

void

Source

@novorender/web_app/controller/input.ts:103


disconnect

protected disconnect(): void

Unsubscribe to input events from domElement.

Returns

void

Source

@novorender/web_app/controller/input.ts:125


dispose

dispose(): void

Unsubscribe from input events.

Returns

void

Source

@novorender/web_app/controller/input.ts:58


isScrolling

isScrolling(): boolean

Indicate whether the mouse scroll wheel has recently been moved.

Returns

boolean

Source

@novorender/web_app/controller/input.ts:157


resetAxes

resetAxes(): void

Reset axes to their default/neutral state.

Returns

void

Source

@novorender/web_app/controller/input.ts:407