@vpmedia/phaser 1.17.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.
Files changed (172) hide show
  1. package/README.md +1 -1
  2. package/package.json +4 -4
  3. package/src/phaser/core/animation.js +3 -2
  4. package/src/phaser/core/animation_manager.js +3 -2
  5. package/src/phaser/core/cache.js +38 -17
  6. package/src/phaser/core/const.js +66 -0
  7. package/src/phaser/core/device.js +87 -0
  8. package/src/phaser/core/dom.js +13 -8
  9. package/src/phaser/core/event_manager.js +2 -1
  10. package/src/phaser/core/factory.js +11 -11
  11. package/src/phaser/core/game.js +1 -0
  12. package/src/phaser/core/input.js +13 -12
  13. package/src/phaser/core/input_handler.js +2 -1
  14. package/src/phaser/core/input_mouse.js +3 -2
  15. package/src/phaser/core/input_mspointer.js +6 -6
  16. package/src/phaser/core/input_pointer.js +3 -2
  17. package/src/phaser/core/loader.js +70 -69
  18. package/src/phaser/core/scale_manager.js +41 -24
  19. package/src/phaser/core/scene_manager.js +11 -7
  20. package/src/phaser/core/signal_binding.js +16 -7
  21. package/src/phaser/core/sound_manager.js +14 -7
  22. package/src/phaser/core/sound_sprite.js +7 -4
  23. package/src/phaser/core/timer.js +33 -21
  24. package/src/phaser/core/timer_event.js +8 -6
  25. package/src/phaser/core/tween.js +66 -45
  26. package/src/phaser/core/tween_data.js +23 -15
  27. package/src/phaser/core/tween_manager.js +10 -6
  28. package/src/phaser/display/bitmap_text.js +7 -6
  29. package/src/phaser/display/canvas/pool.js +1 -1
  30. package/src/phaser/display/canvas/renderer.js +9 -5
  31. package/src/phaser/display/canvas/util.js +2 -2
  32. package/src/phaser/display/display_object.js +35 -16
  33. package/src/phaser/display/graphics.js +61 -40
  34. package/src/phaser/display/graphics_data.js +7 -7
  35. package/src/phaser/display/image.js +19 -12
  36. package/src/phaser/display/sprite_util.js +3 -2
  37. package/src/phaser/display/text.js +57 -33
  38. package/src/phaser/display/webgl/abstract_filter.js +2 -2
  39. package/src/phaser/display/webgl/base_texture.js +2 -2
  40. package/src/phaser/display/webgl/blend_manager.js +3 -2
  41. package/src/phaser/display/webgl/earcut_node.js +1 -1
  42. package/src/phaser/display/webgl/fast_sprite_batch.js +8 -6
  43. package/src/phaser/display/webgl/filter_manager.js +1 -1
  44. package/src/phaser/display/webgl/filter_texture.js +2 -2
  45. package/src/phaser/display/webgl/graphics.js +6 -6
  46. package/src/phaser/display/webgl/graphics_data.js +1 -1
  47. package/src/phaser/display/webgl/render_texture.js +9 -3
  48. package/src/phaser/display/webgl/renderer.js +13 -6
  49. package/src/phaser/display/webgl/shader/complex.js +1 -1
  50. package/src/phaser/display/webgl/shader/fast.js +1 -1
  51. package/src/phaser/display/webgl/shader/normal.js +2 -2
  52. package/src/phaser/display/webgl/shader/primitive.js +1 -1
  53. package/src/phaser/display/webgl/shader/strip.js +1 -1
  54. package/src/phaser/display/webgl/shader_manager.js +4 -3
  55. package/src/phaser/display/webgl/sprite_batch.js +10 -7
  56. package/src/phaser/display/webgl/stencil_manager.js +12 -10
  57. package/src/phaser/display/webgl/texture.js +8 -6
  58. package/typedefs/global.d.ts +1 -1
  59. package/types/phaser/core/animation.d.ts +5 -4
  60. package/types/phaser/core/animation.d.ts.map +1 -1
  61. package/types/phaser/core/animation_manager.d.ts +7 -6
  62. package/types/phaser/core/animation_manager.d.ts.map +1 -1
  63. package/types/phaser/core/cache.d.ts +69 -45
  64. package/types/phaser/core/cache.d.ts.map +1 -1
  65. package/types/phaser/core/const.d.ts +88 -22
  66. package/types/phaser/core/const.d.ts.map +1 -1
  67. package/types/phaser/core/device.d.ts +87 -0
  68. package/types/phaser/core/device.d.ts.map +1 -1
  69. package/types/phaser/core/dom.d.ts +19 -27
  70. package/types/phaser/core/dom.d.ts.map +1 -1
  71. package/types/phaser/core/event_manager.d.ts +4 -3
  72. package/types/phaser/core/event_manager.d.ts.map +1 -1
  73. package/types/phaser/core/factory.d.ts +15 -15
  74. package/types/phaser/core/factory.d.ts.map +1 -1
  75. package/types/phaser/core/game.d.ts +1 -0
  76. package/types/phaser/core/game.d.ts.map +1 -1
  77. package/types/phaser/core/input.d.ts +22 -21
  78. package/types/phaser/core/input.d.ts.map +1 -1
  79. package/types/phaser/core/input_handler.d.ts +5 -4
  80. package/types/phaser/core/input_handler.d.ts.map +1 -1
  81. package/types/phaser/core/input_mouse.d.ts +1 -1
  82. package/types/phaser/core/input_mouse.d.ts.map +1 -1
  83. package/types/phaser/core/input_mspointer.d.ts +13 -13
  84. package/types/phaser/core/input_mspointer.d.ts.map +1 -1
  85. package/types/phaser/core/input_pointer.d.ts +5 -4
  86. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  87. package/types/phaser/core/loader.d.ts +104 -103
  88. package/types/phaser/core/loader.d.ts.map +1 -1
  89. package/types/phaser/core/scale_manager.d.ts +57 -40
  90. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  91. package/types/phaser/core/scene_manager.d.ts +16 -11
  92. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  93. package/types/phaser/core/signal_binding.d.ts +23 -15
  94. package/types/phaser/core/signal_binding.d.ts.map +1 -1
  95. package/types/phaser/core/sound_manager.d.ts +16 -9
  96. package/types/phaser/core/sound_manager.d.ts.map +1 -1
  97. package/types/phaser/core/sound_sprite.d.ts +10 -7
  98. package/types/phaser/core/sound_sprite.d.ts.map +1 -1
  99. package/types/phaser/core/timer.d.ts +41 -29
  100. package/types/phaser/core/timer.d.ts.map +1 -1
  101. package/types/phaser/core/timer_event.d.ts +12 -11
  102. package/types/phaser/core/timer_event.d.ts.map +1 -1
  103. package/types/phaser/core/tween.d.ts +82 -62
  104. package/types/phaser/core/tween.d.ts.map +1 -1
  105. package/types/phaser/core/tween_data.d.ts +31 -23
  106. package/types/phaser/core/tween_data.d.ts.map +1 -1
  107. package/types/phaser/core/tween_manager.d.ts +16 -12
  108. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  109. package/types/phaser/display/bitmap_text.d.ts +10 -9
  110. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  111. package/types/phaser/display/button.d.ts +3 -2
  112. package/types/phaser/display/button.d.ts.map +1 -1
  113. package/types/phaser/display/canvas/buffer.d.ts +2 -2
  114. package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
  115. package/types/phaser/display/canvas/pool.d.ts +2 -2
  116. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  117. package/types/phaser/display/canvas/renderer.d.ts +11 -7
  118. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  119. package/types/phaser/display/canvas/util.d.ts +2 -2
  120. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  121. package/types/phaser/display/display_object.d.ts +55 -36
  122. package/types/phaser/display/display_object.d.ts.map +1 -1
  123. package/types/phaser/display/graphics.d.ts +71 -53
  124. package/types/phaser/display/graphics.d.ts.map +1 -1
  125. package/types/phaser/display/graphics_data.d.ts +16 -16
  126. package/types/phaser/display/graphics_data.d.ts.map +1 -1
  127. package/types/phaser/display/image.d.ts +27 -25
  128. package/types/phaser/display/image.d.ts.map +1 -1
  129. package/types/phaser/display/sprite_util.d.ts +5 -4
  130. package/types/phaser/display/sprite_util.d.ts.map +1 -1
  131. package/types/phaser/display/text.d.ts +82 -93
  132. package/types/phaser/display/text.d.ts.map +1 -1
  133. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  134. package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  135. package/types/phaser/display/webgl/base_texture.d.ts +4 -4
  136. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  137. package/types/phaser/display/webgl/blend_manager.d.ts +6 -5
  138. package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  139. package/types/phaser/display/webgl/earcut_node.d.ts +3 -3
  140. package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  141. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +14 -13
  142. package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  143. package/types/phaser/display/webgl/filter_manager.d.ts +3 -3
  144. package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  145. package/types/phaser/display/webgl/filter_texture.d.ts +7 -7
  146. package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  147. package/types/phaser/display/webgl/graphics.d.ts +13 -12
  148. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  149. package/types/phaser/display/webgl/graphics_data.d.ts +5 -5
  150. package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  151. package/types/phaser/display/webgl/render_texture.d.ts +12 -10
  152. package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
  153. package/types/phaser/display/webgl/renderer.d.ts +16 -9
  154. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  155. package/types/phaser/display/webgl/shader/complex.d.ts +11 -11
  156. package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  157. package/types/phaser/display/webgl/shader/fast.d.ts +15 -15
  158. package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  159. package/types/phaser/display/webgl/shader/normal.d.ts +12 -12
  160. package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  161. package/types/phaser/display/webgl/shader/primitive.d.ts +12 -12
  162. package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  163. package/types/phaser/display/webgl/shader/strip.d.ts +12 -12
  164. package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  165. package/types/phaser/display/webgl/shader_manager.d.ts +9 -8
  166. package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  167. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -14
  168. package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  169. package/types/phaser/display/webgl/stencil_manager.d.ts +17 -15
  170. package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  171. package/types/phaser/display/webgl/texture.d.ts +15 -12
  172. package/types/phaser/display/webgl/texture.d.ts.map +1 -1
