@vpmedia/phaser 1.95.0 → 1.96.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 (167) hide show
  1. package/CHANGELOG.md +29 -0
  2. package/package.json +9 -9
  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 +56 -52
  21. package/src/phaser/core/sound.js +54 -54
  22. package/src/phaser/core/sound_manager.js +49 -49
  23. package/src/phaser/core/stage.js +16 -16
  24. package/src/phaser/core/time.js +30 -30
  25. package/src/phaser/core/timer.js +64 -64
  26. package/src/phaser/core/timer_event.js +9 -9
  27. package/src/phaser/core/tween.js +90 -90
  28. package/src/phaser/core/tween_data.js +30 -30
  29. package/src/phaser/core/tween_manager.js +29 -24
  30. package/src/phaser/core/world.js +4 -3
  31. package/src/phaser/display/bitmap_text.js +61 -54
  32. package/src/phaser/display/button.js +48 -47
  33. package/src/phaser/display/canvas/buffer.js +8 -8
  34. package/src/phaser/display/canvas/graphics.js +8 -8
  35. package/src/phaser/display/canvas/masker.js +5 -5
  36. package/src/phaser/display/canvas/pool.js +18 -18
  37. package/src/phaser/display/canvas/renderer.js +16 -16
  38. package/src/phaser/display/canvas/tinter.js +22 -22
  39. package/src/phaser/display/canvas/util.js +42 -42
  40. package/src/phaser/display/display_object.js +119 -108
  41. package/src/phaser/display/graphics.js +112 -112
  42. package/src/phaser/display/graphics_data.js +10 -10
  43. package/src/phaser/display/graphics_data_util.js +3 -3
  44. package/src/phaser/display/group.js +50 -50
  45. package/src/phaser/display/image.js +54 -50
  46. package/src/phaser/display/sprite_batch.js +2 -2
  47. package/src/phaser/display/sprite_util.js +19 -19
  48. package/src/phaser/display/text.js +212 -187
  49. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  50. package/src/phaser/display/webgl/base_texture.js +9 -9
  51. package/src/phaser/display/webgl/blend_manager.js +7 -7
  52. package/src/phaser/display/webgl/earcut.js +95 -95
  53. package/src/phaser/display/webgl/earcut_node.js +4 -4
  54. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  55. package/src/phaser/display/webgl/filter_manager.js +9 -9
  56. package/src/phaser/display/webgl/filter_texture.js +10 -10
  57. package/src/phaser/display/webgl/graphics.js +37 -37
  58. package/src/phaser/display/webgl/graphics_data.js +4 -4
  59. package/src/phaser/display/webgl/mask_manager.js +6 -6
  60. package/src/phaser/display/webgl/render_texture.js +16 -16
  61. package/src/phaser/display/webgl/renderer.js +20 -20
  62. package/src/phaser/display/webgl/shader/complex.js +4 -4
  63. package/src/phaser/display/webgl/shader/fast.js +4 -4
  64. package/src/phaser/display/webgl/shader/normal.js +8 -8
  65. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  66. package/src/phaser/display/webgl/shader/strip.js +4 -4
  67. package/src/phaser/display/webgl/shader_manager.js +9 -9
  68. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  69. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  70. package/src/phaser/display/webgl/texture.js +13 -13
  71. package/src/phaser/display/webgl/texture_util.js +8 -8
  72. package/src/phaser/display/webgl/util.js +25 -25
  73. package/src/phaser/geom/circle.js +69 -69
  74. package/src/phaser/geom/ellipse.js +28 -28
  75. package/src/phaser/geom/line.js +93 -93
  76. package/src/phaser/geom/matrix.js +54 -54
  77. package/src/phaser/geom/point.js +96 -96
  78. package/src/phaser/geom/polygon.js +22 -22
  79. package/src/phaser/geom/rectangle.js +132 -132
  80. package/src/phaser/geom/rounded_rectangle.js +12 -12
  81. package/src/phaser/geom/util/circle.js +33 -33
  82. package/src/phaser/geom/util/ellipse.js +5 -5
  83. package/src/phaser/geom/util/line.js +26 -26
  84. package/src/phaser/geom/util/matrix.js +8 -8
  85. package/src/phaser/geom/util/point.js +97 -97
  86. package/src/phaser/geom/util/polygon.js +4 -4
  87. package/src/phaser/geom/util/rectangle.js +74 -74
  88. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  89. package/src/phaser/util/math.js +81 -81
  90. package/types/phaser/core/animation.d.ts +61 -56
  91. package/types/phaser/core/animation.d.ts.map +1 -1
  92. package/types/phaser/core/animation_manager.d.ts +55 -55
  93. package/types/phaser/core/cache.d.ts +154 -154
  94. package/types/phaser/core/device.d.ts.map +1 -1
  95. package/types/phaser/core/dom.d.ts +43 -43
  96. package/types/phaser/core/event_manager.d.ts +63 -63
  97. package/types/phaser/core/factory.d.ts +47 -47
  98. package/types/phaser/core/frame.d.ts +30 -30
  99. package/types/phaser/core/frame_data.d.ts +28 -27
  100. package/types/phaser/core/frame_data.d.ts.map +1 -1
  101. package/types/phaser/core/game.d.ts +52 -19
  102. package/types/phaser/core/game.d.ts.map +1 -1
  103. package/types/phaser/core/loader.d.ts +170 -170
  104. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  105. package/types/phaser/core/raf.d.ts +1 -1
  106. package/types/phaser/core/scene.d.ts +15 -9
  107. package/types/phaser/core/scene.d.ts.map +1 -1
  108. package/types/phaser/core/scene_manager.d.ts +51 -43
  109. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  110. package/types/phaser/core/signal.d.ts +54 -51
  111. package/types/phaser/core/signal.d.ts.map +1 -1
  112. package/types/phaser/core/sound.d.ts +54 -54
  113. package/types/phaser/core/sound_manager.d.ts +49 -49
  114. package/types/phaser/core/stage.d.ts +10 -10
  115. package/types/phaser/core/time.d.ts +30 -30
  116. package/types/phaser/core/timer.d.ts +64 -64
  117. package/types/phaser/core/timer_event.d.ts +9 -9
  118. package/types/phaser/core/tween.d.ts +90 -90
  119. package/types/phaser/core/tween_data.d.ts +30 -30
  120. package/types/phaser/core/tween_manager.d.ts +29 -24
  121. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  122. package/types/phaser/core/world.d.ts +4 -3
  123. package/types/phaser/core/world.d.ts.map +1 -1
  124. package/types/phaser/display/bitmap_text.d.ts +59 -52
  125. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  126. package/types/phaser/display/button.d.ts +47 -46
  127. package/types/phaser/display/button.d.ts.map +1 -1
  128. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  129. package/types/phaser/display/canvas/renderer.d.ts +16 -16
  130. package/types/phaser/display/display_object.d.ts +119 -108
  131. package/types/phaser/display/display_object.d.ts.map +1 -1
  132. package/types/phaser/display/graphics.d.ts +101 -101
  133. package/types/phaser/display/graphics_data.d.ts +10 -10
  134. package/types/phaser/display/group.d.ts +47 -47
  135. package/types/phaser/display/image.d.ts +42 -40
  136. package/types/phaser/display/image.d.ts.map +1 -1
  137. package/types/phaser/display/text.d.ts +207 -184
  138. package/types/phaser/display/text.d.ts.map +1 -1
  139. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  140. package/types/phaser/display/webgl/base_texture.d.ts +9 -9
  141. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  142. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  143. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  144. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  145. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  146. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  147. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  148. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  149. package/types/phaser/display/webgl/renderer.d.ts +20 -20
  150. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  151. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  152. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  153. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  154. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  155. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  156. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  157. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  158. package/types/phaser/display/webgl/texture.d.ts +12 -12
  159. package/types/phaser/geom/circle.d.ts +69 -69
  160. package/types/phaser/geom/ellipse.d.ts +28 -28
  161. package/types/phaser/geom/line.d.ts +93 -93
  162. package/types/phaser/geom/matrix.d.ts +54 -54
  163. package/types/phaser/geom/point.d.ts +96 -96
  164. package/types/phaser/geom/polygon.d.ts +22 -22
  165. package/types/phaser/geom/rectangle.d.ts +132 -132
  166. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  167. package/pnpm-workspace.yaml +0 -4
