Viewer.addInput() method

Add an input method to this viewer, e.g., mouse.

Signature:

addInput(input: Input): number;

Parameters

ParameterDescription
inputMust be the instance of Modelo.View.Input that is compatible with current platform.

Returns:

number

The input id in this viewer. -1 is returned if it fails to add this input.

Example

var keyboard = new Modelo.View.Input.Keyboard(viewer);
viewer.addInput(keyboard);
keyboard.addKeyUpListener(keyboard => {
    if (keyboard.key === 27) {
        viewer.destroy();
    }
});