Members
# keyData
The data passed by the InputManager for a keyDown, keyUp, or keyRepeat event.
Properties
Name | Type | Description |
---|---|---|
scope |
string | key |
scope |
boolean | shift pressed |
scope |
boolean | alt pressed |
scope |
boolean | ctrl pressed |
scope |
boolean | meta pressed |
# pointerData
The data passed by the InputManager for pointer events.
Properties
Name | Type | Description |
---|---|---|
id |
string | For multitouch devices, the touch's unique ID. |
type |
string | "mouse" or "touch". |
button |
number | If a mouse button, which one. |
xy |
Array.<number> | The screen coordinates of the event. (or the xy delta) |
# zoomData
The data passed by the InputManager for multitouch zoom events.
Properties
Name | Type | Description |
---|---|---|
mid |
Array.<number> | The xy coordinates of the midpoint between the two touch contacts. |
zoom |
number | The proportional distance between the two touch contacts (starts at 1). |
dial |
dial | The rotation angle in radians of the two touch contacts (starts at 0). |
Events
# click
Generic touch or mouse click event.
Properties
Name | Type | Description |
---|---|---|
scope |
String |
|
event |
String |
|
# chordDown
Fired when the final key to complete a chord is pressed. The event is the name of the chord + "Down".
Properties
Name | Type | Description |
---|---|---|
scope |
String |
|
event |
String |
|
# chordUp
Fired when any key of a pressed chord is released. The event is the name of the chord + "Up".
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
# pointerLock
Fired when the app enters or exits pointerlock mode.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
state |
boolean | Whether the app is currently in pointerlock |
# beforeResize
Fired immediately when the app window changes size. However, because of layout issues on iOS, this size may not reflect the actual window size when all layout is done. Most apps will want to use the resize event instead.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
size |
Array.<number> | [x,y] size of the window |
# resize
Fired when the app window changes size.
Note: This event has a built-in delay to allow iOS window layout to settle. See beforeResize.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
size |
Array.<number> | [x,y] size of the window |
# focus
Fired when the app window gets focus.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
# blur
Fired when the app window loses focus.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
# keyDown
Fired when a key is pressed. The data object contains the name of the key along with booleans for various modifier keys.
Alternatively, you can subscribe to the event <key> + Down
which will report single key presses. The data object is the same.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
keyData | {key, shift, alt, ctrl, meta} |
this.subscribe("input", "keyDown" data => { console.log(data.key + " was pressed!")});
this.subscribe("input", "aDown" data => { if (data.shift) console.log("A was pressed!")});
# keyUp
Fired when a key is released. The data object contains the name of the key along with booleans for various modifier keys.
Alternatively, you can subscribe to the event <key> + Up
which will report single key releases. The data object is the same.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
keyData | {key, shift, alt, ctrl, meta} |
this.subscribe("input", "keyUp" data => { console.log(data.key + " was released!")});
this.subscribe("input", "aUp" data => { console.log("a was released!") });
# keyRepeat
Fired repeatedly while a key is held down. The data object contains the name of the key along with booleans for various modifer keys.
Alternatively, you can subscribe to the event <key> + Repeat
which will fire when a single key is held down. The data object is the same.
Warning: This generates a lot of events! Do not subscribe to this in the model, or you will overload the reflector!
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
keyData | {key, shift, alt, ctrl, meta} |
this.subscribe("input", "keyRepeat" data => { console.log(data.key + " held down!")});
this.subscribe("input", "aRepeat" data => { console.log("a held down!") });
# pointerDown
Fired when the mouse is clicked, or a touchscreen is touched.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy} |
this.subscribe("input", "pointerDown" data => { console.log(data.xy)}); // Prints the xy position of the click or touch.
# pointerUp
Fired when a mouse click or touch is released.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy} |
this.subscribe("input", "pointerUp" data => { console.log(data.xy)}); // Prints the final xy position of the click or touch.
# pointerMove
Fired when the mouse is moved, or a touch is dragged.
Warning: This generates a lot of events! Do not subscribe to this in the model, or you will overload the reflector!
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy} |
this.subscribe("input", "pointerMove" data => { console.log(data.xy)}); // Prints the current xy position of the cursor or touch.
# pointerDelta
Fired when the mouse is moved, or a touch is dragged. Similar to the pointerMove event, but instead of reporting the cursor's absolute xy position, it reports its change from the last pointer event. Use this if you're in pointerLock mode
Warning: This generates a lot of events! Do not subscribe to this in the model, or you will overload the reflector!
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy} |
this.subscribe("input", "pointerDelta" data => { console.log(data.xy)}); // Prints xy distance moved since the last delta event.
# tap
Fired when there's a brief press and release of the pointer.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy} |
this.subscribe("input", "tap" data => { console.log(data.xy)}); // Prints xy position of the tap
# doubleDown
Fired when there's a quick double press of the pointer
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy} |
this.subscribe("input", "doubleDown" data => { console.log(data.xy)}); // Prints xy position of the double press
# tripleDown
Fired when there's a quick triple press of the pointer
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy} |
this.subscribe("input", "tripleDown" data => { console.log(data.xy)}); // Prints xy position of the triple press
# swipeX
Fired when there's a quick horizontal swipe on a touch device. The pointerData passed by the event also includes a distance
member
that contains the distance of the swipe.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy, distance} |
this.subscribe("input", "swipeX" data => { console.log(data.distance)}); // The length of the swipe.
# swipeY
Fired when there's a quick vertical swipe on a touch device. The pointerData passed by the event also includes a distance
member
that contains the distance of the swipe.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
pointerData | {id, type, button, xy, distance} |
this.subscribe("input", "swipeY" data => { console.log(data.distance)}); // The length of the swipe.
# zoomStart
Fired when exactly two multitouch contacts appear on a touch device. This is interpreted as the start of a zoom sequence. During a zoom sequence the input manager tracks the midpoint between the contacts, and their separation and rotation relative to where they started.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
zoomData | {mid, zoom, dial} |
this.subscribe("input", "zoomStart" data => { console.log(data.mid)}); // The xy midpoint between the two contacts.
# zoomUpdate
Continuously fires while there are exactly two multitouch contacts on a touch device. This is interpreted as an ongoing zoom sequence. During a zoom sequence the input manager tracks the midpoint between the contacts, and their separation and rotation relative to where they started.
Warning: This generates a lot of events! Do not subscribe to this in the model, or you will overload the reflector!
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
zoomData | {mid, zoom, dial} |
this.subscribe("input", "zoomUpdate" data => { console.log(data.zoom)}); // The distance between the contacts relative to their starting distance.
# zoomEnd
Fired when a double touch event comes to an end, terminating the zoom sequence. The data contains the final midpoint between the contacts, and their final separation and rotation relative to where they started.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
data |
zoomData | {mid, zoom, dial} |
this.subscribe("input", "zoomEnd" data => { console.log(data.dial)}); // The final rotation of the double touch.
# wheel
Fired when the mouse wheel rotates.
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
delta |
number | The mouse wheel's rotation since the last event. |
# orientation
Fired by mobile devices that track their physical orientation. The event data is an object containing the device's pitch and yaw in radians.
Warning: This generates a lot of events! Do not subscribe to this in the model, or you will overload the reflector!
Properties
Name | Type | Description |
---|---|---|
scope |
string |
|
event |
string |
|
delta |
Object | {pitch, yaw} |