@@ -9,12 +9,12 @@ import { textureFromCanvas } from './webgl/texture_util.js';
9
9
 
10
10
  export class Text extends Image {
11
11
  /**
12
- * TBD.
13
- * @param {import('../core/game.js').Game} game - TBD.
14
- * @param {number} x - TBD.
15
- * @param {number} y - TBD.
16
- * @param {string} text - TBD.
17
- * @param {object} style - TBD.
12
+ * Creates a new Text object.
13
+ * @param {import('../core/game.js').Game} game - The game instance this text belongs to.
14
+ * @param {number} x - The x position of the text.
15
+ * @param {number} y - The y position of the text.
16
+ * @param {string} text - The text content to display.
17
+ * @param {object} style - The style settings for the text.
18
18
  */
19
19
  constructor(game, x, y, text = '', style = {}) {
20
20
  super(game, x, y, null);
@@ -55,7 +55,7 @@ export class Text extends Image {
55
55
  }
56
56
 
57
57
  /**
58
- * TBD.
58
+ * Destroys this text object and cleans up resources.
59
59
  */
60
60
  destroy() {
61
61
  this.texture.destroy(true);
@@ -75,14 +75,14 @@ export class Text extends Image {
75
75
  }
76
76
 
77
77
  /**
78
- * TBD.
79
- * @param {number} x - TBD.
80
- * @param {number} y - TBD.
81
- * @param {string} color - TBD.
82
- * @param {number} blur - TBD.
83
- * @param {boolean} shadowStroke - TBD.
84
- * @param {boolean} shadowFill - TBD.
85
- * @returns {Text} TBD.
78
+ * Sets the drop shadow properties for this text.
79
+ * @param {number} x - The horizontal offset of the shadow.
80
+ * @param {number} y - The vertical offset of the shadow.
81
+ * @param {string} color - The color of the shadow.
82
+ * @param {number} blur - The blur radius of the shadow.
83
+ * @param {boolean} shadowStroke - Whether to apply the shadow to the stroke.
84
+ * @param {boolean} shadowFill - Whether to apply the shadow to the fill.
85
+ * @returns {Text} This Text object for chaining.
86
86
  */
87
87
  setShadow(x = 0, y = 0, color = 'rgba(0, 0, 0, 1)', blur = 0, shadowStroke = true, shadowFill = true) {
88
88
  this.style.shadowOffsetX = x;
@@ -96,10 +96,10 @@ export class Text extends Image {
96
96
  }
97
97
 
98
98
  /**
99
- * TBD.
100
- * @param {object} style - TBD.
101
- * @param {boolean} update - TBD.
102
- * @returns {Text} TBD.
99
+ * Sets the style properties for this text.
100
+ * @param {object} style - The style settings to apply.
101
+ * @param {boolean} update - Whether to update the text immediately.
102
+ * @returns {Text} This Text object for chaining.
103
103
  */
104
104
  setStyle(style = null, update = false) {
105
105
  style = JSON.parse(JSON.stringify(style)) || {};
@@ -146,7 +146,7 @@ export class Text extends Image {
146
146
  }
147
147
 
148
148
  /**
149
- * TBD.
149
+ * Updates the text content and renders it to the canvas.
150
150
  */
151
151
  updateText() {
152
152
  this.texture.baseTexture.resolution = this._res;
@@ -309,11 +309,11 @@ export class Text extends Image {
309
309
  }
310
310
 
311
311
  /**
312
- * TBD.
313
- * @param {string} line - TBD.
314
- * @param {number} x - TBD.
315
- * @param {number} y - TBD.
316
- * @param {boolean} fill - TBD.
312
+ * Renders a tabbed line of text to the canvas.
313
+ * @param {string} line - The line of text to render.
314
+ * @param {number} x - The x position to start rendering from.
315
+ * @param {number} y - The y position to start rendering from.
316
+ * @param {boolean} fill - True to fill the text, false to stroke it.
317
317
  */
318
318
  renderTabLine(line, x, y, fill) {
319
319
  const text = line.split(/(?:\t)/);
@@ -348,8 +348,8 @@ export class Text extends Image {
348
348
  }
349
349
 
350
350
  /**
351
- * TBD.
352
- * @param {string} state - TBD.
351
+ * Updates the shadow properties for this text.
352
+ * @param {string} state - The shadow state to update ('stroke' or 'fill').
353
353
  */
354
354
  updateShadow(state) {
355
355
  if (state) {
@@ -366,9 +366,9 @@ export class Text extends Image {
366
366
  }
367
367
 
368
368
  /**
369
- * TBD.
370
- * @param {string} line - TBD.
371
- * @returns {number} TBD.
369
+ * Measures the width of a line of text.
370
+ * @param {string} line - The line of text to measure.
371
+ * @returns {number} The width of the line in pixels.
372
372
  */
373
373
  measureLine(line) {
374
374
  let lineLength = 0;
@@ -403,10 +403,10 @@ export class Text extends Image {
403
403
  }
404
404
 
405
405
  /**
406
- * TBD.
407
- * @param {string} line - TBD.
408
- * @param {number} x - TBD.
409
- * @param {number} y - TBD.
406
+ * Updates a line of text to the canvas.
407
+ * @param {string} line - The line of text to update.
408
+ * @param {number} x - The x position to start updating from.
409
+ * @param {number} y - The y position to start updating from.
410
410
  */
411
411
  updateLine(line, x, y) {
412
412
  for (let i = 0; i < line.length; i += 1) {
@@ -441,8 +441,8 @@ export class Text extends Image {
441
441
  }
442
442
 
443
443
  /**
444
- * TBD.
445
- * @returns {Text} TBD.
444
+ * Clears all color values from this text object.
445
+ * @returns {Text} This Text object for chaining.
446
446
  */
447
447
  clearColors() {
448
448
  this.colors = [];
@@ -452,8 +452,8 @@ export class Text extends Image {
452
452
  }
453
453
 
454
454
  /**
455
- * TBD.
456
- * @returns {Text} TBD.
455
+ * Clears all font style values from this text object.
456
+ * @returns {Text} This Text object for chaining.
457
457
  */
458
458
  clearFontValues() {
459
459
  this.fontStyles = [];
@@ -463,10 +463,10 @@ export class Text extends Image {
463
463
  }
464
464
 
465
465
  /**
466
- * TBD.
467
- * @param {string} color - TBD.
468
- * @param {number} position - TBD.
469
- * @returns {Text} TBD.
466
+ * Adds a color to this text object at the specified position.
467
+ * @param {string} color - The color to apply.
468
+ * @param {number} position - The character position to apply the color at.
469
+ * @returns {Text} This Text object for chaining.
470
470
  */
471
471
  addColor(color, position) {
472
472
  this.colors[position] = color;
@@ -475,10 +475,10 @@ export class Text extends Image {
475
475
  }
476
476
 
477
477
  /**
478
- * TBD.
479
- * @param {number} color - TBD.
480
- * @param {number} position - TBD.
481
- * @returns {Text} TBD.
478
+ * Adds a stroke color to this text object at the specified position.
479
+ * @param {number} color - The stroke color to apply.
480
+ * @param {number} position - The character position to apply the stroke color at.
481
+ * @returns {Text} This Text object for chaining.
482
482
  */
483
483
  addStrokeColor(color, position) {
484
484
  this.strokeColors[position] = color;
@@ -487,10 +487,10 @@ export class Text extends Image {
487
487
  }
488
488
 
489
489
  /**
490
- * TBD.
491
- * @param {object} style - TBD.
492
- * @param {number} position - TBD.
493
- * @returns {Text} TBD.
490
+ * Adds a font style to this text object at the specified position.
491
+ * @param {object} style - The font style to apply.
492
+ * @param {number} position - The character position to apply the font style at.
493
+ * @returns {Text} This Text object for chaining.
494
494
  */
495
495
  addFontStyle(style, position) {
496
496
  this.fontStyles[position] = style;
@@ -499,10 +499,10 @@ export class Text extends Image {
499
499
  }
500
500
 
501
501
  /**
502
- * TBD.
503
- * @param {number} weight - TBD.
504
- * @param {number} position - TBD.
505
- * @returns {Text} TBD.
502
+ * Adds a font weight to this text object at the specified position.
503
+ * @param {number} weight - The font weight to apply.
504
+ * @param {number} position - The character position to apply the font weight at.
505
+ * @returns {Text} This Text object for chaining.
506
506
  */
507
507
  addFontWeight(weight, position) {
508
508
  this.fontWeights[position] = weight;
@@ -511,9 +511,9 @@ export class Text extends Image {
511
511
  }
512
512
 
513
513
  /**
514
- * TBD.
515
- * @param {string} text - TBD.
516
- * @returns {string[]} TBD.
514
+ * Precalculates word wrap for the given text.
515
+ * @param {string} text - The text to precalculate word wrap for.
516
+ * @returns {string[]} The wrapped lines of text.
517
517
  */
518
518
  precalculateWordWrap(text) {
519
519
  this.texture.baseTexture.resolution = this._res;
@@ -523,9 +523,9 @@ export class Text extends Image {
523
523
  }
524
524
 
525
525
  /**
526
- * TBD.
527
- * @param {string} text - TBD.
528
- * @returns {string} TBD.
526
+ * Runs word wrap on the given text.
527
+ * @param {string} text - The text to run word wrap on.
528
+ * @returns {string} The wrapped text.
529
529
  */
530
530
  runWordWrap(text) {
531
531
  if (this.useAdvancedWrap) {
@@ -535,10 +535,10 @@ export class Text extends Image {
535
535
  }
536
536
 
537
537
  /**
538
- * TBD.
539
- * @param {string} text - TBD.
540
- * @returns {string} TBD.
541
- * @throws {Error}
538
+ * Runs advanced word wrap on the given text.
539
+ * @param {string} text - The text to run advanced word wrap on.
540
+ * @returns {string} The wrapped text.
541
+ * @throws {Error} If the wordWrapWidth setting is less than a single character.
542
542
  */
543
543
  advancedWordWrap(text) {
544
544
  const context = this.context;
@@ -618,9 +618,9 @@ export class Text extends Image {
618
618
  }
619
619
 
620
620
  /**
621
- * TBD.
622
- * @param {string} text - TBD.
623
- * @returns {string} TBD.
621
+ * Runs basic word wrap on the given text.
622
+ * @param {string} text - The text to run basic word wrap on.
623
+ * @returns {string} The wrapped text.
624
624
  */
625
625
  basicWordWrap(text) {
626
626
  let result = '';
@@ -651,8 +651,8 @@ export class Text extends Image {
651
651
  }
652
652
 
653
653
  /**
654
- * TBD.
655
- * @param {object} components - TBD.
654
+ * Updates the font properties based on the given components.
655
+ * @param {object} components - The font components to update from.
656
656
  */
657
657
  updateFont(components) {
658
658
  const font = this.componentsToFont(components);
@@ -666,9 +666,9 @@ export class Text extends Image {
666
666
  }
667
667
 
668
668
  /**
669
- * TBD.
670
- * @param {string} font - TBD.
671
- * @returns {{ font: string, fontStyle?: string, fontVariant?: string, fontWeight?: string, fontSize?: string, fontFamily?: string }} TBD.
669
+ * Converts a font string to components.
670
+ * @param {string} font - The font string to convert.
671
+ * @returns {{ font: string, fontStyle?: string, fontVariant?: string, fontWeight?: string, fontSize?: string, fontFamily?: string }} The font components.
672
672
  */
673
673
  fontToComponents(font) {
674
674
  // The format is specified in http://www.w3.org/TR/CSS2/fonts.html#font-shorthand:
@@ -702,9 +702,9 @@ export class Text extends Image {
702
702
  }
703
703
 
704
704
  /**
705
- * TBD.
706
- * @param {object} components - TBD.
707
- * @returns {string} TBD.
705
+ * Converts font components to a font string.
706
+ * @param {object} components - The font components to convert.
707
+ * @returns {string} The font string.
708
708
  */
709
709
  componentsToFont(components) {
710
710
  const parts = [];
@@ -737,10 +737,10 @@ export class Text extends Image {
737
737
  }
738
738
 
739
739
  /**
740
- * TBD.
741
- * @param {string} text - TBD.
742
- * @param {boolean} immediate - TBD.
743
- * @returns {Text} TBD.
740
+ * Sets the text content of this object.
741
+ * @param {string} text - The new text to set.
742
+ * @param {boolean} immediate - If true, updates the text immediately.
743
+ * @returns {Text} This Text object for chaining.
744
744
  */
745
745
  setText(text, immediate = false) {
746
746
  this.text = text.toString() || '';
@@ -753,9 +753,9 @@ export class Text extends Image {
753
753
  }
754
754
 
755
755
  /**
756
- * TBD.
757
- * @param {string[]|string[][]} list - TBD.
758
- * @returns {Text} TBD.
756
+ * Parses a list of text into this object.
757
+ * @param {string[]|string[][]} list - The list of text to parse.
758
+ * @returns {Text} This Text object for chaining.
759
759
  */
760
760
  parseList(list) {
761
761
  if (!Array.isArray(list)) {
@@ -781,12 +781,12 @@ export class Text extends Image {
781
781
  }
782
782
 
783
783
  /**
784
- * TBD.
785
- * @param {number} x - TBD.
786
- * @param {number} y - TBD.
787
- * @param {number} width - TBD.
788
- * @param {number} height - TBD.
789
- * @returns {Text} TBD.
784
+ * Sets the text bounds for this object.
785
+ * @param {number} x - The x position of the bounds.
786
+ * @param {number} y - The y position of the bounds.
787
+ * @param {number} width - The width of the bounds.
788
+ * @param {number} height - The height of the bounds.
789
+ * @returns {Text} This Text object for chaining.
790
790
  */
791
791
  setTextBounds(x, y, width, height) {
792
792
  if (x === undefined) {
@@ -806,7 +806,7 @@ export class Text extends Image {
806
806
  }
807
807
 
808
808
  /**
809
- * TBD.
809
+ * Updates the texture of this object.
810
810
  */
811
811
  updateTexture() {
812
812
  const base = this.texture.baseTexture;
@@ -848,8 +848,8 @@ export class Text extends Image {
848
848
  }
849
849
 
850
850
  /**
851
- * TBD.
852
- * @param {object} renderSession - TBD.
851
+ * Renders this text object using WebGL.
852
+ * @param {object} renderSession - The render session to use.
853
853
  */
854
854
  renderWebGL(renderSession) {
855
855
  if (this.dirty) {
@@ -860,8 +860,8 @@ export class Text extends Image {
860
860
  }
861
861
 
862
862
  /**
863
- * TBD.
864
- * @param {object} renderSession - TBD.
863
+ * Renders this text object using Canvas.
864
+ * @param {object} renderSession - The render session to use.
865
865
  */
866
866
  renderCanvas(renderSession) {
867
867
  if (this.dirty) {
@@ -872,8 +872,8 @@ export class Text extends Image {
872
872
  }
873
873
 
874
874
  /**
875
- * TBD.
876
- * @returns {{[key: string]: {ascent: number, descent: number, fontSize: number}}} TBD.
875
+ * Gets the font properties cache object.
876
+ * @returns {{[key: string]: {ascent: number, descent: number, fontSize: number}}} The font properties cache.
877
877
  */
878
878
  getFontPropertiesCache() {
879
879
  if (!window.PhaserRegistry.fontPropertiesCache) {
@@ -883,8 +883,8 @@ export class Text extends Image {
883
883
  }
884
884
 
885
885
  /**
886
- * TBD.
887
- * @returns {HTMLCanvasElement} TBD.
886
+ * Gets the font properties canvas element.
887
+ * @returns {HTMLCanvasElement} The font properties canvas element.
888
888
  */
889
889
  getFontPropertiesCanvas() {
890
890
  if (!window.PhaserRegistry.fontPropertiesCanvas) {
@@ -894,8 +894,8 @@ export class Text extends Image {
894
894
  }
895
895
 
896
896
  /**
897
- * TBD.
898
- * @returns {CanvasRenderingContext2D} TBD.
897
+ * Gets the font properties canvas context.
898
+ * @returns {CanvasRenderingContext2D} The font properties canvas context.
899
899
  */
900
900
  getFontPropertiesContext() {
901
901
  if (!window.PhaserRegistry.fontPropertiesContext) {
@@ -907,9 +907,9 @@ export class Text extends Image {
907
907
  }
908
908
 
909
909
  /**
910
- * TBD.
911
- * @param {string} font - TBD.
912
- * @returns {object} TBD.
910
+ * Determines the font properties for a given font.
911
+ * @param {string} font - The font to determine properties for.
912
+ * @returns {object} The font properties.
913
913
  */
914
914
  determineFontProperties(font) {
915
915
  const fontPropertiesCache = this.getFontPropertiesCache();
@@ -932,9 +932,9 @@ export class Text extends Image {
932
932
  }
933
933
 
934
934
  /**
935
- * TBD.
936
- * @param {string} fontStyle - TBD.
937
- * @returns {{ascent: number, descent: number, fontSize: number}} TBD.
935
+ * Determines font properties using a fallback method.
936
+ * @param {string} fontStyle - The font style to determine properties for.
937
+ * @returns {{ascent: number, descent: number, fontSize: number}} The font properties.
938
938
  */
939
939
  determineFontPropertiesFallback(fontStyle) {
940
940
  const fontPropertiesCache = this.getFontPropertiesCache();
@@ -1013,9 +1013,9 @@ export class Text extends Image {
1013
1013
  }
1014
1014
 
1015
1015
  /**
1016
- * TBD.
1017
- * @param {import('../geom/matrix.js').Matrix} matrix - TBD.
1018
- * @returns {Rectangle} TBD.
1016
+ * Gets the bounds of this text object.
1017
+ * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
1018
+ * @returns {Rectangle} The bounds of this text object.
1019
1019
  */
1020
1020
  getBounds(matrix = null) {
1021
1021
  if (this.dirty) {
@@ -1026,16 +1026,16 @@ export class Text extends Image {
1026
1026
  }
1027
1027
 
1028
1028
  /**
1029
- * TBD.
1030
- * @returns {string} TBD.
1029
+ * Gets the text content of this object.
1030
+ * @returns {string} The current text content.
1031
1031
  */
1032
1032
  get text() {
1033
1033
  return this._text;
1034
1034
  }
1035
1035
 
1036
1036
  /**
1037
- * TBD.
1038
- * @param {string | number | boolean | Date} value - TBD.
1037
+ * Sets the text content of this object.
1038
+ * @param {string | number | boolean | Date} value - The new text content to set.
1039
1039
  */
1040
1040
  set text(value) {
1041
1041
  if (value !== this._text) {
@@ -1048,15 +1048,16 @@ export class Text extends Image {
1048
1048
  }
1049
1049
 
1050
1050
  /**
1051
- * TBD.
1052
- * @returns {string} TBD.
1051
+ * Gets the CSS font string for this object.
1052
+ * @returns {string} The CSS font string.
1053
1053
  */
1054
1054
  get cssFont() {
1055
1055
  return this.componentsToFont(this._fontComponents);
1056
1056
  }
1057
1057
 
1058
1058
  /**
1059
- * TBD.
1059
+ * Sets the CSS font string for this object.
1060
+ * @param {string} value - The new CSS font string to set.
1060
1061
  */
1061
1062
  set cssFont(value) {
1062
1063
  this._fontComponents = this.fontToComponents(value || 'bold 20pt Arial');
@@ -1064,15 +1065,16 @@ export class Text extends Image {
1064
1065
  }
1065
1066
 
1066
1067
  /**
1067
- * TBD.
1068
- * @returns {number} TBD.
1068
+ * Gets the font family of this object.
1069
+ * @returns {number} The font family.
1069
1070
  */
1070
1071
  get font() {
1071
1072
  return this._fontComponents.fontFamily;
1072
1073
  }
1073
1074
 
1074
1075
  /**
1075
- * TBD.
1076
+ * Sets the font family of this object.
1077
+ * @param {string} value - The new font family to set.
1076
1078
  */
1077
1079
  set font(value) {
1078
1080
  let mutatedValue = value || 'Arial';
@@ -1087,8 +1089,8 @@ export class Text extends Image {
1087
1089
  }
1088
1090
 
1089
1091
  /**
1090
- * TBD.
1091
- * @returns {number} TBD.
1092
+ * Gets the font size of this object.
1093
+ * @returns {number} The font size.
1092
1094
  */
1093
1095
  get fontSize() {
1094
1096
  const size = this._fontComponents.fontSize;
@@ -1099,7 +1101,8 @@ export class Text extends Image {
1099
1101
  }
1100
1102
 
1101
1103
  /**
1102
- * TBD.
1104
+ * Sets the font size of this object.
1105
+ * @param {number} value - The new font size to set.
1103
1106
  */
1104
1107
  set fontSize(value) {
1105
1108
  let mutatedValue = value || '0';
@@ -1111,15 +1114,16 @@ export class Text extends Image {
1111
1114
  }
1112
1115
 
1113
1116
  /**
1114
- * TBD.
1115
- * @returns {string} TBD.
1117
+ * Gets the font weight of this object.
1118
+ * @returns {string} The font weight.
1116
1119
  */
1117
1120
  get fontWeight() {
1118
1121
  return this._fontComponents.fontWeight || 'normal';
1119
1122
  }
1120
1123
 
1121
1124
  /**
1122
- * TBD.
1125
+ * Sets the font weight of this object.
1126
+ * @param {string} value - The new font weight to set.
1123
1127
  */
1124
1128
  set fontWeight(value) {
1125
1129
  this._fontComponents.fontWeight = value || 'normal';
@@ -1127,15 +1131,16 @@ export class Text extends Image {
1127
1131
  }
1128
1132
 
1129
1133
  /**
1130
- * TBD.
1131
- * @returns {string} TBD.
1134
+ * Gets the font style of this object.
1135
+ * @returns {string} The font style.
1132
1136
  */
1133
1137
  get fontStyle() {
1134
1138
  return this._fontComponents.fontStyle || 'normal';
1135
1139
  }
1136
1140
 
1137
1141
  /**
1138
- * TBD.
1142
+ * Sets the font style of this object.
1143
+ * @param {string} value - The new font style to set.
1139
1144
  */
1140
1145
  set fontStyle(value) {
1141
1146
  this._fontComponents.fontStyle = value || 'normal';
@@ -1143,15 +1148,16 @@ export class Text extends Image {
1143
1148
  }
1144
1149
 
1145
1150
  /**
1146
- * TBD.
1147
- * @returns {string} TBD.
1151
+ * Gets the font variant of this object.
1152
+ * @returns {string} The font variant.
1148
1153
  */
1149
1154
  get fontVariant() {
1150
1155
  return this._fontComponents.fontVariant || 'normal';
1151
1156
  }
1152
1157
 
1153
1158
  /**
1154
- * TBD.
1159
+ * Sets the font variant of this object.
1160
+ * @param {string} value - The new font variant to set.
1155
1161
  */
1156
1162
  set fontVariant(value) {
1157
1163
  this._fontComponents.fontVariant = value || 'normal';
@@ -1159,15 +1165,16 @@ export class Text extends Image {
1159
1165
  }
1160
1166
 
1161
1167
  /**
1162
- * TBD.
1163
- * @returns {number} TBD.
1168
+ * Gets the fill color of this object.
1169
+ * @returns {number} The fill color.
1164
1170
  */
1165
1171
  get fill() {
1166
1172
  return this.style.fill;
1167
1173
  }
1168
1174
 
1169
1175
  /**
1170
- * TBD.
1176
+ * Sets the fill color of this object.
1177
+ * @param {string} value - The new fill color to set.
1171
1178
  */
1172
1179
  set fill(value) {
1173
1180
  if (value !== this.style.fill) {
@@ -1177,15 +1184,16 @@ export class Text extends Image {
1177
1184
  }
1178
1185
 
1179
1186
  /**
1180
- * TBD.
1181
- * @returns {string} TBD.
1187
+ * Gets the alignment of this object.
1188
+ * @returns {string} The text alignment.
1182
1189
  */
1183
1190
  get align() {
1184
1191
  return this.style.align;
1185
1192
  }
1186
1193
 
1187
1194
  /**
1188
- * TBD.
1195
+ * Sets the alignment of this object.
1196
+ * @param {string} value - The new text alignment to set.
1189
1197
  */
1190
1198
  set align(value) {
1191
1199
  if (value !== this.style.align) {
@@ -1195,15 +1203,16 @@ export class Text extends Image {
1195
1203
  }
1196
1204
 
1197
1205
  /**
1198
- * TBD.
1199
- * @returns {number} TBD.
1206
+ * Gets the resolution of this object.
1207
+ * @returns {number} The resolution.
1200
1208
  */
1201
1209
  get resolution() {
1202
1210
  return this._res;
1203
1211
  }
1204
1212
 
1205
1213
  /**
1206
- * TBD.
1214
+ * Sets the resolution of this object.
1215
+ * @param {number} value - The new resolution to set.
1207
1216
  */
1208
1217
  set resolution(value) {
1209
1218
  if (value !== this._res) {
@@ -1213,15 +1222,16 @@ export class Text extends Image {
1213
1222
  }
1214
1223
 
1215
1224
  /**
1216
- * TBD.
1217
- * @returns {number} TBD.
1225
+ * Gets the tabs setting of this object.
1226
+ * @returns {number} The tabs setting.
1218
1227
  */
1219
1228
  get tabs() {
1220
1229
  return this.style.tabs;
1221
1230
  }
1222
1231
 
1223
1232
  /**
1224
- * TBD.
1233
+ * Sets the tabs setting of this object.
1234
+ * @param {number} value - The new tabs setting to set.
1225
1235
  */
1226
1236
  set tabs(value) {
1227
1237
  if (value !== this.style.tabs) {
@@ -1231,15 +1241,16 @@ export class Text extends Image {
1231
1241
  }
1232
1242
 
1233
1243
  /**
1234
- * TBD.
1235
- * @returns {number} TBD.
1244
+ * Gets the horizontal bounds alignment of this object.
1245
+ * @returns {number} The horizontal bounds alignment.
1236
1246
  */
1237
1247
  get boundsAlignH() {
1238
1248
  return this.style.boundsAlignH;
1239
1249
  }
1240
1250
 
1241
1251
  /**
1242
- * TBD.
1252
+ * Sets the horizontal bounds alignment of this object.
1253
+ * @param {number} value - The new horizontal bounds alignment to set.
1243
1254
  */
1244
1255
  set boundsAlignH(value) {
1245
1256
  if (value !== this.style.boundsAlignH) {
@@ -1249,15 +1260,16 @@ export class Text extends Image {
1249
1260
  }
1250
1261
 
1251
1262
  /**
1252
- * TBD.
1253
- * @returns {number} TBD.
1263
+ * Gets the vertical bounds alignment of this object.
1264
+ * @returns {number} The vertical bounds alignment.
1254
1265
  */
1255
1266
  get boundsAlignV() {
1256
1267
  return this.style.boundsAlignV;
1257
1268
  }
1258
1269
 
1259
1270
  /**
1260
- * TBD.
1271
+ * Sets the vertical bounds alignment of this object.
1272
+ * @param {number} value - The new vertical bounds alignment to set.
1261
1273
  */
1262
1274
  set boundsAlignV(value) {
1263
1275
  if (value !== this.style.boundsAlignV) {
@@ -1267,15 +1279,16 @@ export class Text extends Image {
1267
1279
  }
1268
1280
 
1269
1281
  /**
1270
- * TBD.
1271
- * @returns {number} TBD.
1282
+ * Gets the stroke color of this object.
1283
+ * @returns {number} The stroke color.
1272
1284
  */
1273
1285
  get stroke() {
1274
1286
  return this.style.stroke;
1275
1287
  }
1276
1288
 
1277
1289
  /**
1278
- * TBD.
1290
+ * Sets the stroke color of this object.
1291
+ * @param {string} value - The new stroke color to set.
1279
1292
  */
1280
1293
  set stroke(value) {
1281
1294
  if (value !== this.style.stroke) {
@@ -1285,15 +1298,16 @@ export class Text extends Image {
1285
1298
  }
1286
1299
 
1287
1300
  /**
1288
- * TBD.
1289
- * @returns {number} TBD.
1301
+ * Gets the stroke thickness of this object.
1302
+ * @returns {number} The stroke thickness.
1290
1303
  */
1291
1304
  get strokeThickness() {
1292
1305
  return this.style.strokeThickness;
1293
1306
  }
1294
1307
 
1295
1308
  /**
1296
- * TBD.
1309
+ * Sets the stroke thickness of this object.
1310
+ * @param {number} value - The new stroke thickness to set.
1297
1311
  */
1298
1312
  set strokeThickness(value) {
1299
1313
  if (value !== this.style.strokeThickness) {
@@ -1303,15 +1317,16 @@ export class Text extends Image {
1303
1317
  }
1304
1318
 
1305
1319
  /**
1306
- * TBD.
1307
- * @returns {number} TBD.
1320
+ * Gets the word wrap setting of this object.
1321
+ * @returns {number} The word wrap setting.
1308
1322
  */
1309
1323
  get wordWrap() {
1310
1324
  return this.style.wordWrap;
1311
1325
  }
1312
1326
 
1313
1327
  /**
1314
- * TBD.
1328
+ * Sets the word wrap setting of this object.
1329
+ * @param {boolean} value - The new word wrap setting to set.
1315
1330
  */
1316
1331
  set wordWrap(value) {
1317
1332
  if (value !== this.style.wordWrap) {
@@ -1321,15 +1336,16 @@ export class Text extends Image {
1321
1336
  }
1322
1337
 
1323
1338
  /**
1324
- * TBD.
1325
- * @returns {number} TBD.
1339
+ * Gets the word wrap width of this object.
1340
+ * @returns {number} The word wrap width.
1326
1341
  */
1327
1342
  get wordWrapWidth() {
1328
1343
  return this.style.wordWrapWidth;
1329
1344
  }
1330
1345
 
1331
1346
  /**
1332
- * TBD.
1347
+ * Sets the word wrap width of this object.
1348
+ * @param {number} value - The new word wrap width to set.
1333
1349
  */
1334
1350
  set wordWrapWidth(value) {
1335
1351
  if (value !== this.style.wordWrapWidth) {
@@ -1339,15 +1355,16 @@ export class Text extends Image {
1339
1355
  }
1340
1356
 
1341
1357
  /**
1342
- * TBD.
1343
- * @returns {number} TBD.
1358
+ * Gets the line spacing of this object.
1359
+ * @returns {number} The line spacing.
1344
1360
  */
1345
1361
  get lineSpacing() {
1346
1362
  return this._lineSpacing;
1347
1363
  }
1348
1364
 
1349
1365
  /**
1350
- * TBD.
1366
+ * Sets the line spacing of this object.
1367
+ * @param {number} value - The new line spacing to set.
1351
1368
  */
1352
1369
  set lineSpacing(value) {
1353
1370
  if (value !== this._lineSpacing) {
@@ -1360,15 +1377,16 @@ export class Text extends Image {
1360
1377
  }
1361
1378
 
1362
1379
  /**
1363
- * TBD.
1364
- * @returns {number} TBD.
1380
+ * Gets the shadow offset X of this object.
1381
+ * @returns {number} The shadow offset X.
1365
1382
  */
1366
1383
  get shadowOffsetX() {
1367
1384
  return this.style.shadowOffsetX;
1368
1385
  }
1369
1386
 
1370
1387
  /**
1371
- * TBD.
1388
+ * Sets the shadow offset X of this object.
1389
+ * @param {number} value - The new shadow offset X to set.
1372
1390
  */
1373
1391
  set shadowOffsetX(value) {
1374
1392
  if (value !== this.style.shadowOffsetX) {
@@ -1378,15 +1396,16 @@ export class Text extends Image {
1378
1396
  }
1379
1397
 
1380
1398
  /**
1381
- * TBD.
1382
- * @returns {number} TBD.
1399
+ * Gets the shadow offset Y of this object.
1400
+ * @returns {number} The shadow offset Y.
1383
1401
  */
1384
1402
  get shadowOffsetY() {
1385
1403
  return this.style.shadowOffsetY;
1386
1404
  }
1387
1405
 
1388
1406
  /**
1389
- * TBD.
1407
+ * Sets the shadow offset Y of this object.
1408
+ * @param {number} value - The new shadow offset Y to set.
1390
1409
  */
1391
1410
  set shadowOffsetY(value) {
1392
1411
  if (value !== this.style.shadowOffsetY) {
@@ -1396,15 +1415,16 @@ export class Text extends Image {
1396
1415
  }
1397
1416
 
1398
1417
  /**
1399
- * TBD.
1400
- * @returns {number} TBD.
1418
+ * Gets the shadow color of this object.
1419
+ * @returns {number} The shadow color.
1401
1420
  */
1402
1421
  get shadowColor() {
1403
1422
  return this.style.shadowColor;
1404
1423
  }
1405
1424
 
1406
1425
  /**
1407
- * TBD.
1426
+ * Sets the shadow color of this object.
1427
+ * @param {string} value - The new shadow color to set.
1408
1428
  */
1409
1429
  set shadowColor(value) {
1410
1430
  if (value !== this.style.shadowColor) {
@@ -1414,15 +1434,16 @@ export class Text extends Image {
1414
1434
  }
1415
1435
 
1416
1436
  /**
1417
- * TBD.
1418
- * @returns {number} TBD.
1437
+ * Gets the shadow blur of this object.
1438
+ * @returns {number} The shadow blur.
1419
1439
  */
1420
1440
  get shadowBlur() {
1421
1441
  return this.style.shadowBlur;
1422
1442
  }
1423
1443
 
1424
1444
  /**
1425
- * TBD.
1445
+ * Sets the shadow blur of this object.
1446
+ * @param {number} value - The new shadow blur to set.
1426
1447
  */
1427
1448
  set shadowBlur(value) {
1428
1449
  if (value !== this.style.shadowBlur) {
@@ -1432,15 +1453,16 @@ export class Text extends Image {
1432
1453
  }
1433
1454
 
1434
1455
  /**
1435
- * TBD.
1436
- * @returns {number} TBD.
1456
+ * Gets the shadow stroke setting of this object.
1457
+ * @returns {number} The shadow stroke setting.
1437
1458
  */
1438
1459
  get shadowStroke() {
1439
1460
  return this.style.shadowStroke;
1440
1461
  }
1441
1462
 
1442
1463
  /**
1443
- * TBD.
1464
+ * Sets the shadow stroke setting of this object.
1465
+ * @param {boolean} value - The new shadow stroke setting to set.
1444
1466
  */
1445
1467
  set shadowStroke(value) {
1446
1468
  if (value !== this.style.shadowStroke) {
@@ -1450,15 +1472,16 @@ export class Text extends Image {
1450
1472
  }
1451
1473
 
1452
1474
  /**
1453
- * TBD.
1454
- * @returns {number} TBD.
1475
+ * Gets the shadow fill setting of this object.
1476
+ * @returns {number} The shadow fill setting.
1455
1477
  */
1456
1478
  get shadowFill() {
1457
1479
  return this.style.shadowFill;
1458
1480
  }
1459
1481
 
1460
1482
  /**
1461
- * TBD.
1483
+ * Sets the shadow fill setting of this object.
1484
+ * @param {boolean} value - The new shadow fill setting to set.
1462
1485
  */
1463
1486
  set shadowFill(value) {
1464
1487
  if (value !== this.style.shadowFill) {
@@ -1468,8 +1491,8 @@ export class Text extends Image {
1468
1491
  }
1469
1492
 
1470
1493
  /**
1471
- * TBD.
1472
- * @returns {number} TBD.
1494
+ * Gets the width of this object.
1495
+ * @returns {number} The width in pixels.
1473
1496
  */
1474
1497
  get width() {
1475
1498
  if (this.dirty) {
@@ -1480,7 +1503,8 @@ export class Text extends Image {
1480
1503
  }
1481
1504
 
1482
1505
  /**
1483
- * TBD.
1506
+ * Sets the width of this object.
1507
+ * @param {number} value - The new width to set in pixels.
1484
1508
  */
1485
1509
  set width(value) {
1486
1510
  this.scale.x = value / this.texture.frame.width;
@@ -1488,8 +1512,8 @@ export class Text extends Image {
1488
1512
  }
1489
1513
 
1490
1514
  /**
1491
- * TBD.
1492
- * @returns {number} TBD.
1515
+ * Gets the height of this object.
1516
+ * @returns {number} The height in pixels.
1493
1517
  */
1494
1518
  get height() {
1495
1519
  if (this.dirty) {
@@ -1500,7 +1524,8 @@ export class Text extends Image {
1500
1524
  }
1501
1525
 
1502
1526
  /**
1503
- * TBD.
1527
+ * Sets the height of this object.
1528
+ * @param {number} value - The new height to set in pixels.
1504
1529
  */
1505
1530
  set height(value) {
1506
1531
  this.scale.y = value / this.texture.frame.height;