Skip to main content

@novorender/api / ControllerInput

Class: ControllerInput

Defined in: @novorender/src/web_app/controller/input.ts:13

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.

Accessors

hasShift

Get Signature

get hasShift(): boolean;

Defined in: @novorender/src/web_app/controller/input.ts:99

Whether the shift key is currently pressed or not.

Returns

boolean


height

Get Signature

get height(): number;

Defined in: @novorender/src/web_app/controller/input.ts:84

Return the client height of the input domElement.

Returns

number


mouseButtonDown

Get Signature

get mouseButtonDown(): boolean;

Defined in: @novorender/src/web_app/controller/input.ts:121

Returns

boolean


multiplier

Get Signature

get multiplier(): number;

Defined in: @novorender/src/web_app/controller/input.ts:89

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

Returns

number


width

Get Signature

get width(): number;

Defined in: @novorender/src/web_app/controller/input.ts:79

Return the client width of the input domElement.

Returns

number


zoomPos

Get Signature

get zoomPos(): number[];

Defined in: @novorender/src/web_app/controller/input.ts:110

The pixel position centering zoom gestures.

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.

Returns

number[]

Constructors

Constructor

new ControllerInput(domElement?, listenToDocumentEvents?): ControllerInput;

Defined in: @novorender/src/web_app/controller/input.ts:65

Parameters

ParameterTypeDefault valueDescription
domElement?HTMLElementundefinedThe HTMLElement to subscribe to input events from.
listenToDocumentEvents?booleantrue-

Returns

ControllerInput

Methods

animate()

animate(elapsedTime): void;

Defined in: @novorender/src/web_app/controller/input.ts:519

Apply time-related state updates.

Parameters

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

Returns

void


axesEmpty()

axesEmpty(): boolean;

Defined in: @novorender/src/web_app/controller/input.ts:565

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

Returns

boolean


connect()

protected connect(): void;

Defined in: @novorender/src/web_app/controller/input.ts:126

Subscribe to input events from domElement.

Returns

void


disconnect()

protected disconnect(): void;

Defined in: @novorender/src/web_app/controller/input.ts:165

Unsubscribe to input events from domElement.

Returns

void


dispose()

dispose(): void;

Defined in: @novorender/src/web_app/controller/input.ts:74

Unsubscribe from input events.

Returns

void


isScrolling()

isScrolling(): boolean;

Defined in: @novorender/src/web_app/controller/input.ts:236

Indicate whether the mouse scroll wheel has recently been moved.

Returns

boolean


replayLastMouseMoveAsMouseDown()

replayLastMouseMoveAsMouseDown(): void;

Defined in: @novorender/src/web_app/controller/input.ts:383

Returns

void


resetAxes()

resetAxes(): void;

Defined in: @novorender/src/web_app/controller/input.ts:537

Reset axes to their default/neutral state.

Returns

void

Properties

axes

readonly axes: ControllerAxes;

Defined in: @novorender/src/web_app/controller/input.ts:21

The current values of each input axis.


callbacks

callbacks: 
| undefined
| ContollerInputContext;

Defined in: @novorender/src/web_app/controller/input.ts:18

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


disableWheelOnShift

disableWheelOnShift: boolean = false;

Defined in: @novorender/src/web_app/controller/input.ts:60

Ignore wheel events when shift is pressed. Default is false


domElement

readonly domElement: HTMLElement;

Defined in: @novorender/src/web_app/controller/input.ts:15

The underlying HTMLElement providing input events.


mouseMoveSensitivity

mouseMoveSensitivity: number = 0;

Defined in: @novorender/src/web_app/controller/input.ts:57

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


touchPoints

touchPoints: readonly TouchContactPoint[] = [];

Defined in: @novorender/src/web_app/controller/input.ts:24

The current list of individual touch contact points.


usePointerLock

usePointerLock: boolean = true;

Defined in: @novorender/src/web_app/controller/input.ts:54

Whether to use mouse pointer lock or not.