@vpmedia/phaser 1.95.0 → 1.97.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 (184) hide show
  1. package/CHANGELOG.md +51 -0
  2. package/package.json +10 -10
  3. package/src/phaser/core/animation.js +61 -56
  4. package/src/phaser/core/animation_manager.js +55 -55
  5. package/src/phaser/core/cache.js +154 -154
  6. package/src/phaser/core/device.js +2 -1
  7. package/src/phaser/core/device_util.js +27 -27
  8. package/src/phaser/core/dom.js +43 -43
  9. package/src/phaser/core/event_manager.js +63 -63
  10. package/src/phaser/core/factory.js +47 -47
  11. package/src/phaser/core/frame.js +30 -30
  12. package/src/phaser/core/frame_data.js +30 -28
  13. package/src/phaser/core/frame_util.js +8 -8
  14. package/src/phaser/core/game.js +34 -18
  15. package/src/phaser/core/loader.js +170 -170
  16. package/src/phaser/core/loader_parser.js +22 -22
  17. package/src/phaser/core/raf.js +1 -1
  18. package/src/phaser/core/scene.js +16 -10
  19. package/src/phaser/core/scene_manager.js +51 -43
  20. package/src/phaser/core/signal.js +68 -52
  21. package/src/phaser/core/signal.test.js +37 -0
  22. package/src/phaser/core/sound.js +54 -54
  23. package/src/phaser/core/sound_manager.js +49 -49
  24. package/src/phaser/core/stage.js +16 -16
  25. package/src/phaser/core/time.js +30 -30
  26. package/src/phaser/core/timer.js +79 -64
  27. package/src/phaser/core/timer_event.js +9 -9
  28. package/src/phaser/core/tween.js +90 -90
  29. package/src/phaser/core/tween_data.js +30 -30
  30. package/src/phaser/core/tween_manager.js +29 -24
  31. package/src/phaser/core/world.js +4 -3
  32. package/src/phaser/display/bitmap_text.js +61 -54
  33. package/src/phaser/display/button.js +48 -47
  34. package/src/phaser/display/canvas/buffer.js +8 -8
  35. package/src/phaser/display/canvas/graphics.js +8 -8
  36. package/src/phaser/display/canvas/masker.js +5 -5
  37. package/src/phaser/display/canvas/pool.js +18 -18
  38. package/src/phaser/display/canvas/renderer.js +16 -16
  39. package/src/phaser/display/canvas/tinter.js +22 -22
  40. package/src/phaser/display/canvas/util.js +42 -42
  41. package/src/phaser/display/display_object.js +119 -108
  42. package/src/phaser/display/graphics.js +112 -112
  43. package/src/phaser/display/graphics_data.js +10 -10
  44. package/src/phaser/display/graphics_data_util.js +3 -3
  45. package/src/phaser/display/group.js +50 -50
  46. package/src/phaser/display/image.js +54 -50
  47. package/src/phaser/display/sprite_batch.js +2 -2
  48. package/src/phaser/display/sprite_util.js +19 -19
  49. package/src/phaser/display/text.js +212 -187
  50. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  51. package/src/phaser/display/webgl/base_texture.js +9 -9
  52. package/src/phaser/display/webgl/blend_manager.js +7 -7
  53. package/src/phaser/display/webgl/earcut.js +95 -95
  54. package/src/phaser/display/webgl/earcut_node.js +4 -4
  55. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  56. package/src/phaser/display/webgl/filter_manager.js +9 -9
  57. package/src/phaser/display/webgl/filter_texture.js +10 -10
  58. package/src/phaser/display/webgl/graphics.js +37 -37
  59. package/src/phaser/display/webgl/graphics_data.js +4 -4
  60. package/src/phaser/display/webgl/mask_manager.js +6 -6
  61. package/src/phaser/display/webgl/render_texture.js +16 -16
  62. package/src/phaser/display/webgl/renderer.js +20 -20
  63. package/src/phaser/display/webgl/shader/complex.js +4 -4
  64. package/src/phaser/display/webgl/shader/fast.js +4 -4
  65. package/src/phaser/display/webgl/shader/normal.js +8 -8
  66. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  67. package/src/phaser/display/webgl/shader/strip.js +4 -4
  68. package/src/phaser/display/webgl/shader_manager.js +9 -9
  69. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  70. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  71. package/src/phaser/display/webgl/texture.js +13 -13
  72. package/src/phaser/display/webgl/texture_util.js +8 -8
  73. package/src/phaser/display/webgl/util.js +25 -25
  74. package/src/phaser/geom/circle.js +69 -69
  75. package/src/phaser/geom/circle.test.js +1 -0
  76. package/src/phaser/geom/ellipse.js +28 -28
  77. package/src/phaser/geom/ellipse.test.js +1 -0
  78. package/src/phaser/geom/line.js +93 -93
  79. package/src/phaser/geom/line.test.js +1 -0
  80. package/src/phaser/geom/matrix.js +54 -54
  81. package/src/phaser/geom/matrix.test.js +1 -0
  82. package/src/phaser/geom/point.js +96 -96
  83. package/src/phaser/geom/point.test.js +1 -0
  84. package/src/phaser/geom/polygon.js +22 -22
  85. package/src/phaser/geom/rectangle.js +132 -132
  86. package/src/phaser/geom/rectangle.test.js +1 -0
  87. package/src/phaser/geom/rounded_rectangle.js +12 -12
  88. package/src/phaser/geom/rounded_rectangle.test.js +1 -0
  89. package/src/phaser/geom/util/circle.js +33 -33
  90. package/src/phaser/geom/util/circle.test.js +1 -0
  91. package/src/phaser/geom/util/ellipse.js +5 -5
  92. package/src/phaser/geom/util/ellipse.test.js +1 -0
  93. package/src/phaser/geom/util/line.js +26 -26
  94. package/src/phaser/geom/util/line.test.js +1 -0
  95. package/src/phaser/geom/util/matrix.js +8 -8
  96. package/src/phaser/geom/util/matrix.test.js +1 -0
  97. package/src/phaser/geom/util/point.js +97 -97
  98. package/src/phaser/geom/util/point.test.js +1 -0
  99. package/src/phaser/geom/util/polygon.js +4 -4
  100. package/src/phaser/geom/util/polygon.test.js +1 -0
  101. package/src/phaser/geom/util/rectangle.js +74 -74
  102. package/src/phaser/geom/util/rectangle.test.js +1 -0
  103. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  104. package/src/phaser/geom/util/rounded_rectangle.test.js +1 -0
  105. package/src/phaser/util/math.js +81 -81
  106. package/src/phaser/util/math.test.js +1 -0
  107. package/types/phaser/core/animation.d.ts +61 -56
  108. package/types/phaser/core/animation.d.ts.map +1 -1
  109. package/types/phaser/core/animation_manager.d.ts +55 -55
  110. package/types/phaser/core/cache.d.ts +154 -154
  111. package/types/phaser/core/device.d.ts.map +1 -1
  112. package/types/phaser/core/dom.d.ts +43 -43
  113. package/types/phaser/core/event_manager.d.ts +63 -63
  114. package/types/phaser/core/factory.d.ts +47 -47
  115. package/types/phaser/core/frame.d.ts +30 -30
  116. package/types/phaser/core/frame_data.d.ts +28 -27
  117. package/types/phaser/core/frame_data.d.ts.map +1 -1
  118. package/types/phaser/core/game.d.ts +52 -19
  119. package/types/phaser/core/game.d.ts.map +1 -1
  120. package/types/phaser/core/loader.d.ts +170 -170
  121. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  122. package/types/phaser/core/raf.d.ts +1 -1
  123. package/types/phaser/core/scene.d.ts +15 -9
  124. package/types/phaser/core/scene.d.ts.map +1 -1
  125. package/types/phaser/core/scene_manager.d.ts +51 -43
  126. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  127. package/types/phaser/core/signal.d.ts +54 -51
  128. package/types/phaser/core/signal.d.ts.map +1 -1
  129. package/types/phaser/core/sound.d.ts +54 -54
  130. package/types/phaser/core/sound_manager.d.ts +49 -49
  131. package/types/phaser/core/stage.d.ts +10 -10
  132. package/types/phaser/core/time.d.ts +30 -30
  133. package/types/phaser/core/timer.d.ts +64 -64
  134. package/types/phaser/core/timer_event.d.ts +9 -9
  135. package/types/phaser/core/tween.d.ts +90 -90
  136. package/types/phaser/core/tween_data.d.ts +30 -30
  137. package/types/phaser/core/tween_manager.d.ts +29 -24
  138. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  139. package/types/phaser/core/world.d.ts +4 -3
  140. package/types/phaser/core/world.d.ts.map +1 -1
  141. package/types/phaser/display/bitmap_text.d.ts +59 -52
  142. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  143. package/types/phaser/display/button.d.ts +47 -46
  144. package/types/phaser/display/button.d.ts.map +1 -1
  145. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  146. package/types/phaser/display/canvas/renderer.d.ts +16 -16
  147. package/types/phaser/display/display_object.d.ts +119 -108
  148. package/types/phaser/display/display_object.d.ts.map +1 -1
  149. package/types/phaser/display/graphics.d.ts +101 -101
  150. package/types/phaser/display/graphics_data.d.ts +10 -10
  151. package/types/phaser/display/group.d.ts +47 -47
  152. package/types/phaser/display/image.d.ts +42 -40
  153. package/types/phaser/display/image.d.ts.map +1 -1
  154. package/types/phaser/display/text.d.ts +207 -184
  155. package/types/phaser/display/text.d.ts.map +1 -1
  156. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  157. package/types/phaser/display/webgl/base_texture.d.ts +9 -9
  158. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  159. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  160. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  161. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  162. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  163. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  164. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  165. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  166. package/types/phaser/display/webgl/renderer.d.ts +20 -20
  167. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  168. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  169. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  170. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  171. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  172. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  173. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  174. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  175. package/types/phaser/display/webgl/texture.d.ts +12 -12
  176. package/types/phaser/geom/circle.d.ts +69 -69
  177. package/types/phaser/geom/ellipse.d.ts +28 -28
  178. package/types/phaser/geom/line.d.ts +93 -93
  179. package/types/phaser/geom/matrix.d.ts +54 -54
  180. package/types/phaser/geom/point.d.ts +96 -96
  181. package/types/phaser/geom/polygon.d.ts +22 -22
  182. package/types/phaser/geom/rectangle.d.ts +132 -132
  183. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  184. package/pnpm-workspace.yaml +0 -4
