Manual Reference Source
public class | source

Keyboard

Constructor Summary

Public Constructor
public

constructor(viewer: Object)

Keyboard's constructor

Member Summary

Public Members
public

The current key code.

Method Summary

Public Methods
public

Add key down event listener.

public

Add key up event listener.

public

Release all resources in the keyboard object.

Public Constructors

public constructor(viewer: Object) source

Keyboard's constructor

Params:

NameTypeAttributeDescription
viewer Object

The viewer object.

Public Members

public key: number source

The current key code.

Example:

var keyboard = viewer.addInput(new Modelo.View.Input.Keyboard(viewer));
keyboard.addKeyDownListener(function(keyboard) {
     console.log(keyboard);
});

Public Methods

public addKeyDownListener(cbk: function) source

Add key down event listener.

Params:

NameTypeAttributeDescription
cbk function

The key down callback. Return true if you want to stop the event propogation.

public addKeyUpListener(cbk: function) source

Add key up event listener.

Params:

NameTypeAttributeDescription
cbk function

The key up callback. Return true if you want to stop the event propogation.

public destroy() source

Release all resources in the keyboard object.