pixijs-input-devices 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +82 -18
- package/dist/index.cjs +1 -354
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +264 -145
- package/dist/index.mjs +1 -354
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -44,6 +44,24 @@ declare class GamepadJoystick {
|
|
|
44
44
|
/** A scalar -1.0 to 1.0 representing the Y-axis position on the stick */
|
|
45
45
|
get y(): number;
|
|
46
46
|
}
|
|
47
|
+
declare const ButtonCode: readonly [
|
|
48
|
+
"A",
|
|
49
|
+
"B",
|
|
50
|
+
"X",
|
|
51
|
+
"Y",
|
|
52
|
+
"LeftShoulder",
|
|
53
|
+
"RightShoulder",
|
|
54
|
+
"LeftTrigger",
|
|
55
|
+
"RightTrigger",
|
|
56
|
+
"Back",
|
|
57
|
+
"Start",
|
|
58
|
+
"LeftStick",
|
|
59
|
+
"RightStick",
|
|
60
|
+
"DPadUp",
|
|
61
|
+
"DPadDown",
|
|
62
|
+
"DPadLeft",
|
|
63
|
+
"DPadRight"
|
|
64
|
+
];
|
|
47
65
|
export declare abstract class CustomDevice {
|
|
48
66
|
readonly id: string;
|
|
49
67
|
readonly type = "custom";
|
|
@@ -65,21 +83,16 @@ export declare abstract class CustomDevice {
|
|
|
65
83
|
export declare class GamepadDevice {
|
|
66
84
|
source: Gamepad;
|
|
67
85
|
static defaultOptions: {
|
|
68
|
-
|
|
69
|
-
0: "trigger";
|
|
70
|
-
1: "navigateBack";
|
|
71
|
-
8: "navigateBack";
|
|
72
|
-
13: "navigateDown";
|
|
73
|
-
14: "navigateLeft";
|
|
74
|
-
15: "navigateRight";
|
|
75
|
-
12: "navigateUp";
|
|
76
|
-
};
|
|
77
|
-
joystickDeadzone: number;
|
|
86
|
+
navigationalBinds: Partial<Record<Button, NavigationIntent>>;
|
|
78
87
|
intent: {
|
|
79
88
|
joystickCommitSensitivity: number;
|
|
80
89
|
firstCooldownMs: number;
|
|
81
90
|
defaultCooldownMs: number;
|
|
82
91
|
};
|
|
92
|
+
vibration: {
|
|
93
|
+
enabled: boolean;
|
|
94
|
+
intensity: number;
|
|
95
|
+
};
|
|
83
96
|
};
|
|
84
97
|
/**
|
|
85
98
|
* Globally unique identifier for this gamepad slot.
|
|
@@ -87,39 +100,24 @@ export declare class GamepadDevice {
|
|
|
87
100
|
*/
|
|
88
101
|
readonly id: string;
|
|
89
102
|
readonly type = "gamepad";
|
|
103
|
+
/**
|
|
104
|
+
* Associate custom metadata with a device.
|
|
105
|
+
*/
|
|
106
|
+
meta: Record<string, any>;
|
|
107
|
+
lastUpdated: number;
|
|
90
108
|
/**
|
|
91
109
|
* Platform of this gamepad, useful for configuring standard
|
|
92
110
|
* button layouts or displaying branded icons.
|
|
93
111
|
* @example "playstation"
|
|
94
112
|
*/
|
|
95
113
|
platform: GamepadPlatform;
|
|
96
|
-
|
|
97
|
-
/** Configurable metadata. */
|
|
98
|
-
assignee?: any;
|
|
99
|
-
options: {
|
|
100
|
-
binds: {
|
|
101
|
-
0: "trigger";
|
|
102
|
-
1: "navigateBack";
|
|
103
|
-
8: "navigateBack";
|
|
104
|
-
13: "navigateDown";
|
|
105
|
-
14: "navigateLeft";
|
|
106
|
-
15: "navigateRight";
|
|
107
|
-
12: "navigateUp";
|
|
108
|
-
};
|
|
109
|
-
joystickDeadzone: number;
|
|
110
|
-
intent: {
|
|
111
|
-
joystickCommitSensitivity: number;
|
|
112
|
-
firstCooldownMs: number;
|
|
113
|
-
defaultCooldownMs: number;
|
|
114
|
-
};
|
|
115
|
-
};
|
|
114
|
+
options: typeof GamepadDevice.defaultOptions;
|
|
116
115
|
private _btnPrevState;
|
|
117
116
|
private _axisIntents;
|
|
118
117
|
private readonly _throttleIdLeftStickX;
|
|
119
118
|
private readonly _throttleIdLeftStickY;
|
|
120
|
-
|
|
119
|
+
private readonly _emitter;
|
|
121
120
|
readonly leftJoystick: GamepadJoystick;
|
|
122
|
-
/** Right Joystick */
|
|
123
121
|
readonly rightJoystick: GamepadJoystick;
|
|
124
122
|
/** A scalar 0.0 to 1.0 representing the trigger pull */
|
|
125
123
|
get leftTrigger(): number;
|
|
@@ -129,29 +127,49 @@ export declare class GamepadDevice {
|
|
|
129
127
|
get leftShoulder(): number;
|
|
130
128
|
/** A scalar 0.0 to 1.0 representing the trigger pull */
|
|
131
129
|
get rightShoulder(): number;
|
|
132
|
-
/**
|
|
133
|
-
|
|
134
|
-
/**
|
|
135
|
-
|
|
136
|
-
/**
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
|
|
130
|
+
/** Add an event listener */
|
|
131
|
+
on<K extends keyof GamepadDeviceEvent>(event: K, listener: (event: GamepadDeviceEvent[K]) => void): this;
|
|
132
|
+
/** Remove an event listener */
|
|
133
|
+
off<K extends keyof GamepadDeviceEvent>(event: K, listener: (event: GamepadDeviceEvent[K]) => void): this;
|
|
134
|
+
/** Accessors for buttons */
|
|
135
|
+
button: Record<ButtonCode, boolean>;
|
|
136
|
+
/**
|
|
137
|
+
* Play a vibration effect (if supported).
|
|
138
|
+
*
|
|
139
|
+
* This API only works in browsers that support it.
|
|
140
|
+
* @see https://caniuse.com/mdn-api_gamepad_vibrationactuator
|
|
141
|
+
*/
|
|
142
|
+
playVibration({ duration, weakMagnitude, strongMagnitude, vibrationType, rightTrigger, leftTrigger, startDelay, }?: GamepadVibration): void;
|
|
140
143
|
update(source: Gamepad, now: number): void;
|
|
141
144
|
clear(): void;
|
|
142
145
|
constructor(source: Gamepad);
|
|
143
146
|
private updatePresses;
|
|
144
147
|
}
|
|
145
|
-
export declare class
|
|
146
|
-
static readonly shared:
|
|
147
|
-
static
|
|
148
|
-
|
|
149
|
-
|
|
148
|
+
export declare class InputDevice {
|
|
149
|
+
static readonly shared: InputDevice;
|
|
150
|
+
static keyboard: KeyboardDevice;
|
|
151
|
+
static gamepads: readonly GamepadDevice[];
|
|
152
|
+
static devices: readonly Device[];
|
|
153
|
+
static update: () => ReadonlyArray<Device>;
|
|
150
154
|
readonly keyboard: KeyboardDevice;
|
|
151
|
-
|
|
155
|
+
private readonly _emitter;
|
|
156
|
+
/** Add an event listener */
|
|
157
|
+
on<K extends keyof InputDeviceEvent>(event: K, listener: (event: InputDeviceEvent[K]) => void): this;
|
|
158
|
+
/** Remove an event listener */
|
|
159
|
+
off<K extends keyof InputDeviceEvent>(event: K, listener: (event: InputDeviceEvent[K]) => void): this;
|
|
160
|
+
private hasFocus;
|
|
161
|
+
/**
|
|
162
|
+
* Connected gamepads accessible by index.
|
|
163
|
+
*
|
|
164
|
+
* Keep in mind these inputs are only up-to-date from the last update().
|
|
165
|
+
*/
|
|
152
166
|
get gamepads(): readonly GamepadDevice[];
|
|
153
|
-
/**
|
|
154
|
-
|
|
167
|
+
/**
|
|
168
|
+
* Connected devices.
|
|
169
|
+
*
|
|
170
|
+
* Keep in mind these inputs may only be up-to-date from the last update().
|
|
171
|
+
*/
|
|
172
|
+
get devices(): readonly Device[];
|
|
155
173
|
options: {
|
|
156
174
|
clearInputInBackground: boolean;
|
|
157
175
|
};
|
|
@@ -162,11 +180,11 @@ export declare class InputDeviceManager {
|
|
|
162
180
|
/**
|
|
163
181
|
* Performs a poll of latest input from all devices
|
|
164
182
|
*/
|
|
165
|
-
update(): ReadonlyArray<
|
|
183
|
+
update(): ReadonlyArray<Device>;
|
|
166
184
|
/** Add a custom device. */
|
|
167
185
|
add(device: CustomDevice): void;
|
|
168
186
|
/** Remove a custom device. */
|
|
169
|
-
remove(device:
|
|
187
|
+
remove(device: Device): void;
|
|
170
188
|
/**
|
|
171
189
|
* @returns updates connected gamepads, performing a poll of latest input
|
|
172
190
|
*/
|
|
@@ -174,41 +192,59 @@ export declare class InputDeviceManager {
|
|
|
174
192
|
private removeGamepad;
|
|
175
193
|
}
|
|
176
194
|
export declare class KeyboardDevice {
|
|
177
|
-
|
|
195
|
+
static global: KeyboardDevice;
|
|
178
196
|
readonly type: "keyboard";
|
|
179
|
-
|
|
180
|
-
|
|
197
|
+
readonly id: "keyboard";
|
|
198
|
+
/**
|
|
199
|
+
* Associate custom metadata with a device.
|
|
200
|
+
*/
|
|
201
|
+
meta: Record<string, any>;
|
|
181
202
|
lastUpdated: number;
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
203
|
+
/**
|
|
204
|
+
* Detect layout from keypresses.
|
|
205
|
+
*
|
|
206
|
+
* This will continuously check "keydown" events until the
|
|
207
|
+
* layout can be determined.
|
|
208
|
+
*/
|
|
209
|
+
detectLayoutOnKeypress: boolean;
|
|
210
|
+
private _layout;
|
|
211
|
+
private _layoutSource;
|
|
212
|
+
private _emitter;
|
|
213
|
+
on<K extends keyof KeyboardDeviceEvent>(event: K, listener: (event: KeyboardDeviceEvent[K]) => void): this;
|
|
214
|
+
off<K extends keyof KeyboardDeviceEvent>(event: K, listener: (event: KeyboardDeviceEvent[K]) => void): this;
|
|
192
215
|
options: {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
14: "navigateLeft";
|
|
199
|
-
15: "navigateRight";
|
|
200
|
-
12: "navigateUp";
|
|
201
|
-
};
|
|
216
|
+
/**
|
|
217
|
+
* Keys to prevent default event propagation for.
|
|
218
|
+
*/
|
|
219
|
+
preventDefaultKeys: Set<KeyCode>;
|
|
220
|
+
navigationBinds: Partial<Record<KeyCode, NavigationIntent>>;
|
|
202
221
|
};
|
|
203
|
-
|
|
222
|
+
private constructor();
|
|
223
|
+
/**
|
|
224
|
+
* Keyboard Layout
|
|
225
|
+
*
|
|
226
|
+
* If not set manually, this is determined by the browser (in
|
|
227
|
+
* browsers that support detection), otherwise layout is inferred
|
|
228
|
+
* on keypress, or from device language.
|
|
229
|
+
*
|
|
230
|
+
* Supports the "big four": `"QWERTY"`, `"AZERTY"`, `"QWERTZ"`,
|
|
231
|
+
* and `"JCUKEN"` - i.e. it does not include specialized layouts
|
|
232
|
+
* (e.g. Dvorak, Colemak, BÉPO), or regional layouts (e.g. Hangeul,
|
|
233
|
+
* Kana) etc.
|
|
234
|
+
*
|
|
235
|
+
* When not set explicitly, this is provided by the browser,
|
|
236
|
+
* or detected by keystrokes, or finally inferred from the
|
|
237
|
+
* browser's language.
|
|
238
|
+
*
|
|
239
|
+
* @example "JCUKEN"
|
|
240
|
+
*/
|
|
241
|
+
get layout(): KeyboardLayout;
|
|
242
|
+
set layout(value: KeyboardLayout);
|
|
243
|
+
/** How the keyboard layout was determined. */
|
|
244
|
+
get layoutSource(): KeyboardLayoutSource;
|
|
245
|
+
private configureEventListeners;
|
|
204
246
|
/** Accessors for keys */
|
|
205
247
|
key: Record<KeyCode, boolean>;
|
|
206
|
-
/** Check whether a key is pressed */
|
|
207
|
-
pressing(key: KeyCode): boolean;
|
|
208
|
-
/** Check whether all buttons in a group are pressed */
|
|
209
|
-
pressingAll(group: KeyCode[]): boolean;
|
|
210
|
-
/** Check whether at least one button in a group is pressed */
|
|
211
|
-
pressingAny(group: KeyCode[]): boolean;
|
|
212
248
|
/**
|
|
213
249
|
* Get the label for the given key code in the current keyboard layout.
|
|
214
250
|
*
|
|
@@ -237,6 +273,11 @@ export declare class Navigation {
|
|
|
237
273
|
* navigation intents.
|
|
238
274
|
*/
|
|
239
275
|
stageRoot?: Container;
|
|
276
|
+
/**
|
|
277
|
+
* When enabled, if no pointover/mouseover listeners
|
|
278
|
+
* exist, a default effect will be used instead.
|
|
279
|
+
*/
|
|
280
|
+
fallbackEffects: boolean;
|
|
240
281
|
private _focused?;
|
|
241
282
|
private _responderStack;
|
|
242
283
|
private constructor();
|
|
@@ -252,7 +293,7 @@ export declare class Navigation {
|
|
|
252
293
|
* Emit interaction intent to the first responder,
|
|
253
294
|
* or the global responder if none.
|
|
254
295
|
*/
|
|
255
|
-
|
|
296
|
+
commit(intent: NavigationIntent, device: Device): void;
|
|
256
297
|
/**
|
|
257
298
|
* Remove the top-most global interaction target
|
|
258
299
|
*/
|
|
@@ -261,8 +302,11 @@ export declare class Navigation {
|
|
|
261
302
|
* Set the new top-most global interaction target.
|
|
262
303
|
*/
|
|
263
304
|
pushResponder(responder: NavigationResponder): void;
|
|
264
|
-
private
|
|
305
|
+
private _propagateIntent;
|
|
265
306
|
private _handleGlobalIntent;
|
|
307
|
+
private _emitBlur;
|
|
308
|
+
private _emitFocus;
|
|
309
|
+
private _emitTrigger;
|
|
266
310
|
}
|
|
267
311
|
export declare const Button: {
|
|
268
312
|
/** A Button (Xbox / Nintendo: "A", PlayStation: "Cross") */
|
|
@@ -299,10 +343,73 @@ export declare const Button: {
|
|
|
299
343
|
readonly DPadRight: 15;
|
|
300
344
|
};
|
|
301
345
|
export declare const KeyCode: {
|
|
346
|
+
readonly AltLeft: "AltLeft";
|
|
347
|
+
readonly AltRight: "AltRight";
|
|
348
|
+
readonly ArrowDown: "ArrowDown";
|
|
302
349
|
readonly ArrowLeft: "ArrowLeft";
|
|
303
350
|
readonly ArrowRight: "ArrowRight";
|
|
304
351
|
readonly ArrowUp: "ArrowUp";
|
|
305
|
-
readonly
|
|
352
|
+
readonly Backquote: "Backquote";
|
|
353
|
+
readonly Backslash: "Backslash";
|
|
354
|
+
readonly Backspace: "Backspace";
|
|
355
|
+
readonly BracketLeft: "BracketLeft";
|
|
356
|
+
readonly BracketRight: "BracketRight";
|
|
357
|
+
readonly CapsLock: "CapsLock";
|
|
358
|
+
readonly Comma: "Comma";
|
|
359
|
+
readonly ContextMenu: "ContextMenu";
|
|
360
|
+
readonly ControlLeft: "ControlLeft";
|
|
361
|
+
readonly ControlRight: "ControlRight";
|
|
362
|
+
readonly Delete: "Delete";
|
|
363
|
+
readonly Digit0: "Digit0";
|
|
364
|
+
readonly Digit1: "Digit1";
|
|
365
|
+
readonly Digit2: "Digit2";
|
|
366
|
+
readonly Digit3: "Digit3";
|
|
367
|
+
readonly Digit4: "Digit4";
|
|
368
|
+
readonly Digit5: "Digit5";
|
|
369
|
+
readonly Digit6: "Digit6";
|
|
370
|
+
readonly Digit7: "Digit7";
|
|
371
|
+
readonly Digit8: "Digit8";
|
|
372
|
+
readonly Digit9: "Digit9";
|
|
373
|
+
readonly End: "End";
|
|
374
|
+
readonly Enter: "Enter";
|
|
375
|
+
readonly Equal: "Equal";
|
|
376
|
+
readonly Escape: "Escape";
|
|
377
|
+
readonly F1: "F1";
|
|
378
|
+
readonly F10: "F10";
|
|
379
|
+
readonly F11: "F11";
|
|
380
|
+
readonly F12: "F12";
|
|
381
|
+
readonly F13: "F13";
|
|
382
|
+
readonly F14: "F14";
|
|
383
|
+
readonly F15: "F15";
|
|
384
|
+
readonly F16: "F16";
|
|
385
|
+
readonly F17: "F17";
|
|
386
|
+
readonly F18: "F18";
|
|
387
|
+
readonly F19: "F19";
|
|
388
|
+
readonly F2: "F2";
|
|
389
|
+
readonly F20: "F20";
|
|
390
|
+
readonly F21: "F21";
|
|
391
|
+
readonly F22: "F22";
|
|
392
|
+
readonly F23: "F23";
|
|
393
|
+
readonly F24: "F24";
|
|
394
|
+
readonly F25: "F25";
|
|
395
|
+
readonly F26: "F26";
|
|
396
|
+
readonly F27: "F27";
|
|
397
|
+
readonly F28: "F28";
|
|
398
|
+
readonly F29: "F29";
|
|
399
|
+
readonly F3: "F3";
|
|
400
|
+
readonly F30: "F30";
|
|
401
|
+
readonly F31: "F31";
|
|
402
|
+
readonly F32: "F32";
|
|
403
|
+
readonly F4: "F4";
|
|
404
|
+
readonly F5: "F5";
|
|
405
|
+
readonly F6: "F6";
|
|
406
|
+
readonly F7: "F7";
|
|
407
|
+
readonly F8: "F8";
|
|
408
|
+
readonly F9: "F9";
|
|
409
|
+
readonly Home: "Home";
|
|
410
|
+
readonly IntlBackslash: "IntlBackslash";
|
|
411
|
+
readonly IntlRo: "IntlRo";
|
|
412
|
+
readonly IntlYen: "IntlYen";
|
|
306
413
|
readonly KeyA: "KeyA";
|
|
307
414
|
readonly KeyB: "KeyB";
|
|
308
415
|
readonly KeyC: "KeyC";
|
|
@@ -329,42 +436,14 @@ export declare const KeyCode: {
|
|
|
329
436
|
readonly KeyX: "KeyX";
|
|
330
437
|
readonly KeyY: "KeyY";
|
|
331
438
|
readonly KeyZ: "KeyZ";
|
|
332
|
-
readonly
|
|
333
|
-
readonly
|
|
334
|
-
readonly
|
|
335
|
-
readonly
|
|
336
|
-
readonly Digit4: "Digit4";
|
|
337
|
-
readonly Digit5: "Digit5";
|
|
338
|
-
readonly Digit6: "Digit6";
|
|
339
|
-
readonly Digit7: "Digit7";
|
|
340
|
-
readonly Digit8: "Digit8";
|
|
341
|
-
readonly Digit9: "Digit9";
|
|
342
|
-
readonly Backquote: "Backquote";
|
|
343
|
-
readonly Backslash: "Backslash";
|
|
344
|
-
readonly Backspace: "Backspace";
|
|
345
|
-
readonly BracketLeft: "BracketLeft";
|
|
346
|
-
readonly BracketRight: "BracketRight";
|
|
347
|
-
readonly Comma: "Comma";
|
|
348
|
-
readonly Delete: "Delete";
|
|
349
|
-
readonly End: "End";
|
|
350
|
-
readonly Enter: "Enter";
|
|
351
|
-
readonly Equal: "Equal";
|
|
352
|
-
readonly Escape: "Escape";
|
|
353
|
-
readonly Home: "Home";
|
|
354
|
-
readonly Minus: "Minus";
|
|
355
|
-
readonly Period: "Period";
|
|
356
|
-
readonly Quote: "Quote";
|
|
357
|
-
readonly Semicolon: "Semicolon";
|
|
358
|
-
readonly Slash: "Slash";
|
|
359
|
-
readonly Space: "Space";
|
|
360
|
-
readonly ShiftRight: "ShiftRight";
|
|
361
|
-
readonly AltRight: "AltRight";
|
|
362
|
-
readonly ControlRight: "ControlRight";
|
|
363
|
-
readonly MetaRight: "MetaRight";
|
|
364
|
-
readonly ShiftLeft: "ShiftLeft";
|
|
365
|
-
readonly AltLeft: "AltLeft";
|
|
366
|
-
readonly ControlLeft: "ControlLeft";
|
|
439
|
+
readonly Lang1: "Lang1";
|
|
440
|
+
readonly Lang2: "Lang2";
|
|
441
|
+
readonly MediaTrackNext: "MediaTrackNext";
|
|
442
|
+
readonly MediaTrackPrevious: "MediaTrackPrevious";
|
|
367
443
|
readonly MetaLeft: "MetaLeft";
|
|
444
|
+
readonly MetaRight: "MetaRight";
|
|
445
|
+
readonly Minus: "Minus";
|
|
446
|
+
readonly NumLock: "NumLock";
|
|
368
447
|
readonly Numpad0: "Numpad0";
|
|
369
448
|
readonly Numpad1: "Numpad1";
|
|
370
449
|
readonly Numpad2: "Numpad2";
|
|
@@ -375,11 +454,32 @@ export declare const KeyCode: {
|
|
|
375
454
|
readonly Numpad7: "Numpad7";
|
|
376
455
|
readonly Numpad8: "Numpad8";
|
|
377
456
|
readonly Numpad9: "Numpad9";
|
|
457
|
+
readonly NumpadAdd: "NumpadAdd";
|
|
458
|
+
readonly NumpadComma: "NumpadComma";
|
|
459
|
+
readonly NumpadDecimal: "NumpadDecimal";
|
|
460
|
+
readonly NumpadDivide: "NumpadDivide";
|
|
461
|
+
readonly NumpadMultiply: "NumpadMultiply";
|
|
462
|
+
readonly NumpadSubtract: "NumpadSubtract";
|
|
463
|
+
readonly OSLeft: "OSLeft";
|
|
464
|
+
readonly Pause: "Pause";
|
|
465
|
+
readonly Period: "Period";
|
|
466
|
+
readonly Quote: "Quote";
|
|
467
|
+
readonly ScrollLock: "ScrollLock";
|
|
468
|
+
readonly Semicolon: "Semicolon";
|
|
469
|
+
readonly ShiftLeft: "ShiftLeft";
|
|
470
|
+
readonly ShiftRight: "ShiftRight";
|
|
471
|
+
readonly Slash: "Slash";
|
|
472
|
+
readonly Space: "Space";
|
|
473
|
+
readonly Tab: "Tab";
|
|
474
|
+
readonly VolumeDown: "VolumeDown";
|
|
475
|
+
readonly VolumeMute: "VolumeMute";
|
|
476
|
+
readonly VolumeUp: "VolumeUp";
|
|
477
|
+
readonly WakeUp: "WakeUp";
|
|
378
478
|
};
|
|
379
479
|
/**
|
|
380
480
|
* @returns all navigatable containers in some container
|
|
381
481
|
*/
|
|
382
|
-
export declare function getAllNavigatables(
|
|
482
|
+
export declare function getAllNavigatables(target: Container, navigatables?: NavigatableContainer[]): NavigatableContainer[];
|
|
383
483
|
/**
|
|
384
484
|
* @returns the first navigatable container in the given direction
|
|
385
485
|
*/
|
|
@@ -387,11 +487,36 @@ export declare function getFirstNavigatable(root: Container, currentFocus?: Cont
|
|
|
387
487
|
minimumDistance?: number;
|
|
388
488
|
}): NavigatableContainer | undefined;
|
|
389
489
|
/**
|
|
390
|
-
*
|
|
490
|
+
* Register the mixin for PIXI.Container.
|
|
491
|
+
*
|
|
492
|
+
* @param container A reference to `PIXI.Container`.
|
|
391
493
|
*/
|
|
392
|
-
export declare function
|
|
393
|
-
|
|
394
|
-
|
|
494
|
+
export declare function registerPixiJSInputDeviceMixin(container: any): void;
|
|
495
|
+
export interface GamepadButtonPressEvent {
|
|
496
|
+
device: GamepadDevice;
|
|
497
|
+
button: Button;
|
|
498
|
+
buttonCode: ButtonCode;
|
|
499
|
+
}
|
|
500
|
+
export interface InputDeviceEvent {
|
|
501
|
+
deviceadded: {
|
|
502
|
+
device: Device;
|
|
503
|
+
};
|
|
504
|
+
deviceremoved: {
|
|
505
|
+
device: Device;
|
|
506
|
+
};
|
|
507
|
+
}
|
|
508
|
+
export interface KeyboardDeviceKeydownEvent {
|
|
509
|
+
device: KeyboardDevice;
|
|
510
|
+
keyCode: KeyCode;
|
|
511
|
+
/** Layout-specific label for key. @example "Ц" // JCUKEN for "KeyW" */
|
|
512
|
+
label: string;
|
|
513
|
+
event: KeyboardEvent;
|
|
514
|
+
}
|
|
515
|
+
export interface KeyboardDeviceLayoutUpdatedEvent {
|
|
516
|
+
device: KeyboardDevice;
|
|
517
|
+
layout: KeyboardLayout;
|
|
518
|
+
source: KeyboardLayoutSource;
|
|
519
|
+
}
|
|
395
520
|
/**
|
|
396
521
|
* A target that responds to navigation on the stack.
|
|
397
522
|
*/
|
|
@@ -403,7 +528,7 @@ export interface NavigationResponder {
|
|
|
403
528
|
* Unhandled interaction intents will be bubbled up to the next target. You
|
|
404
529
|
* might return `true` here to prevent any intent from being propagated.
|
|
405
530
|
*/
|
|
406
|
-
handledNavigationIntent?(intent: NavigationIntent, device:
|
|
531
|
+
handledNavigationIntent?(intent: NavigationIntent, device: Device): boolean;
|
|
407
532
|
/**
|
|
408
533
|
* This method is triggered when the target became the first responder.
|
|
409
534
|
*
|
|
@@ -419,24 +544,13 @@ export interface NavigationResponder {
|
|
|
419
544
|
resignedAsFirstResponder?(): void;
|
|
420
545
|
}
|
|
421
546
|
export type Button = (typeof Button)[keyof typeof Button];
|
|
422
|
-
|
|
423
|
-
export type
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
[
|
|
427
|
-
|
|
428
|
-
[Button
|
|
429
|
-
[Button.RightShoulder]: GamepadButton;
|
|
430
|
-
[Button.LeftTrigger]: GamepadButton;
|
|
431
|
-
[Button.RightTrigger]: GamepadButton;
|
|
432
|
-
[Button.Back]: GamepadButton;
|
|
433
|
-
[Button.Start]: GamepadButton;
|
|
434
|
-
[Button.LeftStick]: GamepadButton;
|
|
435
|
-
[Button.RightStick]: GamepadButton;
|
|
436
|
-
[Button.DPadUp]: GamepadButton;
|
|
437
|
-
[Button.DPadDown]: GamepadButton;
|
|
438
|
-
[Button.DPadLeft]: GamepadButton;
|
|
439
|
-
[Button.DPadRight]: GamepadButton;
|
|
547
|
+
export type ButtonCode = typeof ButtonCode[number];
|
|
548
|
+
export type Device = GamepadDevice | KeyboardDevice | CustomDevice;
|
|
549
|
+
export type GamepadButtonDownEvent = (gamepad: GamepadDevice, button: Button) => void;
|
|
550
|
+
export type GamepadDeviceEvent = {} & {
|
|
551
|
+
[button in ButtonCode]: GamepadButtonPressEvent;
|
|
552
|
+
} & {
|
|
553
|
+
[button in Button]: GamepadButtonPressEvent;
|
|
440
554
|
};
|
|
441
555
|
export type GamepadDeviceSource = {
|
|
442
556
|
source: Gamepad;
|
|
@@ -447,12 +561,17 @@ export type GamepadDeviceSource = {
|
|
|
447
561
|
* Note: Non-comprehensive list, covers the most brands only.
|
|
448
562
|
*/
|
|
449
563
|
export type GamepadPlatform = "logitech" | "nintendo" | "playstation" | "steam" | "xbox" | "other";
|
|
450
|
-
export type
|
|
564
|
+
export type GamepadVibration = GamepadEffectParameters & {
|
|
565
|
+
vibrationType?: GamepadHapticEffectType;
|
|
566
|
+
};
|
|
451
567
|
export type KeyCode = (typeof KeyCode)[keyof typeof KeyCode];
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
568
|
+
export type KeyboardDeviceEvent = {
|
|
569
|
+
layoutdetected: KeyboardDeviceLayoutUpdatedEvent;
|
|
570
|
+
} & {
|
|
571
|
+
[key in KeyCode]: KeyboardDeviceKeydownEvent;
|
|
572
|
+
};
|
|
455
573
|
export type KeyboardLayout = "QWERTY" | "AZERTY" | "JCUKEN" | "QWERTZ";
|
|
574
|
+
export type KeyboardLayoutSource = "browser" | "lang" | "keypress" | "manual";
|
|
456
575
|
export type NavigatableContainer = Container;
|
|
457
576
|
export type NavigationDirection = "navigateLeft" | "navigateRight" | "navigateUp" | "navigateDown";
|
|
458
577
|
export type NavigationIntent = "navigateBack" | "navigateDown" | "navigateLeft" | "navigateRight" | "navigateUp" | "trigger";
|