@@ -1,5 +1,7 @@
1
1
  import { Signal } from './signal';
2
2
  import { TweenData } from './tween_data';
3
+ import { TweenManager } from './tween_manager';
4
+ import { DisplayObject } from '../display/display_object';
3
5
  import * as MathUtils from '../util/math';
4
6
  import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './const';
5
7
  import { Game } from './game';
@@ -7,9 +9,9 @@ import { Game } from './game';
7
9
  export class Tween {
8
10
  /**
9
11
  * TBD.
10
- * @param target - TBD.
12
+ * @param {DisplayObject} target - TBD.
11
13
  * @param {Game} game - TBD.
12
- * @param manager
14
+ * @param {TweenManager} manager - TBD.
13
15
  */
14
16
  constructor(target, game, manager) {
15
17
  this.game = game;
@@ -39,13 +41,14 @@ export class Tween {
39
41
 
40
42
  /**
41
43
  * TBD.
42
- * @param properties
43
- * @param duration - TBD.
44
- * @param ease - TBD.
45
- * @param autoStart
46
- * @param delay - TBD.
47
- * @param repeat
48
- * @param yoyo
44
+ * @param {object} properties - TBD.
45
+ * @param {number} duration - TBD.
46
+ * @param {string} ease - TBD.
47
+ * @param {boolean} autoStart - TBD.
48
+ * @param {number} delay - TBD.
49
+ * @param {number} repeat - TBD.
50
+ * @param {boolean} yoyo - TBD.
51
+ * @returns {Tween} TBD.
49
52
  */
50
53
  to(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
51
54
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
@@ -63,13 +66,14 @@ export class Tween {
63
66
 
64
67
  /**
65
68
  * TBD.
66
- * @param properties
67
- * @param duration - TBD.
68
- * @param ease - TBD.
69
- * @param autoStart
70
- * @param delay - TBD.
71
- * @param repeat
72
- * @param yoyo
69
+ * @param {object} properties - TBD.
70
+ * @param {number} duration - TBD.
71
+ * @param {string} ease - TBD.
72
+ * @param {boolean} autoStart - TBD.
73
+ * @param {number} delay - TBD.
74
+ * @param {number} repeat - TBD.
75
+ * @param {boolean} yoyo - TBD.
76
+ * @returns {Tween} TBD.
73
77
  */
74
78
  from(properties, duration = 1000, ease = 'Linear', autoStart = false, delay = 0, repeat = 0, yoyo = false) {
75
79
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
@@ -88,7 +92,8 @@ export class Tween {
88
92
 
89
93
  /**
90
94
  * TBD.
91
- * @param index - TBD.
95
+ * @param {number} index - TBD.
96
+ * @returns {Tween} TBD.
92
97
  */
93
98
  start(index = 0) {
94
99
  if (this.game === null || this.target === null || this.timeline.length === 0 || this.isRunning) {
@@ -122,7 +127,8 @@ export class Tween {
122
127
 
123
128
  /**
124
129
  * TBD.
125
- * @param complete
130
+ * @param {boolean} complete - TBD.
131
+ * @returns {Tween} TBD.
126
132
  */
127
133
  stop(complete = false) {
128
134
  this.isRunning = false;
@@ -141,9 +147,10 @@ export class Tween {
141
147
 
142
148
  /**
143
149
  * TBD.
144
- * @param property
145
- * @param value
146
- * @param index - TBD.
150
+ * @param {string} property - TBD.
151
+ * @param {object} value - TBD.
152
+ * @param {number} index - TBD.
153
+ * @returns {Tween} TBD.
147
154
  */
148
155
  updateTweenData(property, value, index = 0) {
149
156
  if (this.timeline.length === 0) {
@@ -161,8 +168,9 @@ export class Tween {
161
168
 
162
169
  /**
163
170
  * TBD.
164
- * @param duration - TBD.
165
- * @param index - TBD.
171
+ * @param {number} duration - TBD.
172
+ * @param {number} index - TBD.
173
+ * @returns {Tween} TBD.
166
174
  */
167
175
  delay(duration, index) {
168
176
  return this.updateTweenData('delay', duration, index);
@@ -170,9 +178,10 @@ export class Tween {
170
178
 
171
179
  /**
172
180
  * TBD.
173
- * @param total
174
- * @param repeatDelay
175
- * @param index - TBD.
181
+ * @param {number} total - TBD.
182
+ * @param {number} repeatDelay - TBD.
183
+ * @param {number} index - TBD.
184
+ * @returns {Tween} TBD.
176
185
  */
177
186
  repeat(total, repeatDelay = 0, index = 0) {
178
187
  this.updateTweenData('repeatCounter', total, index);
@@ -181,8 +190,9 @@ export class Tween {
181
190
 
182
191
  /**
183
192
  * TBD.
184
- * @param duration - TBD.
185
- * @param index - TBD.
193
+ * @param {number} duration - TBD.
194
+ * @param {number} index - TBD.
195
+ * @returns {Tween} TBD.
186
196
  */
187
197
  repeatDelay(duration, index) {
188
198
  return this.updateTweenData('repeatDelay', duration, index);
@@ -190,9 +200,10 @@ export class Tween {
190
200
 
191
201
  /**
192
202
  * TBD.
193
- * @param enable
194
- * @param yoyoDelay
195
- * @param index - TBD.
203
+ * @param {boolean} enable - TBD.
204
+ * @param {number} yoyoDelay - TBD.
205
+ * @param {number} index - TBD.
206
+ * @returns {Tween} TBD.
196
207
  */
197
208
  yoyo(enable, yoyoDelay = 0, index = 0) {
198
209
  this.updateTweenData('yoyo', enable, index);
@@ -201,8 +212,9 @@ export class Tween {
201
212
 
202
213
  /**
203
214
  * TBD.
204
- * @param duration - TBD.
205
- * @param index - TBD.
215
+ * @param {number} duration - TBD.
216
+ * @param {number} index - TBD.
217
+ * @returns {Tween} TBD.
206
218
  */
207
219
  yoyoDelay(duration, index) {
208
220
  return this.updateTweenData('yoyoDelay', duration, index);
@@ -210,8 +222,9 @@ export class Tween {
210
222
 
211
223
  /**
212
224
  * TBD.
213
- * @param ease - TBD.
214
- * @param index - TBD.
225
+ * @param {string|Function} ease - TBD.
226
+ * @param {number} index - TBD.
227
+ * @returns {Tween} TBD.
215
228
  */
216
229
  easing(ease, index) {
217
230
  if (typeof ease === 'string' && this.manager.easeMap[ease]) {
@@ -222,9 +235,10 @@ export class Tween {
222
235
 
223
236
  /**
224
237
  * TBD.
225
- * @param interpolation
226
- * @param context
227
- * @param index - TBD.
238
+ * @param {Function} interpolation - TBD.
239
+ * @param {object} context - TBD.
240
+ * @param {number} index - TBD.
241
+ * @returns {Tween} TBD.
228
242
  */
229
243
  interpolation(interpolation, context = MathUtils, index = 0) {
230
244
  this.updateTweenData('interpolationFunction', interpolation, index);
@@ -233,7 +247,8 @@ export class Tween {
233
247
 
234
248
  /**
235
249
  * TBD.
236
- * @param total
250
+ * @param {number} total - TBD.
251
+ * @returns {Tween} TBD.
237
252
  */
238
253
  repeatAll(total = 0) {
239
254
  this.repeatCounter = total;
@@ -242,7 +257,8 @@ export class Tween {
242
257
 
243
258
  /**
244
259
  * TBD.
245
- * @param {...any} args
260
+ * @param {...any} args - TBD.
261
+ * @returns {Tween} TBD.
246
262
  */
247
263
  chain(...args) {
248
264
  let i = args.length;
@@ -259,7 +275,8 @@ export class Tween {
259
275
 
260
276
  /**
261
277
  * TBD.
262
- * @param value
278
+ * @param {boolean} value - TBD.
279
+ * @returns {Tween} TBD.
263
280
  */
264
281
  loop(value = true) {
265
282
  this.repeatCounter = value ? -1 : 0;
@@ -269,7 +286,8 @@ export class Tween {
269
286
  /**
270
287
  * TBD.
271
288
  * @param {Function} callback - TBD.
272
- * @param callbackContext
289
+ * @param {object} callbackContext - TBD.
290
+ * @returns {Tween} TBD.
273
291
  */
274
292
  onUpdateCallback(callback, callbackContext) {
275
293
  this._onUpdateCallback = callback;
@@ -322,7 +340,8 @@ export class Tween {
322
340
 
323
341
  /**
324
342
  * TBD.
325
- * @param time
343
+ * @param {number} time - TBD.
344
+ * @returns {boolean} TBD.
326
345
  */
327
346
  update(time) {
328
347
  if (this.pendingDelete || !this.target) {
@@ -404,8 +423,9 @@ export class Tween {
404
423
 
405
424
  /**
406
425
  * TBD.
407
- * @param frameRate
408
- * @param data
426
+ * @param {number} frameRate - TBD.
427
+ * @param {object[]} data - TBD.
428
+ * @returns {object[]} TBD.
409
429
  */
410
430
  generateData(frameRate = 60, data = []) {
411
431
  if (this.game === null || this.target === null) {
@@ -435,6 +455,7 @@ export class Tween {
435
455
 
436
456
  /**
437
457
  * TBD.
458
+ * @returns {number} TBD.
438
459
  */
439
460
  get totalDuration() {
440
461
  let total = 0;
@@ -1,10 +1,11 @@
1
+ import { Tween } from './tween';
1
2
  import * as MathUtils from '../util/math';
2
3
  import { TWEEN_PENDING, TWEEN_RUNNING, TWEEN_COMPLETE, TWEEN_LOOPED } from './const';
3
4
 
4
5
  export class TweenData {
5
6
  /**
6
7
  * TBD.
7
- * @param parent
8
+ * @param {Tween} parent - TBD.
8
9
  */
9
10
  constructor(parent) {
10
11
  this.parent = parent;
@@ -35,12 +36,13 @@ export class TweenData {
35
36
 
36
37
  /**
37
38
  * TBD.
38
- * @param properties
39
- * @param duration - TBD.
40
- * @param ease - TBD.
41
- * @param delay - TBD.
42
- * @param repeat
43
- * @param yoyo
39
+ * @param {object} properties - TBD.
40
+ * @param {number} duration - TBD.
41
+ * @param {string} ease - TBD.
42
+ * @param {number} delay - TBD.
43
+ * @param {number} repeat - TBD.
44
+ * @param {boolean} yoyo - TBD.
45
+ * @returns {TweenData} TBD.
44
46
  */
45
47
  to(properties, duration, ease, delay, repeat, yoyo) {
46
48
  this.vEnd = properties;
@@ -55,12 +57,13 @@ export class TweenData {
55
57
 
56
58
  /**
57
59
  * TBD.
58
- * @param properties
59
- * @param duration - TBD.
60
- * @param ease - TBD.
61
- * @param delay - TBD.
62
- * @param repeat
63
- * @param yoyo
60
+ * @param {object} properties - TBD.
61
+ * @param {number} duration - TBD.
62
+ * @param {string} ease - TBD.
63
+ * @param {number} delay - TBD.
64
+ * @param {number} repeat - TBD.
65
+ * @param {boolean} yoyo - TBD.
66
+ * @returns {TweenData} TBD.
64
67
  */
65
68
  from(properties, duration, ease, delay, repeat, yoyo) {
66
69
  this.vEnd = properties;
@@ -75,6 +78,7 @@ export class TweenData {
75
78
 
76
79
  /**
77
80
  * TBD.
81
+ * @returns {TweenData} TBD.
78
82
  */
79
83
  start() {
80
84
  this.startTime = this.game.time.time + this.delay;
@@ -106,6 +110,7 @@ export class TweenData {
106
110
 
107
111
  /**
108
112
  * TBD.
113
+ * @returns {TweenData} TBD.
109
114
  */
110
115
  loadValues() {
111
116
  const keys = Object.keys(this.parent.properties);
@@ -142,7 +147,8 @@ export class TweenData {
142
147
 
143
148
  /**
144
149
  * TBD.
145
- * @param time
150
+ * @param {number} time - TBD.
151
+ * @returns {number} TBD.
146
152
  */
147
153
  update(time) {
148
154
  if (!this.isRunning) {
@@ -184,7 +190,8 @@ export class TweenData {
184
190
 
185
191
  /**
186
192
  * TBD.
187
- * @param frameRate
193
+ * @param {number} frameRate - TBD.
194
+ * @returns {object[]} TBD.
188
195
  */
189
196
  generateData(frameRate) {
190
197
  if (this.parent.reverse) {
@@ -232,6 +239,7 @@ export class TweenData {
232
239
 
233
240
  /**
234
241
  * TBD.
242
+ * @returns {number} TBD.
235
243
  */
236
244
  repeat() {
237
245
  // If not a yoyo and repeatCounter = 0 then we're done
@@ -94,6 +94,7 @@ export class TweenManager {
94
94
 
95
95
  /**
96
96
  * TBD.
97
+ * @returns {Tween[]} TBD.
97
98
  */
98
99
  getAll() {
99
100
  return this._tweens;
@@ -111,8 +112,8 @@ export class TweenManager {
111
112
 
112
113
  /**
113
114
  * TBD.
114
- * @param obj
115
- * @param children
115
+ * @param {object} obj - TBD.
116
+ * @param {object[]} children - TBD.
116
117
  */
117
118
  removeFrom(obj, children) {
118
119
  let i;
@@ -141,7 +142,7 @@ export class TweenManager {
141
142
 
142
143
  /**
143
144
  * TBD.
144
- * @param tween
145
+ * @param {Tween} tween - TBD.
145
146
  */
146
147
  add(tween) {
147
148
  tween._manager = this;
@@ -150,7 +151,8 @@ export class TweenManager {
150
151
 
151
152
  /**
152
153
  * TBD.
153
- * @param object
154
+ * @param {object} object - TBD.
155
+ * @returns {Tween} TBD.
154
156
  */
155
157
  create(object) {
156
158
  return new Tween(object, this.game, this);
@@ -158,7 +160,7 @@ export class TweenManager {
158
160
 
159
161
  /**
160
162
  * TBD.
161
- * @param tween
163
+ * @param {Tween} tween - TBD.
162
164
  */
163
165
  remove(tween) {
164
166
  let i = this._tweens.indexOf(tween);
@@ -174,6 +176,7 @@ export class TweenManager {
174
176
 
175
177
  /**
176
178
  * TBD.
179
+ * @returns {boolean} TBD.
177
180
  */
178
181
  update() {
179
182
  const addTweens = this._add.length;
@@ -200,7 +203,8 @@ export class TweenManager {
200
203
 
201
204
  /**
202
205
  * TBD.
203
- * @param object
206
+ * @param {object} object - TBD.
207
+ * @returns {boolean} TBD.
204
208
  */
205
209
  isTweening(object) {
206
210
  return this._tweens.some((tween) => tween.target === object);
@@ -70,7 +70,7 @@ export class BitmapText extends DisplayObject {
70
70
 
71
71
  /**
72
72
  * TBD.
73
- * @param text - TBD.
73
+ * @param {string} text - TBD.
74
74
  */
75
75
  setText(text) {
76
76
  this.text = text;
@@ -78,9 +78,9 @@ export class BitmapText extends DisplayObject {
78
78
 
79
79
  /**
80
80
  * TBD.
81
- * @param data - TBD.
82
- * @param scale - TBD.
83
- * @param text - TBD.
81
+ * @param {object} data - TBD.
82
+ * @param {number} scale - TBD.
83
+ * @param {string} text - TBD.
84
84
  * @returns {object} TBD.
85
85
  */
86
86
  scanLine(data, scale, text) {
@@ -146,8 +146,8 @@ export class BitmapText extends DisplayObject {
146
146
 
147
147
  /**
148
148
  * TBD.
149
- * @param text - TBD.
150
- * @param replace - TBD.
149
+ * @param {string} text - TBD.
150
+ * @param {string} replace - TBD.
151
151
  * @returns {string} TBD.
152
152
  */
153
153
  cleanText(text, replace = '') {
@@ -393,6 +393,7 @@ export class BitmapText extends DisplayObject {
393
393
 
394
394
  /**
395
395
  * TBD.
396
+ * @returns {number} TBD.
396
397
  */
397
398
  get maxWidth() {
398
399
  return this._maxWidth;
@@ -91,7 +91,7 @@ export function getFree() {
91
91
  * @param {object} parent - TBD.
92
92
  * @param {number} width - TBD.
93
93
  * @param {number} height - TBD.
94
- * @returns {object} TBD.
94
+ * @returns {HTMLCanvasElement} TBD.
95
95
  */
96
96
  export function create(parent, width, height) {
97
97
  if (parent === undefined) {
@@ -24,6 +24,9 @@ import { getSmoothingPrefix } from './util';
24
24
  import { detectCapabilities } from './tinter';
25
25
  import * as CanvasMaskManager from './masker';
26
26
  import { Game } from '../../core/game';
27
+ import { Stage } from '../../core/stage';
28
+ import { Image } from '../image';
29
+ import { Matrix } from '../../geom/matrix';
27
30
 
28
31
  export class CanvasRenderer {
29
32
  /**
@@ -37,6 +40,7 @@ export class CanvasRenderer {
37
40
  this.clearBeforeRender = game.config.clearBeforeRender;
38
41
  this.transparent = game.config.transparent;
39
42
  this.autoResize = false;
43
+ this.contextLost = false;
40
44
  this.width = game.width * this.resolution;
41
45
  this.height = game.height * this.resolution;
42
46
  this.view = game.canvas;
@@ -59,7 +63,7 @@ export class CanvasRenderer {
59
63
 
60
64
  /**
61
65
  * TBD.
62
- * @param root
66
+ * @param {Stage} root - TBD.
63
67
  */
64
68
  render(root) {
65
69
  if (!this.context) {
@@ -84,7 +88,7 @@ export class CanvasRenderer {
84
88
 
85
89
  /**
86
90
  * TBD.
87
- * @param removeView
91
+ * @param {boolean} removeView - TBD.
88
92
  */
89
93
  destroy(removeView = true) {
90
94
  if (removeView && this.view.parent) {
@@ -116,9 +120,9 @@ export class CanvasRenderer {
116
120
 
117
121
  /**
118
122
  * TBD.
119
- * @param displayObject
120
- * @param context
121
- * @param matrix - TBD.
123
+ * @param {Image} displayObject - TBD.
124
+ * @param {CanvasRenderingContext2D} context - TBD.
125
+ * @param {Matrix} matrix - TBD.
122
126
  */
123
127
  renderDisplayObject(displayObject, context, matrix) {
124
128
  this.renderSession.context = context || this.context;
@@ -40,7 +40,7 @@ export function setBackgroundColor(canvas, color) {
40
40
  * @param {string} value - TBD.
41
41
  * @returns {object} TBD.
42
42
  */
43
- export function setTouchAction(canvas, value) {
43
+ export function setTouchAction(canvas, value = 'none') {
44
44
  value = value || 'none';
45
45
  canvas.style.msTouchAction = value;
46
46
  canvas.style['ms-touch-action'] = value;
@@ -54,7 +54,7 @@ export function setTouchAction(canvas, value) {
54
54
  * @param {string} value - TBD.
55
55
  * @returns {object} TBD.
56
56
  */
57
- export function setUserSelect(canvas, value) {
57
+ export function setUserSelect(canvas, value = 'none') {
58
58
  value = value || 'none';
59
59
  canvas.style['-webkit-touch-callout'] = value;
60
60
  canvas.style['-webkit-user-select'] = value;
@@ -4,6 +4,7 @@ import { Matrix } from '../geom/matrix';
4
4
  import { getIdentityMatrix } from '../geom/util/matrix';
5
5
  import { PI_2 } from '../util/math';
6
6
  import { renderCanvas, renderWebGL } from './sprite_util';
7
+ import { Graphics } from './graphics';
7
8
 
8
9
  export class DisplayObject {
9
10
  /**
@@ -72,7 +73,8 @@ export class DisplayObject {
72
73
 
73
74
  /**
74
75
  * TBD.
75
- * @param child - TBD.
76
+ * @param {DisplayObject} child - TBD.
77
+ * @returns {DisplayObject} TBD.
76
78
  */
77
79
  addChild(child) {
78
80
  return this.addChildAt(child, this.children.length);
@@ -80,8 +82,10 @@ export class DisplayObject {
80
82
 
81
83
  /**
82
84
  * TBD.
83
- * @param child - TBD.
85
+ * @param {DisplayObject} child - TBD.
84
86
  * @param {number} index - TBD.
87
+ * @returns {DisplayObject} TBD.
88
+ * @throws Error.
85
89
  */
86
90
  addChildAt(child, index) {
87
91
  if (index >= 0 && index <= this.children.length) {
@@ -97,8 +101,9 @@ export class DisplayObject {
97
101
 
98
102
  /**
99
103
  * TBD.
100
- * @param child - TBD.
101
- * @param child2 - TBD.
104
+ * @param {DisplayObject} child - TBD.
105
+ * @param {DisplayObject} child2 - TBD.
106
+ * @throws Error.
102
107
  */
103
108
  swapChildren(child, child2) {
104
109
  if (child === child2) {
@@ -115,7 +120,9 @@ export class DisplayObject {
115
120
 
116
121
  /**
117
122
  * TBD.
118
- * @param child - TBD.
123
+ * @param {DisplayObject} child - TBD.
124
+ * @returns {number} TBD.
125
+ * @throws Error.
119
126
  */
120
127
  getChildIndex(child) {
121
128
  const index = this.children.indexOf(child);
@@ -127,8 +134,9 @@ export class DisplayObject {
127
134
 
128
135
  /**
129
136
  * TBD.
130
- * @param child - TBD.
137
+ * @param {DisplayObject} child - TBD.
131
138
  * @param {number} index - TBD.
139
+ * @throws Error.
132
140
  */
133
141
  setChildIndex(child, index) {
134
142
  if (index < 0 || index >= this.children.length) {
@@ -142,6 +150,8 @@ export class DisplayObject {
142
150
  /**
143
151
  * TBD.
144
152
  * @param {number} index - TBD.
153
+ * @returns {DisplayObject} TBD.
154
+ * @throws Error.
145
155
  */
146
156
  getChildAt(index) {
147
157
  if (index < 0 || index >= this.children.length) {
@@ -156,7 +166,8 @@ export class DisplayObject {
156
166
 
157
167
  /**
158
168
  * TBD.
159
- * @param child - TBD.
169
+ * @param {DisplayObject} child - TBD.
170
+ * @returns {DisplayObject} TBD.
160
171
  */
161
172
  removeChild(child) {
162
173
  const index = this.children.indexOf(child);
@@ -169,6 +180,7 @@ export class DisplayObject {
169
180
  /**
170
181
  * TBD.
171
182
  * @param {number} index - TBD.
183
+ * @returns {DisplayObject} TBD.
172
184
  */
173
185
  removeChildAt(index) {
174
186
  const child = this.getChildAt(index);
@@ -183,6 +195,8 @@ export class DisplayObject {
183
195
  * TBD.
184
196
  * @param {number} beginIndex - TBD.
185
197
  * @param {number} endIndex - TBD.
198
+ * @returns {DisplayObject[]} TBD.
199
+ * @throws Error.
186
200
  */
187
201
  removeChildren(beginIndex, endIndex) {
188
202
  if (beginIndex === undefined) {
@@ -208,7 +222,8 @@ export class DisplayObject {
208
222
 
209
223
  /**
210
224
  * TBD.
211
- * @param parent - TBD.
225
+ * @param {DisplayObject} parent - TBD.
226
+ * @returns {DisplayObject} TBD.
212
227
  */
213
228
  updateTransform(parent) {
214
229
  if (!parent && !this.parent) {
@@ -295,7 +310,8 @@ export class DisplayObject {
295
310
 
296
311
  /**
297
312
  * TBD.
298
- * @param targetCoordinateSpace - TBD.
313
+ * @param {DisplayObject} targetCoordinateSpace - TBD.
314
+ * @returns {Rectangle} TBD.
299
315
  */
300
316
  getBounds(targetCoordinateSpace) {
301
317
  const isTargetCoordinateSpaceDisplayObject = targetCoordinateSpace && targetCoordinateSpace.contains !== undefined;
@@ -404,7 +420,7 @@ export class DisplayObject {
404
420
 
405
421
  /**
406
422
  * TBD.
407
- * @param child - TBD.
423
+ * @param {DisplayObject} child - TBD.
408
424
  * @returns {boolean} TBD.
409
425
  */
410
426
  contains(child) {
@@ -419,7 +435,7 @@ export class DisplayObject {
419
435
 
420
436
  /**
421
437
  * TBD.
422
- * @param renderSession - TBD.
438
+ * @param {object} renderSession - TBD.
423
439
  */
424
440
  renderWebGL(renderSession) {
425
441
  if (!this.visible || this.alpha <= 0) {
@@ -453,7 +469,7 @@ export class DisplayObject {
453
469
 
454
470
  /**
455
471
  * TBD.
456
- * @param renderSession - TBD.
472
+ * @param {object} renderSession - TBD.
457
473
  */
458
474
  renderCanvas(renderSession) {
459
475
  if (!this.visible || this.alpha <= 0) {
@@ -501,7 +517,8 @@ export class DisplayObject {
501
517
 
502
518
  /**
503
519
  * TBD.
504
- * @param position - TBD.
520
+ * @param {Point} position - TBD.
521
+ * @returns {Point} TBD.
505
522
  */
506
523
  toGlobal(position) {
507
524
  this.updateTransform();
@@ -510,8 +527,9 @@ export class DisplayObject {
510
527
 
511
528
  /**
512
529
  * TBD.
513
- * @param position - TBD.
514
- * @param from - TBD.
530
+ * @param {Point} position - TBD.
531
+ * @param {DisplayObject} from - TBD.
532
+ * @returns {Point} TBD.
515
533
  */
516
534
  toLocal(position, from) {
517
535
  if (from) {
@@ -523,7 +541,7 @@ export class DisplayObject {
523
541
 
524
542
  /**
525
543
  * TBD.
526
- * @param renderSession - TBD.
544
+ * @param {object} renderSession - TBD.
527
545
  */
528
546
  renderCachedSprite(renderSession) {
529
547
  if (!this._cachedSprite) {
@@ -654,6 +672,7 @@ export class DisplayObject {
654
672
 
655
673
  /**
656
674
  * TBD.
675
+ * @returns {Graphics} TBD.
657
676
  */
658
677
  get mask() {
659
678
  return this._mask;