@vpmedia/phaser 1.18.0 → 1.19.0
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 +1 -1
- package/package.json +2 -2
- package/src/phaser/core/cache.js +37 -16
- package/src/phaser/core/dom.js +3 -3
- package/src/phaser/core/input.js +13 -12
- package/src/phaser/core/input_handler.js +2 -1
- package/src/phaser/core/input_mouse.js +3 -2
- package/src/phaser/core/input_pointer.js +2 -1
- package/src/phaser/core/loader.js +70 -69
- package/src/phaser/core/scene_manager.js +1 -1
- package/src/phaser/core/signal_binding.js +16 -7
- package/src/phaser/core/tween.js +5 -4
- package/src/phaser/core/tween_data.js +2 -1
- package/src/phaser/display/canvas/renderer.js +8 -5
- package/src/phaser/display/display_object.js +2 -0
- package/src/phaser/display/graphics.js +4 -4
- package/src/phaser/display/image.js +6 -4
- package/src/phaser/display/text.js +41 -30
- package/src/phaser/display/webgl/abstract_filter.js +1 -1
- package/src/phaser/display/webgl/fast_sprite_batch.js +3 -1
- package/src/phaser/display/webgl/graphics.js +6 -6
- package/src/phaser/display/webgl/render_texture.js +3 -1
- package/src/phaser/display/webgl/renderer.js +9 -5
- package/src/phaser/display/webgl/shader/normal.js +1 -1
- package/src/phaser/display/webgl/shader_manager.js +3 -2
- package/src/phaser/display/webgl/sprite_batch.js +2 -1
- package/src/phaser/display/webgl/stencil_manager.js +8 -6
- package/typedefs/global.d.ts +1 -1
- package/types/phaser/core/cache.d.ts +68 -44
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +6 -6
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +20 -19
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +5 -4
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +1 -1
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +3 -2
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +104 -103
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +2 -2
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +23 -15
- package/types/phaser/core/signal_binding.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +8 -8
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +6 -5
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +3 -2
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +10 -7
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +5 -3
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +6 -6
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +14 -11
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +61 -50
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +3 -3
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +3 -2
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics.d.ts +13 -12
- package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +5 -3
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +12 -8
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +2 -2
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +6 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +3 -2
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +11 -9
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @vpmedia/phaser
|
|
2
2
|
|
|
3
|
-
[](https://badge.fury.io/js/@vpmedia%2Fphaser)
|
|
4
4
|
[](https://github.com/vpmedia/phaser/actions/workflows/node.js.yml)
|
|
5
5
|
|
|
6
6
|
@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vpmedia/phaser",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.19.0",
|
|
4
4
|
"description": "@vpmedia/phaser is the modern ECMAScript port of the popular Phaser game engine v2.6.2",
|
|
5
5
|
"author": "Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"husky": "^8.0.3",
|
|
32
32
|
"jest": "^29.5.0",
|
|
33
33
|
"lint-staged": "^13.2.1",
|
|
34
|
-
"prettier": "^2.8.
|
|
34
|
+
"prettier": "^2.8.8",
|
|
35
35
|
"typescript": "^5.0.4"
|
|
36
36
|
},
|
|
37
37
|
"scripts": {
|
package/src/phaser/core/cache.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Texture } from '../display/webgl/texture';
|
|
2
2
|
import { BaseTexture } from '../display/webgl/base_texture';
|
|
3
|
+
import { RenderTexture } from '../display/webgl/render_texture';
|
|
3
4
|
import { Signal } from './signal';
|
|
4
5
|
import { Frame } from './frame';
|
|
5
6
|
import { FrameData } from './frame_data';
|
|
@@ -84,7 +85,7 @@ export class Cache {
|
|
|
84
85
|
* TBD.
|
|
85
86
|
* @param {string} key - TBD.
|
|
86
87
|
* @param {string} url - TBD.
|
|
87
|
-
* @param data - TBD.
|
|
88
|
+
* @param {HTMLImageElement} data - TBD.
|
|
88
89
|
* @returns {object} TBD.
|
|
89
90
|
*/
|
|
90
91
|
addImage(key, url, data) {
|
|
@@ -112,7 +113,7 @@ export class Cache {
|
|
|
112
113
|
* TBD.
|
|
113
114
|
* @param {string} key - TBD.
|
|
114
115
|
* @param {string} url - TBD.
|
|
115
|
-
* @param data - TBD.
|
|
116
|
+
* @param {HTMLCanvasElement} data - TBD.
|
|
116
117
|
* @param {object} atlasData - TBD.
|
|
117
118
|
*/
|
|
118
119
|
addTextureAtlas(key, url, data, atlasData) {
|
|
@@ -131,7 +132,7 @@ export class Cache {
|
|
|
131
132
|
* TBD.
|
|
132
133
|
* @param {string} key - TBD.
|
|
133
134
|
* @param {string} url - TBD.
|
|
134
|
-
* @param data - TBD.
|
|
135
|
+
* @param {object} data - TBD.
|
|
135
136
|
*/
|
|
136
137
|
addSound(key, url, data) {
|
|
137
138
|
this._cache.sound[key] = {
|
|
@@ -148,7 +149,7 @@ export class Cache {
|
|
|
148
149
|
* TBD.
|
|
149
150
|
* @param {string} key - TBD.
|
|
150
151
|
* @param {string} url - TBD.
|
|
151
|
-
* @param data - TBD.
|
|
152
|
+
* @param {string} data - TBD.
|
|
152
153
|
*/
|
|
153
154
|
addText(key, url, data) {
|
|
154
155
|
this._cache.text[key] = { url, data };
|
|
@@ -159,11 +160,11 @@ export class Cache {
|
|
|
159
160
|
* TBD.
|
|
160
161
|
* @param {string} key - TBD.
|
|
161
162
|
* @param {string} url - TBD.
|
|
162
|
-
* @param data - TBD.
|
|
163
|
-
* @param atlasData - TBD.
|
|
164
|
-
* @param atlasType - TBD.
|
|
165
|
-
* @param xSpacing - TBD.
|
|
166
|
-
* @param ySpacing - TBD.
|
|
163
|
+
* @param {HTMLCanvasElement} data - TBD.
|
|
164
|
+
* @param {object} atlasData - TBD.
|
|
165
|
+
* @param {string} atlasType - TBD.
|
|
166
|
+
* @param {number} xSpacing - TBD.
|
|
167
|
+
* @param {number} ySpacing - TBD.
|
|
167
168
|
*/
|
|
168
169
|
addBitmapFont(key, url, data, atlasData, atlasType, xSpacing = 0, ySpacing = 0) {
|
|
169
170
|
const obj = {
|
|
@@ -185,7 +186,7 @@ export class Cache {
|
|
|
185
186
|
* TBD.
|
|
186
187
|
* @param {string} key - TBD.
|
|
187
188
|
* @param {string} url - TBD.
|
|
188
|
-
* @param data - TBD.
|
|
189
|
+
* @param {object} data - TBD.
|
|
189
190
|
*/
|
|
190
191
|
addJSON(key, url, data) {
|
|
191
192
|
this._cache.json[key] = { url, data };
|
|
@@ -196,7 +197,7 @@ export class Cache {
|
|
|
196
197
|
* TBD.
|
|
197
198
|
* @param {string} key - TBD.
|
|
198
199
|
* @param {string} url - TBD.
|
|
199
|
-
* @param data - TBD.
|
|
200
|
+
* @param {XMLDocument} data - TBD.
|
|
200
201
|
*/
|
|
201
202
|
addXML(key, url, data) {
|
|
202
203
|
this._cache.xml[key] = { url, data };
|
|
@@ -235,7 +236,7 @@ export class Cache {
|
|
|
235
236
|
* TBD.
|
|
236
237
|
* @param {string} key - TBD.
|
|
237
238
|
* @param {string} property - TBD.
|
|
238
|
-
* @param value - TBD.
|
|
239
|
+
* @param {any} value - TBD.
|
|
239
240
|
*/
|
|
240
241
|
updateSound(key, property, value) {
|
|
241
242
|
const sound = this.getSound(key);
|
|
@@ -247,7 +248,7 @@ export class Cache {
|
|
|
247
248
|
/**
|
|
248
249
|
* TBD.
|
|
249
250
|
* @param {string} key - TBD.
|
|
250
|
-
* @param data - TBD.
|
|
251
|
+
* @param {object} data - TBD.
|
|
251
252
|
*/
|
|
252
253
|
decodedSound(key, data) {
|
|
253
254
|
const sound = this.getSound(key);
|
|
@@ -413,6 +414,7 @@ export class Cache {
|
|
|
413
414
|
/**
|
|
414
415
|
* TBD.
|
|
415
416
|
* @param {string} key - TBD.
|
|
417
|
+
* @returns {HTMLCanvasElement} TBD.
|
|
416
418
|
*/
|
|
417
419
|
getCanvas(key) {
|
|
418
420
|
return this.getItem(key, CANVAS, 'getCanvas', 'canvas');
|
|
@@ -421,7 +423,8 @@ export class Cache {
|
|
|
421
423
|
/**
|
|
422
424
|
* TBD.
|
|
423
425
|
* @param {string} key - TBD.
|
|
424
|
-
* @param full - TBD.
|
|
426
|
+
* @param {boolean} full - TBD.
|
|
427
|
+
* @returns {HTMLImageElement} TBD.
|
|
425
428
|
*/
|
|
426
429
|
getImage(key = '__default', full = false) {
|
|
427
430
|
let img = this.getItem(key, IMAGE, 'getImage');
|
|
@@ -437,6 +440,7 @@ export class Cache {
|
|
|
437
440
|
/**
|
|
438
441
|
* TBD.
|
|
439
442
|
* @param {string} key - TBD.
|
|
443
|
+
* @returns {object} TBD.
|
|
440
444
|
*/
|
|
441
445
|
getTextureFrame(key) {
|
|
442
446
|
return this.getItem(key, TEXTURE, 'getTextureFrame', 'frame');
|
|
@@ -445,6 +449,7 @@ export class Cache {
|
|
|
445
449
|
/**
|
|
446
450
|
* TBD.
|
|
447
451
|
* @param {string} key - TBD.
|
|
452
|
+
* @returns {object} TBD.
|
|
448
453
|
*/
|
|
449
454
|
getSound(key) {
|
|
450
455
|
return this.getItem(key, SOUND, 'getSound');
|
|
@@ -453,6 +458,7 @@ export class Cache {
|
|
|
453
458
|
/**
|
|
454
459
|
* TBD.
|
|
455
460
|
* @param {string} key - TBD.
|
|
461
|
+
* @returns {object} TBD.
|
|
456
462
|
*/
|
|
457
463
|
getSoundData(key) {
|
|
458
464
|
return this.getItem(key, SOUND, 'getSoundData', 'data');
|
|
@@ -461,6 +467,7 @@ export class Cache {
|
|
|
461
467
|
/**
|
|
462
468
|
* TBD.
|
|
463
469
|
* @param {string} key - TBD.
|
|
470
|
+
* @returns {object} TBD.
|
|
464
471
|
*/
|
|
465
472
|
getText(key) {
|
|
466
473
|
return this.getItem(key, TEXT, 'getText', 'data');
|
|
@@ -469,6 +476,7 @@ export class Cache {
|
|
|
469
476
|
/**
|
|
470
477
|
* TBD.
|
|
471
478
|
* @param {string} key - TBD.
|
|
479
|
+
* @returns {object} TBD.
|
|
472
480
|
*/
|
|
473
481
|
getBitmapData(key) {
|
|
474
482
|
return this.getItem(key, BITMAPDATA, 'getBitmapData', 'data');
|
|
@@ -477,6 +485,7 @@ export class Cache {
|
|
|
477
485
|
/**
|
|
478
486
|
* TBD.
|
|
479
487
|
* @param {string} key - TBD.
|
|
488
|
+
* @returns {object} TBD.
|
|
480
489
|
*/
|
|
481
490
|
getBitmapFont(key) {
|
|
482
491
|
return this.getItem(key, BITMAPFONT, 'getBitmapFont');
|
|
@@ -486,6 +495,7 @@ export class Cache {
|
|
|
486
495
|
* TBD.
|
|
487
496
|
* @param {string} key - TBD.
|
|
488
497
|
* @param {boolean} isClone - TBD.
|
|
498
|
+
* @returns {object} TBD.
|
|
489
499
|
*/
|
|
490
500
|
getJSON(key, isClone = false) {
|
|
491
501
|
const data = this.getItem(key, JSON, 'getJSON', 'data');
|
|
@@ -495,6 +505,7 @@ export class Cache {
|
|
|
495
505
|
/**
|
|
496
506
|
* TBD.
|
|
497
507
|
* @param {string} key - TBD.
|
|
508
|
+
* @returns {XMLDocument} TBD.
|
|
498
509
|
*/
|
|
499
510
|
getXML(key) {
|
|
500
511
|
return this.getItem(key, XML, 'getXML', 'data');
|
|
@@ -503,6 +514,7 @@ export class Cache {
|
|
|
503
514
|
/**
|
|
504
515
|
* TBD.
|
|
505
516
|
* @param {string} key - TBD.
|
|
517
|
+
* @returns {RenderTexture} TBD.
|
|
506
518
|
*/
|
|
507
519
|
getRenderTexture(key) {
|
|
508
520
|
return this.getItem(key, RENDER_TEXTURE, 'getRenderTexture');
|
|
@@ -514,6 +526,7 @@ export class Cache {
|
|
|
514
526
|
* TBD.
|
|
515
527
|
* @param {string} key - TBD.
|
|
516
528
|
* @param {number} cache - TBD.
|
|
529
|
+
* @returns {BaseTexture} TBD.
|
|
517
530
|
*/
|
|
518
531
|
getBaseTexture(key, cache = IMAGE) {
|
|
519
532
|
return this.getItem(key, cache, 'getBaseTexture', 'base');
|
|
@@ -523,6 +536,7 @@ export class Cache {
|
|
|
523
536
|
* TBD.
|
|
524
537
|
* @param {string} key - TBD.
|
|
525
538
|
* @param {number} cache - TBD.
|
|
539
|
+
* @returns {Frame} TBD.
|
|
526
540
|
*/
|
|
527
541
|
getFrame(key, cache = IMAGE) {
|
|
528
542
|
return this.getItem(key, cache, 'getFrame', 'frame');
|
|
@@ -532,6 +546,7 @@ export class Cache {
|
|
|
532
546
|
* TBD.
|
|
533
547
|
* @param {string} key - TBD.
|
|
534
548
|
* @param {number} cache - TBD.
|
|
549
|
+
* @returns {number} TBD.
|
|
535
550
|
*/
|
|
536
551
|
getFrameCount(key, cache = IMAGE) {
|
|
537
552
|
const data = this.getFrameData(key, cache);
|
|
@@ -545,6 +560,7 @@ export class Cache {
|
|
|
545
560
|
* TBD.
|
|
546
561
|
* @param {string} key - TBD.
|
|
547
562
|
* @param {number} cache - TBD.
|
|
563
|
+
* @returns {FrameData} TBD.
|
|
548
564
|
*/
|
|
549
565
|
getFrameData(key, cache = IMAGE) {
|
|
550
566
|
return this.getItem(key, cache, 'getFrameData', 'frameData');
|
|
@@ -554,6 +570,7 @@ export class Cache {
|
|
|
554
570
|
* TBD.
|
|
555
571
|
* @param {string} key - TBD.
|
|
556
572
|
* @param {number} cache - TBD.
|
|
573
|
+
* @returns {boolean} TBD.
|
|
557
574
|
*/
|
|
558
575
|
hasFrameData(key, cache = IMAGE) {
|
|
559
576
|
return this.getItem(key, cache, '', 'frameData') !== null;
|
|
@@ -562,7 +579,7 @@ export class Cache {
|
|
|
562
579
|
/**
|
|
563
580
|
* TBD.
|
|
564
581
|
* @param {string} key - TBD.
|
|
565
|
-
* @param frameData - TBD.
|
|
582
|
+
* @param {FrameData} frameData - TBD.
|
|
566
583
|
* @param {number} cache - TBD.
|
|
567
584
|
*/
|
|
568
585
|
updateFrameData(key, frameData, cache = IMAGE) {
|
|
@@ -576,6 +593,7 @@ export class Cache {
|
|
|
576
593
|
* @param {string} key - TBD.
|
|
577
594
|
* @param {number} index - TBD.
|
|
578
595
|
* @param {number} cache - TBD.
|
|
596
|
+
* @returns {Frame} TBD.
|
|
579
597
|
*/
|
|
580
598
|
getFrameByIndex(key, index, cache = IMAGE) {
|
|
581
599
|
const data = this.getFrameData(key, cache);
|
|
@@ -590,6 +608,7 @@ export class Cache {
|
|
|
590
608
|
* @param {string} key - TBD.
|
|
591
609
|
* @param {string} name - TBD.
|
|
592
610
|
* @param {number} cache - TBD.
|
|
611
|
+
* @returns {Frame} TBD.
|
|
593
612
|
*/
|
|
594
613
|
getFrameByName(key, name, cache = IMAGE) {
|
|
595
614
|
const data = this.getFrameData(key, cache);
|
|
@@ -602,6 +621,7 @@ export class Cache {
|
|
|
602
621
|
/**
|
|
603
622
|
* TBD.
|
|
604
623
|
* @param {string} url - TBD.
|
|
624
|
+
* @returns {string} TBD.
|
|
605
625
|
*/
|
|
606
626
|
getURL(url) {
|
|
607
627
|
const resolvedURL = this._resolveURL(url);
|
|
@@ -615,6 +635,7 @@ export class Cache {
|
|
|
615
635
|
/**
|
|
616
636
|
* TBD.
|
|
617
637
|
* @param {object} cache - TBD.
|
|
638
|
+
* @returns {string[]} TBD.
|
|
618
639
|
*/
|
|
619
640
|
getKeys(cache = IMAGE) {
|
|
620
641
|
const result = [];
|
|
@@ -739,7 +760,7 @@ export class Cache {
|
|
|
739
760
|
/**
|
|
740
761
|
* TBD.
|
|
741
762
|
* @param {string} url - TBD.
|
|
742
|
-
* @param data - TBD.
|
|
763
|
+
* @param {object} data - TBD.
|
|
743
764
|
* @returns {string} TBD.
|
|
744
765
|
*/
|
|
745
766
|
_resolveURL(url, data) {
|
package/src/phaser/core/dom.js
CHANGED
|
@@ -201,7 +201,7 @@ export class DOM {
|
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
203
|
* TBD.
|
|
204
|
-
* @param element - TBD.
|
|
204
|
+
* @param {HTMLCanvasElement} element - TBD.
|
|
205
205
|
* @param {Point} point - TBD.
|
|
206
206
|
* @returns {Point} TBD.
|
|
207
207
|
*/
|
|
@@ -219,7 +219,7 @@ export class DOM {
|
|
|
219
219
|
|
|
220
220
|
/**
|
|
221
221
|
* TBD.
|
|
222
|
-
* @param element - TBD.
|
|
222
|
+
* @param {HTMLCanvasElement} element - TBD.
|
|
223
223
|
* @param {number} cushion - TBD.
|
|
224
224
|
* @returns {boolean} TBD.
|
|
225
225
|
*/
|
|
@@ -233,7 +233,7 @@ export class DOM {
|
|
|
233
233
|
|
|
234
234
|
/**
|
|
235
235
|
* TBD.
|
|
236
|
-
* @param coords - TBD.
|
|
236
|
+
* @param {DOMRect} coords - TBD.
|
|
237
237
|
* @param {number} cushion - TBD.
|
|
238
238
|
* @returns {object} TBD.
|
|
239
239
|
*/
|
package/src/phaser/core/input.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ArraySet } from './array_set';
|
|
2
2
|
import { Graphics } from '../display/graphics';
|
|
3
|
+
import { DisplayObject } from '../display/display_object';
|
|
3
4
|
import { Image } from '../display/image';
|
|
4
5
|
import { Signal } from './signal';
|
|
5
6
|
import { Point } from '../geom/point';
|
|
@@ -125,7 +126,7 @@ export class Input {
|
|
|
125
126
|
/**
|
|
126
127
|
* TBD.
|
|
127
128
|
* @param {Function} callback - TBD.
|
|
128
|
-
* @param context - TBD.
|
|
129
|
+
* @param {object} context - TBD.
|
|
129
130
|
*/
|
|
130
131
|
setInteractiveCandidateHandler(callback, context) {
|
|
131
132
|
this.customCandidateHandler = callback;
|
|
@@ -135,7 +136,7 @@ export class Input {
|
|
|
135
136
|
/**
|
|
136
137
|
* TBD.
|
|
137
138
|
* @param {Function} callback - TBD.
|
|
138
|
-
* @param context - TBD.
|
|
139
|
+
* @param {object} context - TBD.
|
|
139
140
|
*/
|
|
140
141
|
addMoveCallback(callback, context) {
|
|
141
142
|
this.moveCallbacks.push({ callback, context });
|
|
@@ -144,7 +145,7 @@ export class Input {
|
|
|
144
145
|
/**
|
|
145
146
|
* TBD.
|
|
146
147
|
* @param {Function} callback - TBD.
|
|
147
|
-
* @param context - TBD.
|
|
148
|
+
* @param {object} context - TBD.
|
|
148
149
|
*/
|
|
149
150
|
deleteMoveCallback(callback, context) {
|
|
150
151
|
let i = this.moveCallbacks.length;
|
|
@@ -298,7 +299,7 @@ export class Input {
|
|
|
298
299
|
|
|
299
300
|
/**
|
|
300
301
|
* TBD.
|
|
301
|
-
* @param limit - TBD.
|
|
302
|
+
* @param {number} limit - TBD.
|
|
302
303
|
* @returns {number} TBD.
|
|
303
304
|
*/
|
|
304
305
|
countActivePointers(limit = this.pointers.length) {
|
|
@@ -329,7 +330,7 @@ export class Input {
|
|
|
329
330
|
|
|
330
331
|
/**
|
|
331
332
|
* TBD.
|
|
332
|
-
* @param identifier - TBD.
|
|
333
|
+
* @param {number} identifier - TBD.
|
|
333
334
|
* @returns {Pointer} TBD.
|
|
334
335
|
*/
|
|
335
336
|
getPointerFromIdentifier(identifier) {
|
|
@@ -345,7 +346,7 @@ export class Input {
|
|
|
345
346
|
|
|
346
347
|
/**
|
|
347
348
|
* TBD.
|
|
348
|
-
* @param pointerId - TBD.
|
|
349
|
+
* @param {number} pointerId - TBD.
|
|
349
350
|
* @returns {Pointer} TBD.
|
|
350
351
|
*/
|
|
351
352
|
getPointerFromId(pointerId) {
|
|
@@ -361,9 +362,9 @@ export class Input {
|
|
|
361
362
|
|
|
362
363
|
/**
|
|
363
364
|
* TBD.
|
|
364
|
-
* @param displayObject - TBD.
|
|
365
|
-
* @param pointer - TBD.
|
|
366
|
-
* @param output - TBD.
|
|
365
|
+
* @param {DisplayObject} displayObject - TBD.
|
|
366
|
+
* @param {Pointer} pointer - TBD.
|
|
367
|
+
* @param {Point} output - TBD.
|
|
367
368
|
* @returns {Point} TBD.
|
|
368
369
|
*/
|
|
369
370
|
getLocalPosition(displayObject, pointer, output = null) {
|
|
@@ -378,9 +379,9 @@ export class Input {
|
|
|
378
379
|
|
|
379
380
|
/**
|
|
380
381
|
* TBD.
|
|
381
|
-
* @param displayObject - TBD.
|
|
382
|
-
* @param pointer - TBD.
|
|
383
|
-
* @param localPoint - TBD.
|
|
382
|
+
* @param {DisplayObject} displayObject - TBD.
|
|
383
|
+
* @param {Pointer} pointer - TBD.
|
|
384
|
+
* @param {Point} localPoint - TBD.
|
|
384
385
|
* @returns {boolean} TBD.
|
|
385
386
|
*/
|
|
386
387
|
hitTest(displayObject, pointer, localPoint) {
|
|
@@ -3,12 +3,13 @@ import { GROUP } from './const';
|
|
|
3
3
|
import { distance } from '../util/math';
|
|
4
4
|
import { Pointer } from './input_pointer';
|
|
5
5
|
import { Rectangle } from '../geom/rectangle';
|
|
6
|
+
import { Image } from '../display/image';
|
|
6
7
|
import { DisplayObject } from '../display/display_object';
|
|
7
8
|
|
|
8
9
|
export class InputHandler {
|
|
9
10
|
/**
|
|
10
11
|
* TBD.
|
|
11
|
-
* @param sprite
|
|
12
|
+
* @param {Image} sprite - TBD.
|
|
12
13
|
*/
|
|
13
14
|
constructor(sprite) {
|
|
14
15
|
this.sprite = sprite;
|
|
@@ -12,8 +12,8 @@ import { Game } from './game';
|
|
|
12
12
|
class WheelEventProxy {
|
|
13
13
|
/**
|
|
14
14
|
* TBD.
|
|
15
|
-
* @param scaleFactor - TBD.
|
|
16
|
-
* @param deltaMode - TBD.
|
|
15
|
+
* @param {number} scaleFactor - TBD.
|
|
16
|
+
* @param {number} deltaMode - TBD.
|
|
17
17
|
*/
|
|
18
18
|
constructor(scaleFactor, deltaMode) {
|
|
19
19
|
this._scaleFactor = scaleFactor;
|
|
@@ -48,6 +48,7 @@ class WheelEventProxy {
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* TBD.
|
|
51
|
+
* @returns {number} TBD.
|
|
51
52
|
*/
|
|
52
53
|
get deltaMode() {
|
|
53
54
|
return this._deltaMode;
|
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
MOUSE_TOUCH_COMBINE,
|
|
10
10
|
} from './const';
|
|
11
11
|
import { Game } from './game';
|
|
12
|
+
import { InputHandler } from './input_handler';
|
|
12
13
|
|
|
13
14
|
export class Pointer {
|
|
14
15
|
/**
|
|
@@ -302,7 +303,7 @@ export class Pointer {
|
|
|
302
303
|
|
|
303
304
|
/**
|
|
304
305
|
* TBD.
|
|
305
|
-
* @param newTarget - TBD.
|
|
306
|
+
* @param {InputHandler} newTarget - TBD.
|
|
306
307
|
* @param {boolean} silent - TBD.
|
|
307
308
|
*/
|
|
308
309
|
swapTarget(newTarget, silent = false) {
|