@@ -5,14 +5,14 @@ import { Image } from './image.js';
5
5
 
6
6
  export class BitmapText extends DisplayObject {
7
7
  /**
8
- * TBD.
9
- * @param {import('../core/game.js').Game} game - TBD.
10
- * @param {number} x - TBD.
11
- * @param {number} y - TBD.
12
- * @param {string} font - TBD.
13
- * @param {string} text - TBD.
14
- * @param {number} size - TBD.
15
- * @param {string} align - TBD.
8
+ * Creates a new BitmapText instance.
9
+ * @param {import('../core/game.js').Game} game - The game instance this bitmap text belongs to.
10
+ * @param {number} x - The x position of the bitmap text.
11
+ * @param {number} y - The y position of the bitmap text.
12
+ * @param {string} font - The key of the bitmap font to use.
13
+ * @param {string} text - The text to display.
14
+ * @param {number} size - The font size.
15
+ * @param {string} align - The text alignment (left, center, right).
16
16
  */
17
17
  constructor(game, x = 0, y = 0, font = '', text = '', size = 32, align = 'left') {
18
18
  super(game);
@@ -45,7 +45,7 @@ export class BitmapText extends DisplayObject {
45
45
  }
46
46
 
47
47
  /**
48
- * TBD.
48
+ * Destroys this bitmap text and cleans up resources.
49
49
  */
50
50
  destroy() {
51
51
  this._prevAnchor = null;
@@ -56,7 +56,7 @@ export class BitmapText extends DisplayObject {
56
56
  }
57
57
 
58
58
  /**
59
- * TBD.
59
+ * Called before the update cycle for this bitmap text.
60
60
  */
61
61
  preUpdate() {
62
62
  if (this.pendingDestroy) {
@@ -78,19 +78,19 @@ export class BitmapText extends DisplayObject {
78
78
  }
79
79
 
80
80
  /**
81
- * TBD.
82
- * @param {string} text - TBD.
81
+ * Sets the text to display.
82
+ * @param {string} text - The new text to display.
83
83
  */
84
84
  setText(text) {
85
85
  this.text = text;
86
86
  }
87
87
 
88
88
  /**
89
- * TBD.
90
- * @param {object} data - TBD.
91
- * @param {number} scale - TBD.
92
- * @param {string} text - TBD.
93
- * @returns {{width: number, text: string, end: boolean, chars: number[]}} TBD.
89
+ * Scans a line of text to calculate its width and other properties.
90
+ * @param {object} data - The font data for this bitmap text.
91
+ * @param {number} scale - The scaling factor to apply to the font size.
92
+ * @param {string} text - The text to scan.
93
+ * @returns {{width: number, text: string, end: boolean, chars: number[]}} An object containing the width, processed text, end status, and character positions.
94
94
  */
95
95
  scanLine(data, scale, text) {
96
96
  let x = 0;
@@ -154,10 +154,10 @@ export class BitmapText extends DisplayObject {
154
154
  }
155
155
 
156
156
  /**
157
- * TBD.
158
- * @param {string} text - TBD.
159
- * @param {string} replace - TBD.
160
- * @returns {string} TBD.
157
+ * Cleans the provided text by removing invalid characters and replacing them with a specified character.
158
+ * @param {string} text - The text to clean.
159
+ * @param {string} replace - The character to use for replacement of invalid characters (default: '').
160
+ * @returns {string} The cleaned text.
161
161
  */
162
162
  cleanText(text, replace = '') {
163
163
  const data = this._data.font;
@@ -182,7 +182,7 @@ export class BitmapText extends DisplayObject {
182
182
  }
183
183
 
184
184
  /**
185
- * TBD.
185
+ * Updates the internal text rendering based on current properties and content.
186
186
  */
187
187
  updateText() {
188
188
  const data = this._data.font;
@@ -253,8 +253,8 @@ export class BitmapText extends DisplayObject {
253
253
  }
254
254
 
255
255
  /**
256
- * TBD.
257
- * @returns {number} TBD.
256
+ * Removes unused glyphs from the pool and returns the number removed.
257
+ * @returns {number} The number of glyphs that were removed from the pool.
258
258
  */
259
259
  purgeGlyphs() {
260
260
  const len = this._glyphs.length;
@@ -274,7 +274,7 @@ export class BitmapText extends DisplayObject {
274
274
  }
275
275
 
276
276
  /**
277
- * TBD.
277
+ * Updates the transform of this bitmap text, updating its text if needed.
278
278
  */
279
279
  updateTransform() {
280
280
  if (this.dirty || !this.anchor.equals(this._prevAnchor)) {
@@ -286,10 +286,10 @@ export class BitmapText extends DisplayObject {
286
286
  }
287
287
 
288
288
  /**
289
- * TBD.
290
- * @param {string} value - TBD.
291
- * @param {number} position - TBD.
292
- * @returns {BitmapText} TBD.
289
+ * Adds a color to a specific position in the text.
290
+ * @param {string} value - The color to apply (in hex format or CSS color name).
291
+ * @param {number} position - The character position to apply the color to.
292
+ * @returns {BitmapText} This bitmap text instance for chaining.
293
293
  */
294
294
  addColor(value, position) {
295
295
  const color = typeof value === 'string' ? Number.parseInt(value.replace('#', ''), 16) : value;
@@ -301,15 +301,16 @@ export class BitmapText extends DisplayObject {
301
301
  }
302
302
 
303
303
  /**
304
- * TBD.
305
- * @returns {string} TBD.
304
+ * Gets the text alignment property.
305
+ * @returns {string} The current text alignment (left, center, right).
306
306
  */
307
307
  get align() {
308
308
  return this._align;
309
309
  }
310
310
 
311
311
  /**
312
- * TBD.
312
+ * Sets the text alignment property.
313
+ * @param {string} value - The new text alignment (left, center, right).
313
314
  */
314
315
  set align(value) {
315
316
  if (value !== this._align && (value === 'left' || value === 'center' || value === 'right')) {
@@ -319,15 +320,16 @@ export class BitmapText extends DisplayObject {
319
320
  }
320
321
 
321
322
  /**
322
- * TBD.
323
- * @returns {number} TBD.
323
+ * Gets the tint color of this bitmap text.
324
+ * @returns {number} The current tint color in RGB format.
324
325
  */
325
326
  get tint() {
326
327
  return this._tint;
327
328
  }
328
329
 
329
330
  /**
330
- * TBD.
331
+ * Sets the tint color of this bitmap text.
332
+ * @param {number} value - The new tint color in RGB format.
331
333
  */
332
334
  set tint(value) {
333
335
  if (value !== this._tint) {
@@ -337,8 +339,8 @@ export class BitmapText extends DisplayObject {
337
339
  }
338
340
 
339
341
  /**
340
- * TBD.
341
- * @returns {string} TBD.
342
+ * Gets the fill color of this bitmap text as a hex string.
343
+ * @returns {string} The current fill color in hex format.
342
344
  */
343
345
  get fill() {
344
346
  if (typeof this.tint === 'number') {
@@ -352,22 +354,24 @@ export class BitmapText extends DisplayObject {
352
354
  }
353
355
 
354
356
  /**
355
- * TBD.
357
+ * Sets the fill color of this bitmap text.
358
+ * @param {string} value - The new fill color in hex format or CSS color name.
356
359
  */
357
360
  set fill(value) {
358
361
  this.tint = typeof value === 'string' ? Number.parseInt(value.replace('#', ''), 16) : value;
359
362
  }
360
363
 
361
364
  /**
362
- * TBD.
363
- * @returns {string} TBD.
365
+ * Gets the font key used by this bitmap text.
366
+ * @returns {string} The current font key.
364
367
  */
365
368
  get font() {
366
369
  return this._font;
367
370
  }
368
371
 
369
372
  /**
370
- * TBD.
373
+ * Sets the font key used by this bitmap text.
374
+ * @param {string} value - The new font key to use.
371
375
  */
372
376
  set font(value) {
373
377
  const trimmedValue = value.trim();
@@ -379,15 +383,16 @@ export class BitmapText extends DisplayObject {
379
383
  }
380
384
 
381
385
  /**
382
- * TBD.
383
- * @returns {number} TBD.
386
+ * Gets the font size of this bitmap text.
387
+ * @returns {number} The current font size.
384
388
  */
385
389
  get fontSize() {
386
390
  return this._fontSize;
387
391
  }
388
392
 
389
393
  /**
390
- * TBD.
394
+ * Sets the font size of this bitmap text.
395
+ * @param {number} value - The new font size to use.
391
396
  */
392
397
  set fontSize(value) {
393
398
  value = Number.parseInt(value, 10);
@@ -398,16 +403,16 @@ export class BitmapText extends DisplayObject {
398
403
  }
399
404
 
400
405
  /**
401
- * TBD.
402
- * @returns {string} TBD.
406
+ * Gets the text content of this bitmap text.
407
+ * @returns {string} The current text content.
403
408
  */
404
409
  get text() {
405
410
  return this._text;
406
411
  }
407
412
 
408
413
  /**
409
- * TBD.
410
- * @param {string | number | boolean | Date} value - TBD.
414
+ * Sets the text content of this bitmap text.
415
+ * @param {string | number | boolean | Date} value - The new text content to set.
411
416
  */
412
417
  set text(value) {
413
418
  const typedValue = value.toString();
@@ -418,15 +423,16 @@ export class BitmapText extends DisplayObject {
418
423
  }
419
424
 
420
425
  /**
421
- * TBD.
422
- * @returns {number} TBD.
426
+ * Gets the maximum width of this bitmap text.
427
+ * @returns {number} The current maximum width.
423
428
  */
424
429
  get maxWidth() {
425
430
  return this._maxWidth;
426
431
  }
427
432
 
428
433
  /**
429
- * TBD.
434
+ * Sets the maximum width of this bitmap text.
435
+ * @param {number} value - The new maximum width to set.
430
436
  */
431
437
  set maxWidth(value) {
432
438
  if (value !== this._maxWidth) {
@@ -436,15 +442,16 @@ export class BitmapText extends DisplayObject {
436
442
  }
437
443
 
438
444
  /**
439
- * TBD.
440
- * @returns {boolean} TBD.
445
+ * Gets whether smoothing is enabled for this bitmap text's font.
446
+ * @returns {boolean} True if smoothing is enabled, false otherwise.
441
447
  */
442
448
  get smoothed() {
443
449
  return !this._data.base.scaleMode;
444
450
  }
445
451
 
446
452
  /**
447
- * TBD.
453
+ * Sets whether smoothing is enabled for this bitmap text's font.
454
+ * @param {boolean} value - Whether to enable smoothing (true) or not (false).
448
455
  */
449
456
  set smoothed(value) {
450
457
  if (value) {
@@ -11,18 +11,18 @@ const STATE_DISABLED = 'Disabled';
11
11
 
12
12
  export class Button extends Image {
13
13
  /**
14
- * TBD.
15
- * @param {import('../core/game.js').Game} game - TBD.
16
- * @param {number} x - TBD.
17
- * @param {number} y - TBD.
18
- * @param {string} key - TBD.
19
- * @param {Function} callback - TBD.
20
- * @param {object} callbackContext - TBD.
21
- * @param {string} overFrame - TBD.
22
- * @param {string} outFrame - TBD.
23
- * @param {string} downFrame - TBD.
24
- * @param {string} upFrame - TBD.
25
- * @param {string} disabledFrame - TBD.
14
+ * Creates a new Button instance.
15
+ * @param {import('../core/game.js').Game} game - The game instance this button belongs to.
16
+ * @param {number} x - The x position of the button.
17
+ * @param {number} y - The y position of the button.
18
+ * @param {string} key - The texture key to use for the button.
19
+ * @param {Function} callback - The function to call when the button is clicked.
20
+ * @param {object} callbackContext - The context in which to call the callback function.
21
+ * @param {string} overFrame - The frame identifier to use when the mouse is over the button.
22
+ * @param {string} outFrame - The frame identifier to use when the mouse is outside the button.
23
+ * @param {string} downFrame - The frame identifier to use when the button is pressed.
24
+ * @param {string} upFrame - The frame identifier to use when the button is released.
25
+ * @param {string} disabledFrame - The frame identifier to use when the button is disabled.
26
26
  */
27
27
  constructor(
28
28
  game,
@@ -67,7 +67,7 @@ export class Button extends Image {
67
67
  }
68
68
 
69
69
  /**
70
- * TBD.
70
+ * Destroys this button and cleans up resources.
71
71
  */
72
72
  destroy() {
73
73
  this._onOverFrame = null;
@@ -93,9 +93,9 @@ export class Button extends Image {
93
93
  }
94
94
 
95
95
  /**
96
- * TBD.
97
- * @param {boolean} isEnabled - TBD.
98
- * @param {boolean} isImmediate - TBD.
96
+ * Sets whether this button is enabled or disabled.
97
+ * @param {boolean} isEnabled - Whether the button should be enabled (true) or disabled (false).
98
+ * @param {boolean} isImmediate - Whether to change the state immediately or with a delay (default: false).
99
99
  */
100
100
  setEnabled(isEnabled, isImmediate = false) {
101
101
  this.input.enabled = isEnabled;
@@ -109,24 +109,24 @@ export class Button extends Image {
109
109
  }
110
110
 
111
111
  /**
112
- * TBD.
112
+ * Clears all the frame settings for this button.
113
113
  */
114
114
  clearFrames() {
115
115
  this.setFrames(null, null, null, null, null);
116
116
  }
117
117
 
118
118
  /**
119
- * TBD.
119
+ * Called when this button is removed from the world.
120
120
  */
121
121
  removedFromWorld() {
122
122
  this.inputEnabled = false;
123
123
  }
124
124
 
125
125
  /**
126
- * TBD.
127
- * @param {string} state - TBD.
128
- * @param {string} frame - TBD.
129
- * @param {boolean} switchImmediately - TBD.
126
+ * Sets a specific frame for a particular state of this button.
127
+ * @param {string} state - The state name (Over, Out, Down, Up, Disabled).
128
+ * @param {string} frame - The frame identifier to set for this state.
129
+ * @param {boolean} switchImmediately - Whether to switch to the new frame immediately (default: false).
130
130
  */
131
131
  setStateFrame(state, frame, switchImmediately = false) {
132
132
  const frameKey = `_on${state}Frame`;
@@ -141,9 +141,9 @@ export class Button extends Image {
141
141
  }
142
142
 
143
143
  /**
144
- * TBD.
145
- * @param {string} newState - TBD.
146
- * @returns {boolean} TBD.
144
+ * Changes the frame of this button to match the specified state.
145
+ * @param {string} newState - The new state to change to (Over, Out, Down, Up, Disabled).
146
+ * @returns {boolean} True if the frame was changed, false otherwise.
147
147
  */
148
148
  changeStateFrame(newState) {
149
149
  if (this.freezeFrames) {
@@ -163,12 +163,12 @@ export class Button extends Image {
163
163
  }
164
164
 
165
165
  /**
166
- * TBD.
167
- * @param {string} overFrame - TBD.
168
- * @param {string} outFrame - TBD.
169
- * @param {string} downFrame - TBD.
170
- * @param {string} upFrame - TBD.
171
- * @param {string} disabledFrame - TBD.
166
+ * Sets the frame identifiers for all states of this button.
167
+ * @param {string} overFrame - The frame identifier to use when the mouse is over the button.
168
+ * @param {string} outFrame - The frame identifier to use when the mouse is outside the button.
169
+ * @param {string} downFrame - The frame identifier to use when the button is pressed.
170
+ * @param {string} upFrame - The frame identifier to use when the button is released.
171
+ * @param {string} disabledFrame - The frame identifier to use when the button is disabled.
172
172
  */
173
173
  setFrames(overFrame, outFrame, downFrame, upFrame, disabledFrame = null) {
174
174
  this.setStateFrame(STATE_OVER, overFrame, this.input.pointerOver());
@@ -181,9 +181,9 @@ export class Button extends Image {
181
181
  }
182
182
 
183
183
  /**
184
- * TBD.
185
- * @param {object} sprite - TBD.
186
- * @param {object} pointer - TBD.
184
+ * Handles the input over event for this button.
185
+ * @param {object} sprite - The sprite that triggered the event.
186
+ * @param {object} pointer - The pointer that triggered the event.
187
187
  */
188
188
  onInputOverHandler(sprite, pointer) {
189
189
  if (pointer.justReleased() && (this.justReleasedPreventsOver & pointer.pointerMode) === pointer.pointerMode) {
@@ -200,9 +200,9 @@ export class Button extends Image {
200
200
  }
201
201
 
202
202
  /**
203
- * TBD.
204
- * @param {object} sprite - TBD.
205
- * @param {object} pointer - TBD.
203
+ * Handles the input out event for this button.
204
+ * @param {object} sprite - The sprite that triggered the event.
205
+ * @param {object} pointer - The pointer that triggered the event.
206
206
  */
207
207
  onInputOutHandler(sprite, pointer) {
208
208
  this.changeStateFrame(STATE_OUT);
@@ -212,9 +212,9 @@ export class Button extends Image {
212
212
  }
213
213
 
214
214
  /**
215
- * TBD.
216
- * @param {object} sprite - TBD.
217
- * @param {object} pointer - TBD.
215
+ * Handles the input down event for this button.
216
+ * @param {object} sprite - The sprite that triggered the event.
217
+ * @param {object} pointer - The pointer that triggered the event.
218
218
  */
219
219
  onInputDownHandler(sprite, pointer) {
220
220
  this.changeStateFrame(STATE_DOWN);
@@ -224,10 +224,10 @@ export class Button extends Image {
224
224
  }
225
225
 
226
226
  /**
227
- * TBD.
228
- * @param {object} sprite - TBD.
229
- * @param {object} pointer - TBD.
230
- * @param {boolean} isOver - TBD.
227
+ * Handles the input up event for this button.
228
+ * @param {object} sprite - The sprite that triggered the event.
229
+ * @param {object} pointer - The pointer that triggered the event.
230
+ * @param {boolean} isOver - Whether the pointer is currently over the button (default: true).
231
231
  */
232
232
  onInputUpHandler(sprite, pointer, isOver) {
233
233
  if (this.onInputUp) {
@@ -252,15 +252,16 @@ export class Button extends Image {
252
252
  }
253
253
 
254
254
  /**
255
- * TBD.
256
- * @returns {boolean} TBD.
255
+ * Gets whether input is currently enabled for this button.
256
+ * @returns {boolean} True if input is enabled, false otherwise.
257
257
  */
258
258
  get inputEnabled() {
259
259
  return this.input && this.input.enabled;
260
260
  }
261
261
 
262
262
  /**
263
- * TBD.
263
+ * Sets whether input is currently enabled for this button.
264
+ * @param {boolean} value - Whether to enable (true) or disable (false) input.
264
265
  */
265
266
  set inputEnabled(value) {
266
267
  if (value) {
@@ -2,9 +2,9 @@ import { create, removeByCanvas } from './pool.js';
2
2
 
3
3
  export class CanvasBuffer {
4
4
  /**
5
- * TBD.
6
- * @param {number} width - TBD.
7
- * @param {number} height - TBD.
5
+ * Creates a new CanvasBuffer instance.
6
+ * @param {number} width - The width of the canvas buffer.
7
+ * @param {number} height - The height of the canvas buffer.
8
8
  */
9
9
  constructor(width, height) {
10
10
  this.width = width;
@@ -16,7 +16,7 @@ export class CanvasBuffer {
16
16
  }
17
17
 
18
18
  /**
19
- * TBD.
19
+ * Clears the canvas buffer.
20
20
  */
21
21
  clear() {
22
22
  this.context.setTransform(1, 0, 0, 1, 0, 0);
@@ -24,9 +24,9 @@ export class CanvasBuffer {
24
24
  }
25
25
 
26
26
  /**
27
- * TBD.
28
- * @param {number} width - TBD.
29
- * @param {number} height - TBD.
27
+ * Resizes the canvas buffer.
28
+ * @param {number} width - The new width of the canvas buffer.
29
+ * @param {number} height - The new height of the canvas buffer.
30
30
  */
31
31
  resize(width, height) {
32
32
  this.width = width;
@@ -36,7 +36,7 @@ export class CanvasBuffer {
36
36
  }
37
37
 
38
38
  /**
39
- * TBD.
39
+ * Destroys the canvas buffer and cleans up resources.
40
40
  */
41
41
  destroy() {
42
42
  try {
@@ -1,8 +1,8 @@
1
1
  import { GEOM_CIRCLE, GEOM_ELLIPSE, GEOM_POLYGON, GEOM_RECTANGLE, GEOM_ROUNDED_RECTANGLE } from '../../core/const.js';
2
2
 
3
3
  /**
4
- * TBD.
5
- * @param {import('../graphics.js').Graphics} graphics - TBD.
4
+ * Renders a graphics object to canvas.
5
+ * @param {import('../graphics.js').Graphics} graphics - The graphics object to render.
6
6
  */
7
7
  export const updateGraphicsTint = (graphics) => {
8
8
  if (graphics.tint === 0xffffff) {
@@ -27,9 +27,9 @@ export const updateGraphicsTint = (graphics) => {
27
27
  };
28
28
 
29
29
  /**
30
- * TBD.
31
- * @param {import('../graphics.js').Graphics} graphics - TBD.
32
- * @param {object} context - TBD.
30
+ * Renders a graphics object to canvas.
31
+ * @param {import('../graphics.js').Graphics} graphics - The graphics object to render.
32
+ * @param {object} context - The canvas rendering context.
33
33
  */
34
34
  export const renderGraphics = (graphics, context) => {
35
35
  const worldAlpha = graphics.worldAlpha;
@@ -156,9 +156,9 @@ export const renderGraphics = (graphics, context) => {
156
156
  };
157
157
 
158
158
  /**
159
- * TBD.
160
- * @param {import('../graphics.js').Graphics} graphics - TBD.
161
- * @param {object} context - TBD.
159
+ * Renders a graphics object to canvas.
160
+ * @param {import('../graphics.js').Graphics} graphics - The graphics object to render.
161
+ * @param {object} context - The canvas rendering context.
162
162
  */
163
163
  export const renderGraphicsMask = (graphics, context) => {
164
164
  const len = graphics.graphicsData.length;
@@ -1,9 +1,9 @@
1
1
  import { renderGraphicsMask } from './graphics.js';
2
2
 
3
3
  /**
4
- * TBD.
5
- * @param {object} maskData - TBD.
6
- * @param {object} renderSession - TBD.
4
+ * Pushes a mask onto the rendering stack.
5
+ * @param {object} maskData - The mask data to apply.
6
+ * @param {object} renderSession - The rendering session object.
7
7
  */
8
8
  export const pushMask = (maskData, renderSession) => {
9
9
  const context = renderSession.context;
@@ -25,8 +25,8 @@ export const pushMask = (maskData, renderSession) => {
25
25
  };
26
26
 
27
27
  /**
28
- * TBD.
29
- * @param {object} renderSession - TBD.
28
+ * Pops a mask from the rendering stack.
29
+ * @param {object} renderSession - The rendering session object.
30
30
  */
31
31
  export const popMask = (renderSession) => {
32
32
  renderSession.context.restore();
@@ -1,6 +1,6 @@
1
1
  /**
2
- * TBD.
3
- * @returns {{canvas: HTMLCanvasElement, parent: object}[]} TBD.
2
+ * Gets the canvas pool array.
3
+ * @returns {{canvas: HTMLCanvasElement, parent: object}[]} The canvas pool array.
4
4
  */
5
5
  export const getPool = () => {
6
6
  if (!window.PhaserRegistry) {
@@ -13,8 +13,8 @@ export const getPool = () => {
13
13
  };
14
14
 
15
15
  /**
16
- * TBD.
17
- * @returns {number} TBD.
16
+ * Gets the current size of the canvas pool.
17
+ * @returns {number} The current size of the canvas pool.
18
18
  */
19
19
  export const getFirst = () => {
20
20
  const pool = getPool();
@@ -27,8 +27,8 @@ export const getFirst = () => {
27
27
  };
28
28
 
29
29
  /**
30
- * TBD.
31
- * @param {object} parent - TBD.
30
+ * Adds a canvas to the pool with the specified parent.
31
+ * @param {object} parent - The parent object for the canvas.
32
32
  */
33
33
  export const remove = (parent) => {
34
34
  const pool = getPool();
@@ -42,8 +42,8 @@ export const remove = (parent) => {
42
42
  };
43
43
 
44
44
  /**
45
- * TBD.
46
- * @param {HTMLCanvasElement} canvas - TBD.
45
+ * Removes a canvas from the pool.
46
+ * @param {HTMLCanvasElement} canvas - The canvas to remove from the pool.
47
47
  */
48
48
  export const removeByCanvas = (canvas) => {
49
49
  const pool = getPool();
@@ -57,8 +57,8 @@ export const removeByCanvas = (canvas) => {
57
57
  };
58
58
 
59
59
  /**
60
- * TBD.
61
- * @returns {number} TBD.
60
+ * Gets the total count of canvases in the pool.
61
+ * @returns {number} The total count of canvases in the pool.
62
62
  */
63
63
  export const getTotal = () => {
64
64
  const pool = getPool();
@@ -72,8 +72,8 @@ export const getTotal = () => {
72
72
  };
73
73
 
74
74
  /**
75
- * TBD.
76
- * @returns {number} TBD.
75
+ * Gets the number of free canvases in the pool.
76
+ * @returns {number} The number of free canvases in the pool.
77
77
  */
78
78
  export const getFree = () => {
79
79
  const pool = getPool();
@@ -87,12 +87,12 @@ export const getFree = () => {
87
87
  };
88
88
 
89
89
  /**
90
- * TBD.
91
- * @param {object} parent - TBD.
92
- * @param {number} [width] - TBD.
93
- * @param {number} [height] - TBD.
94
- * @param {boolean} skipPool - TBD.
95
- * @returns {HTMLCanvasElement} TBD.
90
+ * Gets a canvas from the pool or creates a new one.
91
+ * @param {object} parent - The parent object for the canvas.
92
+ * @param {number} [width] - Optional width of the canvas.
93
+ * @param {number} [height] - Optional height of the canvas.
94
+ * @param {boolean} skipPool - True to skip using the pool and create a new canvas.
95
+ * @returns {HTMLCanvasElement} The canvas from the pool or a newly created one.
96
96
  */
97
97
  export const create = (parent, width, height, skipPool = false) => {
98
98
  if (parent === undefined) {