new Keyboard(viewer)
Keyboard Manager that handles keyboard events and manage FORGE.KeyBindings.
Parameters:
Name | Type | Description |
---|---|---|
viewer |
FORGE.Viewer | FORGE.Viewer reference. |
- Source:
- To Do:
-
- fix keyout for several keybinding on a same keycode but different keysout configuration ?
Extends
Members
(readonly) alive :boolean
Get the alive flag value of the object.
Type:
- boolean
- Inherited From:
- Source:
(readonly) className :string
Get the class name of the object.
Type:
- string
- Inherited From:
- Source:
data :*
Get and set any custom data you want to associate to this object.
Type:
- *
- Inherited From:
- Source:
debug :boolean
Get and set the debug flag.
Type:
- boolean
- Inherited From:
- Source:
enabled :boolean
Gets or sets the enabled status of the keyboard.
Type:
- boolean
- Source:
(readonly) onDestroy :FORGE.EventDispatcher
Get the onDestroy FORGE.EventDispatcher, this event is emitted at the end of the destroy sequence.
Type:
- Inherited From:
- Source:
(readonly) tags :Array
Get the tags associated to this object.
Type:
- Array
- Inherited From:
- Source:
(readonly) uid :string
Get the uid of the object.
Type:
- string
- Inherited From:
- Source:
warning :boolean
Get and set the warning flag.
Type:
- boolean
- Inherited From:
- Source:
Methods
addBinding(keyBinding) → {boolean}
Add a KeyBinding to the Keyboard's keyBinding array.
Parameters:
Name | Type | Description |
---|---|---|
keyBinding |
FORGE.KeyBinding | The FORGE.KeyBinding you want to add. |
- Source:
Returns:
Returns true if it's correctly added, false if it's already in or if wrong type.
- Type
- boolean
destroy()
Destroy sequence.
- Overrides:
- Source:
getBindings(keyCode) → {Array.<FORGE.KeyBinding>}
Get a FORGE.KeyBinding associated to a key code.
Parameters:
Name | Type | Description |
---|---|---|
keyCode |
number | The key code for which you search a FORGE.KeyBinding. |
- Source:
Returns:
Returns a FORGE.KeyBinding object if found, null if not.
- Type
- Array.<FORGE.KeyBinding>
isKeyOut(keyCode) → {boolean}
Ask if a keyCode is considered as a keyOut at this time.
Parameters:
Name | Type | Description |
---|---|---|
keyCode |
number | The keyCode you want to know if it's a key out. |
- Source:
Returns:
Returns true if keyCode is considered as a keyOut, false if not.
- Type
- boolean
isKeyPressed(keyCode) → {boolean}
Ask if a keyCode is in the keyPressed array.
Parameters:
Name | Type | Description |
---|---|---|
keyCode |
number | The keyCode you want to know if it's in the keyPressed array. |
- Source:
Returns:
Returns true if the keyCode is considered as a keyPressed, false if not.
- Type
- boolean
log(value)
Basic log method, log a string in the console if debug is enabled.
Parameters:
Name | Type | Description |
---|---|---|
value |
* | The value you want to log in the console. |
- Inherited From:
- Source:
removeBinding(keyBinding) → {boolean}
Remove a FORGE.KeyBinding from the FORGE.Keyboard object.
Parameters:
Name | Type | Description |
---|---|---|
keyBinding |
FORGE.KeyBinding | number | A FORGE.KeyBinding or a Number that represent a key code. |
- Source:
Returns:
Returns true if it's removed, false if not found.
- Type
- boolean
update()
Update method called by the viewer main loop.
- Source:
warn(valuenullable)
Basic warn method, log a warn string in the console if warning is enabled.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
value |
string | Object |
<nullable> |
The value you want to warn in the console. |
- Inherited From:
- Source: