@vpmedia/phaser 1.94.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 (205) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/package.json +11 -11
  3. package/src/phaser/core/animation.js +79 -56
  4. package/src/phaser/core/animation_manager.js +55 -55
  5. package/src/phaser/core/animation_parser.js +2 -2
  6. package/src/phaser/core/cache.js +154 -154
  7. package/src/phaser/core/device.js +2 -1
  8. package/src/phaser/core/device_util.js +27 -27
  9. package/src/phaser/core/dom.js +43 -43
  10. package/src/phaser/core/event_manager.js +63 -63
  11. package/src/phaser/core/factory.js +47 -47
  12. package/src/phaser/core/frame.js +30 -30
  13. package/src/phaser/core/frame_data.js +30 -28
  14. package/src/phaser/core/frame_util.js +8 -8
  15. package/src/phaser/core/game.js +35 -19
  16. package/src/phaser/core/input_pointer.js +18 -0
  17. package/src/phaser/core/loader.js +171 -171
  18. package/src/phaser/core/loader_parser.js +22 -22
  19. package/src/phaser/core/raf.js +1 -1
  20. package/src/phaser/core/scale_manager.js +3 -2
  21. package/src/phaser/core/scene.js +16 -10
  22. package/src/phaser/core/scene_manager.js +51 -43
  23. package/src/phaser/core/signal.js +56 -52
  24. package/src/phaser/core/sound.js +54 -54
  25. package/src/phaser/core/sound_manager.js +49 -49
  26. package/src/phaser/core/stage.js +16 -16
  27. package/src/phaser/core/time.js +54 -30
  28. package/src/phaser/core/timer.js +82 -64
  29. package/src/phaser/core/timer_event.js +9 -9
  30. package/src/phaser/core/tween.js +106 -90
  31. package/src/phaser/core/tween_data.js +30 -30
  32. package/src/phaser/core/tween_manager.js +32 -24
  33. package/src/phaser/core/world.js +4 -3
  34. package/src/phaser/display/bitmap_text.js +72 -54
  35. package/src/phaser/display/button.js +48 -47
  36. package/src/phaser/display/canvas/buffer.js +8 -8
  37. package/src/phaser/display/canvas/graphics.js +8 -8
  38. package/src/phaser/display/canvas/masker.js +5 -5
  39. package/src/phaser/display/canvas/pool.js +18 -18
  40. package/src/phaser/display/canvas/renderer.js +17 -16
  41. package/src/phaser/display/canvas/tinter.js +22 -22
  42. package/src/phaser/display/canvas/util.js +42 -42
  43. package/src/phaser/display/display_object.js +119 -108
  44. package/src/phaser/display/graphics.js +129 -112
  45. package/src/phaser/display/graphics_data.js +10 -10
  46. package/src/phaser/display/graphics_data_util.js +3 -3
  47. package/src/phaser/display/group.js +63 -50
  48. package/src/phaser/display/image.js +68 -50
  49. package/src/phaser/display/sprite_batch.js +2 -2
  50. package/src/phaser/display/sprite_util.js +19 -19
  51. package/src/phaser/display/text.js +217 -187
  52. package/src/phaser/display/webgl/abstract_filter.js +4 -4
  53. package/src/phaser/display/webgl/base_texture.js +9 -9
  54. package/src/phaser/display/webgl/blend_manager.js +7 -7
  55. package/src/phaser/display/webgl/earcut.js +95 -95
  56. package/src/phaser/display/webgl/earcut_node.js +4 -4
  57. package/src/phaser/display/webgl/fast_sprite_batch.js +15 -15
  58. package/src/phaser/display/webgl/filter_manager.js +9 -9
  59. package/src/phaser/display/webgl/filter_texture.js +10 -10
  60. package/src/phaser/display/webgl/graphics.js +37 -37
  61. package/src/phaser/display/webgl/graphics_data.js +4 -4
  62. package/src/phaser/display/webgl/mask_manager.js +6 -6
  63. package/src/phaser/display/webgl/render_texture.js +16 -16
  64. package/src/phaser/display/webgl/renderer.js +21 -20
  65. package/src/phaser/display/webgl/shader/complex.js +4 -4
  66. package/src/phaser/display/webgl/shader/fast.js +4 -4
  67. package/src/phaser/display/webgl/shader/normal.js +8 -8
  68. package/src/phaser/display/webgl/shader/primitive.js +4 -4
  69. package/src/phaser/display/webgl/shader/strip.js +4 -4
  70. package/src/phaser/display/webgl/shader_manager.js +9 -9
  71. package/src/phaser/display/webgl/sprite_batch.js +18 -18
  72. package/src/phaser/display/webgl/stencil_manager.js +16 -16
  73. package/src/phaser/display/webgl/texture.js +13 -13
  74. package/src/phaser/display/webgl/texture_util.js +8 -8
  75. package/src/phaser/display/webgl/util.js +25 -25
  76. package/src/phaser/geom/circle.js +74 -69
  77. package/src/phaser/geom/ellipse.js +33 -28
  78. package/src/phaser/geom/line.js +96 -93
  79. package/src/phaser/geom/matrix.js +61 -54
  80. package/src/phaser/geom/point.js +99 -96
  81. package/src/phaser/geom/polygon.js +27 -22
  82. package/src/phaser/geom/rectangle.js +137 -132
  83. package/src/phaser/geom/rounded_rectangle.js +12 -12
  84. package/src/phaser/geom/util/circle.js +33 -33
  85. package/src/phaser/geom/util/ellipse.js +5 -5
  86. package/src/phaser/geom/util/line.js +26 -26
  87. package/src/phaser/geom/util/matrix.js +8 -8
  88. package/src/phaser/geom/util/point.js +97 -97
  89. package/src/phaser/geom/util/polygon.js +4 -4
  90. package/src/phaser/geom/util/rectangle.js +74 -74
  91. package/src/phaser/geom/util/rounded_rectangle.js +4 -4
  92. package/src/phaser/util/math.js +81 -81
  93. package/types/phaser/core/animation.d.ts +79 -56
  94. package/types/phaser/core/animation.d.ts.map +1 -1
  95. package/types/phaser/core/animation_manager.d.ts +55 -55
  96. package/types/phaser/core/animation_parser.d.ts +3 -2
  97. package/types/phaser/core/animation_parser.d.ts.map +1 -1
  98. package/types/phaser/core/cache.d.ts +154 -154
  99. package/types/phaser/core/device.d.ts.map +1 -1
  100. package/types/phaser/core/dom.d.ts +51 -44
  101. package/types/phaser/core/dom.d.ts.map +1 -1
  102. package/types/phaser/core/event_manager.d.ts +63 -63
  103. package/types/phaser/core/factory.d.ts +47 -47
  104. package/types/phaser/core/frame.d.ts +30 -30
  105. package/types/phaser/core/frame_data.d.ts +28 -27
  106. package/types/phaser/core/frame_data.d.ts.map +1 -1
  107. package/types/phaser/core/game.d.ts +54 -21
  108. package/types/phaser/core/game.d.ts.map +1 -1
  109. package/types/phaser/core/input_pointer.d.ts +18 -0
  110. package/types/phaser/core/input_pointer.d.ts.map +1 -1
  111. package/types/phaser/core/loader.d.ts +175 -172
  112. package/types/phaser/core/loader.d.ts.map +1 -1
  113. package/types/phaser/core/loader_parser.d.ts.map +1 -1
  114. package/types/phaser/core/raf.d.ts +1 -1
  115. package/types/phaser/core/scale_manager.d.ts +6 -5
  116. package/types/phaser/core/scale_manager.d.ts.map +1 -1
  117. package/types/phaser/core/scene.d.ts +15 -9
  118. package/types/phaser/core/scene.d.ts.map +1 -1
  119. package/types/phaser/core/scene_manager.d.ts +51 -43
  120. package/types/phaser/core/scene_manager.d.ts.map +1 -1
  121. package/types/phaser/core/signal.d.ts +54 -51
  122. package/types/phaser/core/signal.d.ts.map +1 -1
  123. package/types/phaser/core/sound.d.ts +54 -54
  124. package/types/phaser/core/sound_manager.d.ts +49 -49
  125. package/types/phaser/core/stage.d.ts +10 -10
  126. package/types/phaser/core/time.d.ts +54 -30
  127. package/types/phaser/core/time.d.ts.map +1 -1
  128. package/types/phaser/core/timer.d.ts +82 -64
  129. package/types/phaser/core/timer.d.ts.map +1 -1
  130. package/types/phaser/core/timer_event.d.ts +9 -9
  131. package/types/phaser/core/tween.d.ts +106 -90
  132. package/types/phaser/core/tween.d.ts.map +1 -1
  133. package/types/phaser/core/tween_data.d.ts +30 -30
  134. package/types/phaser/core/tween_manager.d.ts +35 -67
  135. package/types/phaser/core/tween_manager.d.ts.map +1 -1
  136. package/types/phaser/core/world.d.ts +4 -3
  137. package/types/phaser/core/world.d.ts.map +1 -1
  138. package/types/phaser/display/bitmap_text.d.ts +76 -53
  139. package/types/phaser/display/bitmap_text.d.ts.map +1 -1
  140. package/types/phaser/display/button.d.ts +47 -46
  141. package/types/phaser/display/button.d.ts.map +1 -1
  142. package/types/phaser/display/canvas/buffer.d.ts +8 -8
  143. package/types/phaser/display/canvas/graphics.d.ts +3 -3
  144. package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
  145. package/types/phaser/display/canvas/pool.d.ts +6 -3
  146. package/types/phaser/display/canvas/pool.d.ts.map +1 -1
  147. package/types/phaser/display/canvas/renderer.d.ts +18 -17
  148. package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
  149. package/types/phaser/display/canvas/util.d.ts +6 -6
  150. package/types/phaser/display/canvas/util.d.ts.map +1 -1
  151. package/types/phaser/display/display_object.d.ts +119 -108
  152. package/types/phaser/display/display_object.d.ts.map +1 -1
  153. package/types/phaser/display/graphics.d.ts +118 -102
  154. package/types/phaser/display/graphics.d.ts.map +1 -1
  155. package/types/phaser/display/graphics_data.d.ts +10 -10
  156. package/types/phaser/display/group.d.ts +59 -47
  157. package/types/phaser/display/group.d.ts.map +1 -1
  158. package/types/phaser/display/image.d.ts +58 -45
  159. package/types/phaser/display/image.d.ts.map +1 -1
  160. package/types/phaser/display/text.d.ts +237 -188
  161. package/types/phaser/display/text.d.ts.map +1 -1
  162. package/types/phaser/display/webgl/abstract_filter.d.ts +4 -4
  163. package/types/phaser/display/webgl/base_texture.d.ts +10 -10
  164. package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
  165. package/types/phaser/display/webgl/blend_manager.d.ts +6 -6
  166. package/types/phaser/display/webgl/earcut.d.ts +95 -95
  167. package/types/phaser/display/webgl/earcut_node.d.ts +4 -4
  168. package/types/phaser/display/webgl/fast_sprite_batch.d.ts +15 -15
  169. package/types/phaser/display/webgl/filter_manager.d.ts +8 -8
  170. package/types/phaser/display/webgl/filter_texture.d.ts +10 -10
  171. package/types/phaser/display/webgl/graphics.d.ts +2 -2
  172. package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
  173. package/types/phaser/display/webgl/graphics_data.d.ts +4 -4
  174. package/types/phaser/display/webgl/render_texture.d.ts +16 -16
  175. package/types/phaser/display/webgl/renderer.d.ts +21 -20
  176. package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
  177. package/types/phaser/display/webgl/shader/complex.d.ts +4 -4
  178. package/types/phaser/display/webgl/shader/fast.d.ts +4 -4
  179. package/types/phaser/display/webgl/shader/normal.d.ts +8 -8
  180. package/types/phaser/display/webgl/shader/primitive.d.ts +4 -4
  181. package/types/phaser/display/webgl/shader/strip.d.ts +4 -4
  182. package/types/phaser/display/webgl/shader_manager.d.ts +8 -8
  183. package/types/phaser/display/webgl/sprite_batch.d.ts +17 -17
  184. package/types/phaser/display/webgl/stencil_manager.d.ts +15 -15
  185. package/types/phaser/display/webgl/texture.d.ts +12 -12
  186. package/types/phaser/display/webgl/texture_util.d.ts +4 -2
  187. package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
  188. package/types/phaser/geom/circle.d.ts +74 -69
  189. package/types/phaser/geom/circle.d.ts.map +1 -1
  190. package/types/phaser/geom/ellipse.d.ts +33 -28
  191. package/types/phaser/geom/ellipse.d.ts.map +1 -1
  192. package/types/phaser/geom/line.d.ts +96 -93
  193. package/types/phaser/geom/line.d.ts.map +1 -1
  194. package/types/phaser/geom/matrix.d.ts +61 -54
  195. package/types/phaser/geom/matrix.d.ts.map +1 -1
  196. package/types/phaser/geom/point.d.ts +99 -96
  197. package/types/phaser/geom/point.d.ts.map +1 -1
  198. package/types/phaser/geom/polygon.d.ts +29 -23
  199. package/types/phaser/geom/polygon.d.ts.map +1 -1
  200. package/types/phaser/geom/rectangle.d.ts +137 -132
  201. package/types/phaser/geom/rectangle.d.ts.map +1 -1
  202. package/types/phaser/geom/rounded_rectangle.d.ts +12 -12
  203. package/types/phaser/geom/util/point.d.ts +1 -1
  204. package/types/phaser/geom/util/point.d.ts.map +1 -1
  205. package/pnpm-workspace.yaml +0 -4
@@ -26,36 +26,53 @@ import { textureFromCanvas } from './webgl/texture_util.js';
26
26
 
27
27
  export class Graphics extends DisplayObject {
28
28
  /**
29
- * TBD.
30
- * @param {import('../core/game.js').Game} game - TBD.
31
- * @param {number} x - TBD.
32
- * @param {number} y - TBD.
29
+ * Creates a new Graphics object.
30
+ * @param {import('../core/game.js').Game} game - The game instance.
31
+ * @param {number} x - The x coordinate of the graphics object.
32
+ * @param {number} y - The y coordinate of the graphics object.
33
33
  */
34
34
  constructor(game, x = 0, y = 0) {
35
35
  super(game);
36
+ /** @type {number} */
36
37
  this.type = GRAPHICS;
37
38
  this.position.setTo(x, y);
39
+ /** @type {boolean} */
38
40
  this.renderable = true;
41
+ /** @type {number} */
39
42
  this.fillAlpha = 1;
43
+ /** @type {number} */
40
44
  this.lineWidth = 0;
45
+ /** @type {number} */
41
46
  this.lineColor = 0;
42
47
  this.graphicsData = [];
48
+ /** @type {number} */
43
49
  this.tint = 0xffffff;
50
+ /** @type {number} */
44
51
  this.blendMode = BLEND_NORMAL;
52
+ /** @type {GraphicsData} */
45
53
  this.currentPath = null;
54
+ /** @type {object[]} */
46
55
  this._webGL = [];
56
+ /** @type {boolean} */
47
57
  this.isMask = false;
58
+ /** @type {number} */
48
59
  this.boundsPadding = 0;
60
+ /** @type {Rectangle} */
49
61
  this._localBounds = new Rectangle(0, 0, 1, 1);
62
+ /** @type {boolean} */
50
63
  this.dirty = true;
64
+ /** @type {boolean} */
51
65
  this._boundsDirty = false;
66
+ /** @type {boolean} */
52
67
  this._cacheAsBitmap = false;
68
+ /** @type {boolean} */
53
69
  this.webGLDirty = false;
70
+ /** @type {boolean} */
54
71
  this.cachedSpriteDirty = false;
55
72
  }
56
73
 
57
74
  /**
58
- * TBD.
75
+ * Destroys the graphics object and clears all data.
59
76
  */
60
77
  destroy() {
61
78
  // TODO
@@ -64,11 +81,11 @@ export class Graphics extends DisplayObject {
64
81
  }
65
82
 
66
83
  /**
67
- * TBD.
68
- * @param {number} lineWidth - TBD.
69
- * @param {number} color - TBD.
70
- * @param {number} alpha - TBD.
71
- * @returns {Graphics} TBD.
84
+ * Sets the line style for subsequent drawing operations.
85
+ * @param {number} lineWidth - The width of the line to draw.
86
+ * @param {number} color - The color of the line to draw.
87
+ * @param {number} alpha - The alpha (transparency) of the line to draw.
88
+ * @returns {Graphics} This Graphics object for chaining.
72
89
  */
73
90
  lineStyle(lineWidth = 0, color = 0, alpha = 1) {
74
91
  this.lineWidth = lineWidth || 0;
@@ -89,10 +106,10 @@ export class Graphics extends DisplayObject {
89
106
  }
90
107
 
91
108
  /**
92
- * TBD.
93
- * @param {number} x - TBD.
94
- * @param {number} y - TBD.
95
- * @returns {Graphics} TBD.
109
+ * Moves the drawing cursor to the specified point.
110
+ * @param {number} x - The x coordinate to move to.
111
+ * @param {number} y - The y coordinate to move to.
112
+ * @returns {Graphics} This Graphics object for chaining.
96
113
  */
97
114
  moveTo(x, y) {
98
115
  this.drawShape(new Polygon([x, y]));
@@ -100,10 +117,10 @@ export class Graphics extends DisplayObject {
100
117
  }
101
118
 
102
119
  /**
103
- * TBD.
104
- * @param {number} x - TBD.
105
- * @param {number} y - TBD.
106
- * @returns {Graphics} TBD.
120
+ * Draws a line from the current drawing position to the specified point.
121
+ * @param {number} x - The x coordinate to draw to.
122
+ * @param {number} y - The y coordinate to draw to.
123
+ * @returns {Graphics} This Graphics object for chaining.
107
124
  */
108
125
  lineTo(x, y) {
109
126
  if (!this.currentPath) {
@@ -116,12 +133,12 @@ export class Graphics extends DisplayObject {
116
133
  }
117
134
 
118
135
  /**
119
- * TBD.
120
- * @param {number} cpX - TBD.
121
- * @param {number} cpY - TBD.
122
- * @param {number} toX - TBD.
123
- * @param {number} toY - TBD.
124
- * @returns {Graphics} TBD.
136
+ * Draws a quadratic curve from the current position to the specified point.
137
+ * @param {number} cpX - The x coordinate of the control point.
138
+ * @param {number} cpY - The y coordinate of the control point.
139
+ * @param {number} toX - The x coordinate to draw to.
140
+ * @param {number} toY - The y coordinate to draw to.
141
+ * @returns {Graphics} This Graphics object for chaining.
125
142
  */
126
143
  quadraticCurveTo(cpX, cpY, toX, toY) {
127
144
  if (this.currentPath) {
@@ -153,14 +170,14 @@ export class Graphics extends DisplayObject {
153
170
  }
154
171
 
155
172
  /**
156
- * TBD.
157
- * @param {number} cpX - TBD.
158
- * @param {number} cpY - TBD.
159
- * @param {number} cpX2 - TBD.
160
- * @param {number} cpY2 - TBD.
161
- * @param {number} toX - TBD.
162
- * @param {number} toY - TBD.
163
- * @returns {Graphics} TBD.
173
+ * Draws a cubic Bezier curve from the current position to the specified point.
174
+ * @param {number} cpX - The x coordinate of the first control point.
175
+ * @param {number} cpY - The y coordinate of the first control point.
176
+ * @param {number} cpX2 - The x coordinate of the second control point.
177
+ * @param {number} cpY2 - The y coordinate of the second control point.
178
+ * @param {number} toX - The x coordinate to draw to.
179
+ * @param {number} toY - The y coordinate to draw to.
180
+ * @returns {Graphics} This Graphics object for chaining.
164
181
  */
165
182
  bezierCurveTo(cpX, cpY, cpX2, cpY2, toX, toY) {
166
183
  if (this.currentPath) {
@@ -198,13 +215,13 @@ export class Graphics extends DisplayObject {
198
215
  }
199
216
 
200
217
  /**
201
- * TBD.
202
- * @param {number} x1 - TBD.
203
- * @param {number} y1 - TBD.
204
- * @param {number} x2 - TBD.
205
- * @param {number} y2 - TBD.
206
- * @param {number} radius - TBD.
207
- * @returns {Graphics} TBD.
218
+ * Draws an arc from the current position to the specified point.
219
+ * @param {number} x1 - The x coordinate of the starting point.
220
+ * @param {number} y1 - The y coordinate of the starting point.
221
+ * @param {number} x2 - The x coordinate of the end point.
222
+ * @param {number} y2 - The y coordinate of the end point.
223
+ * @param {number} radius - The radius of the arc.
224
+ * @returns {Graphics} This Graphics object for chaining.
208
225
  */
209
226
  arcTo(x1, y1, x2, y2, radius) {
210
227
  if (this.currentPath) {
@@ -250,15 +267,15 @@ export class Graphics extends DisplayObject {
250
267
  }
251
268
 
252
269
  /**
253
- * TBD.
254
- * @param {number} cx - TBD.
255
- * @param {number} cy - TBD.
256
- * @param {number} radius - TBD.
257
- * @param {number} startAngle - TBD.
258
- * @param {number} endAngle - TBD.
259
- * @param {boolean} anticlockwise - TBD.
260
- * @param {number} segments - TBD.
261
- * @returns {Graphics} TBD.
270
+ * Draws an arc with the specified center, radius, and angles.
271
+ * @param {number} cx - The x coordinate of the center point.
272
+ * @param {number} cy - The y coordinate of the center point.
273
+ * @param {number} radius - The radius of the arc.
274
+ * @param {number} startAngle - The starting angle in radians.
275
+ * @param {number} endAngle - The ending angle in radians.
276
+ * @param {boolean} anticlockwise - Whether to draw the arc anticlockwise.
277
+ * @param {number} segments - The number of segments to use for drawing the arc.
278
+ * @returns {Graphics} This Graphics object for chaining.
262
279
  */
263
280
  arc(cx, cy, radius, startAngle, endAngle, anticlockwise = false, segments = 40) {
264
281
  // If we do this we can never draw a full circle
@@ -304,10 +321,10 @@ export class Graphics extends DisplayObject {
304
321
  }
305
322
 
306
323
  /**
307
- * TBD.
308
- * @param {number} color - TBD.
309
- * @param {number} alpha - TBD.
310
- * @returns {Graphics} TBD.
324
+ * Begins filling with the specified color and alpha.
325
+ * @param {number} color - The fill color to use.
326
+ * @param {number} alpha - The fill alpha (transparency) to use.
327
+ * @returns {Graphics} This Graphics object for chaining.
311
328
  */
312
329
  beginFill(color = 0, alpha = 1) {
313
330
  this.filling = true;
@@ -324,8 +341,8 @@ export class Graphics extends DisplayObject {
324
341
  }
325
342
 
326
343
  /**
327
- * TBD.
328
- * @returns {Graphics} TBD.
344
+ * Ends the current fill operation.
345
+ * @returns {Graphics} This Graphics object for chaining.
329
346
  */
330
347
  endFill() {
331
348
  this.filling = false;
@@ -335,12 +352,12 @@ export class Graphics extends DisplayObject {
335
352
  }
336
353
 
337
354
  /**
338
- * TBD.
339
- * @param {number} x - TBD.
340
- * @param {number} y - TBD.
341
- * @param {number} width - TBD.
342
- * @param {number} height - TBD.
343
- * @returns {Graphics} TBD.
355
+ * Draws a rectangle with the specified properties.
356
+ * @param {number} x - The x coordinate of the rectangle.
357
+ * @param {number} y - The y coordinate of the rectangle.
358
+ * @param {number} width - The width of the rectangle.
359
+ * @param {number} height - The height of the rectangle.
360
+ * @returns {Graphics} This Graphics object for chaining.
344
361
  */
345
362
  drawRect(x, y, width, height) {
346
363
  this.drawShape(new Rectangle(x, y, width, height));
@@ -348,13 +365,13 @@ export class Graphics extends DisplayObject {
348
365
  }
349
366
 
350
367
  /**
351
- * TBD.
352
- * @param {number} x - TBD.
353
- * @param {number} y - TBD.
354
- * @param {number} width - TBD.
355
- * @param {number} height - TBD.
356
- * @param {number} radius - TBD.
357
- * @returns {Graphics} TBD.
368
+ * Draws a rounded rectangle with the specified properties.
369
+ * @param {number} x - The x coordinate of the rectangle.
370
+ * @param {number} y - The y coordinate of the rectangle.
371
+ * @param {number} width - The width of the rectangle.
372
+ * @param {number} height - The height of the rectangle.
373
+ * @param {number} radius - The radius of the rounded corners.
374
+ * @returns {Graphics} This Graphics object for chaining.
358
375
  */
359
376
  drawRoundedRect(x, y, width, height, radius) {
360
377
  this.drawShape(new RoundedRectangle(x, y, width, height, radius));
@@ -362,11 +379,11 @@ export class Graphics extends DisplayObject {
362
379
  }
363
380
 
364
381
  /**
365
- * TBD.
366
- * @param {number} x - TBD.
367
- * @param {number} y - TBD.
368
- * @param {number} diameter - TBD.
369
- * @returns {Graphics} TBD.
382
+ * Draws a circle with the specified properties.
383
+ * @param {number} x - The x coordinate of the center point.
384
+ * @param {number} y - The y coordinate of the center point.
385
+ * @param {number} diameter - The diameter of the circle.
386
+ * @returns {Graphics} This Graphics object for chaining.
370
387
  */
371
388
  drawCircle(x, y, diameter) {
372
389
  this.drawShape(new Circle(x, y, diameter));
@@ -374,12 +391,12 @@ export class Graphics extends DisplayObject {
374
391
  }
375
392
 
376
393
  /**
377
- * TBD.
378
- * @param {number} x - TBD.
379
- * @param {number} y - TBD.
380
- * @param {number} width - TBD.
381
- * @param {number} height - TBD.
382
- * @returns {Graphics} TBD.
394
+ * Draws an ellipse with the specified properties.
395
+ * @param {number} x - The x coordinate of the center point.
396
+ * @param {number} y - The y coordinate of the center point.
397
+ * @param {number} width - The width of the ellipse.
398
+ * @param {number} height - The height of the ellipse.
399
+ * @returns {Graphics} This Graphics object for chaining.
383
400
  */
384
401
  drawEllipse(x, y, width, height) {
385
402
  this.drawShape(new Ellipse(x, y, width, height));
@@ -387,9 +404,9 @@ export class Graphics extends DisplayObject {
387
404
  }
388
405
 
389
406
  /**
390
- * TBD.
391
- * @param {Polygon} path - TBD.
392
- * @returns {Graphics} TBD.
407
+ * Draws a polygon with the specified path.
408
+ * @param {Polygon} path - The polygon to draw.
409
+ * @returns {Graphics} This Graphics object for chaining.
393
410
  */
394
411
  drawPolygon(path) {
395
412
  let points;
@@ -412,8 +429,8 @@ export class Graphics extends DisplayObject {
412
429
  }
413
430
 
414
431
  /**
415
- * TBD.
416
- * @returns {Graphics} TBD.
432
+ * Clears all graphics data.
433
+ * @returns {Graphics} This Graphics object for chaining.
417
434
  */
418
435
  clear() {
419
436
  this.lineWidth = 0;
@@ -427,7 +444,7 @@ export class Graphics extends DisplayObject {
427
444
  }
428
445
 
429
446
  /**
430
- * TBD.
447
+ * Generates a texture from the graphics object (not implemented).
431
448
  */
432
449
  generateTexture() {
433
450
  // TODO
@@ -435,8 +452,8 @@ export class Graphics extends DisplayObject {
435
452
  }
436
453
 
437
454
  /**
438
- * TBD.
439
- * @param {object} renderSession - TBD.
455
+ * Renders the graphics object using WebGL.
456
+ * @param {object} renderSession - The render session to use.
440
457
  */
441
458
  renderWebGL(renderSession) {
442
459
  // if the sprite is not visible or the alpha is 0 then no need to render this element
@@ -495,8 +512,8 @@ export class Graphics extends DisplayObject {
495
512
  }
496
513
 
497
514
  /**
498
- * TBD.
499
- * @param {object} renderSession - TBD.
515
+ * Renders the graphics object using Canvas.
516
+ * @param {object} renderSession - The render session to use.
500
517
  */
501
518
  renderCanvas(renderSession) {
502
519
  // if the sprite is not visible or the alpha is 0 then no need to render this element
@@ -551,9 +568,9 @@ export class Graphics extends DisplayObject {
551
568
  }
552
569
 
553
570
  /**
554
- * TBD.
555
- * @param {import('../geom/matrix.js').Matrix} matrix - TBD.
556
- * @returns {Rectangle} TBD.
571
+ * Gets the bounds of the graphics object.
572
+ * @param {import('../geom/matrix.js').Matrix} matrix - The transformation matrix to use.
573
+ * @returns {Rectangle} The bounds rectangle of the graphics object.
557
574
  */
558
575
  getBounds(matrix = null) {
559
576
  if (!this.renderable) {
@@ -612,8 +629,8 @@ export class Graphics extends DisplayObject {
612
629
  }
613
630
 
614
631
  /**
615
- * TBD.
616
- * @returns {Rectangle} TBD.
632
+ * Gets the local bounds of the graphics object.
633
+ * @returns {Rectangle} The local bounds rectangle of the graphics object.
617
634
  */
618
635
  getLocalBounds() {
619
636
  const matrixCache = this.worldTransform;
@@ -630,10 +647,10 @@ export class Graphics extends DisplayObject {
630
647
  }
631
648
 
632
649
  /**
633
- * TBD.
634
- * @param {Point} point - TBD.
635
- * @param {Point} tempPoint - TBD.
636
- * @returns {boolean} TBD.
650
+ * Checks if the graphics object contains a point.
651
+ * @param {Point} point - The point to check.
652
+ * @param {Point} tempPoint - A temporary point object to use.
653
+ * @returns {boolean} True if the graphics object contains the point, otherwise false.
637
654
  */
638
655
  containsPoint(point, tempPoint) {
639
656
  this.worldTransform.applyInverse(point, tempPoint);
@@ -650,7 +667,7 @@ export class Graphics extends DisplayObject {
650
667
  }
651
668
 
652
669
  /**
653
- * TBD.
670
+ * Updates the local bounds of the graphics object.
654
671
  */
655
672
  updateLocalBounds() {
656
673
  let minX = Infinity;
@@ -731,7 +748,7 @@ export class Graphics extends DisplayObject {
731
748
  }
732
749
 
733
750
  /**
734
- * TBD.
751
+ * Generates a cached sprite representation of the graphics object.
735
752
  */
736
753
  generateCachedSprite() {
737
754
  const bounds = this.getLocalBounds();
@@ -757,7 +774,7 @@ export class Graphics extends DisplayObject {
757
774
  }
758
775
 
759
776
  /**
760
- * TBD.
777
+ * Updates the cached sprite texture.
761
778
  */
762
779
  updateCachedSpriteTexture() {
763
780
  const cachedSprite = this._cachedSprite;
@@ -776,7 +793,7 @@ export class Graphics extends DisplayObject {
776
793
  }
777
794
 
778
795
  /**
779
- * TBD.
796
+ * Destroys the cached sprite.
780
797
  */
781
798
  destroyCachedSprite() {
782
799
  if (!this._cachedSprite) {
@@ -787,9 +804,9 @@ export class Graphics extends DisplayObject {
787
804
  }
788
805
 
789
806
  /**
790
- * TBD.
791
- * @param {object} shape - TBD.
792
- * @returns {GraphicsData} TBD.
807
+ * Draws a shape with the specified properties.
808
+ * @param {object} shape - The shape to draw.
809
+ * @returns {GraphicsData} The graphics data for the drawn shape.
793
810
  */
794
811
  drawShape(shape) {
795
812
  if (this.currentPath) {
@@ -824,7 +841,7 @@ export class Graphics extends DisplayObject {
824
841
  }
825
842
 
826
843
  /**
827
- * TBD.
844
+ * Performs post-update operations for the graphics object.
828
845
  */
829
846
  postUpdate() {
830
847
  if (this._boundsDirty) {
@@ -837,9 +854,9 @@ export class Graphics extends DisplayObject {
837
854
  }
838
855
 
839
856
  /**
840
- * TBD.
841
- * @param {Point[]} points - TBD.
842
- * @param {boolean} cull - TBD.
857
+ * Draws a triangle with the specified points and culling options.
858
+ * @param {Point[]} points - The points of the triangle.
859
+ * @param {boolean} cull - Whether to perform backface culling.
843
860
  */
844
861
  drawTriangle(points, cull = false) {
845
862
  const triangle = new Polygon(points);
@@ -857,10 +874,10 @@ export class Graphics extends DisplayObject {
857
874
  }
858
875
 
859
876
  /**
860
- * TBD.
861
- * @param {number[]|Point[]} vertices - TBD.
862
- * @param {number[]} indices - TBD.
863
- * @param {boolean} cull - TBD.
877
+ * Draws triangles with the specified vertices and indices.
878
+ * @param {number[]|Point[]} vertices - The vertices of the triangles.
879
+ * @param {number[]} indices - The indices of the vertices to use.
880
+ * @param {boolean} cull - Whether to perform backface culling.
864
881
  */
865
882
  drawTriangles(vertices, indices, cull = false) {
866
883
  const point1 = new Point();
@@ -2,14 +2,14 @@ import { clone } from './graphics_data_util.js';
2
2
 
3
3
  export class GraphicsData {
4
4
  /**
5
- * TBD.
6
- * @param {number} lineWidth - TBD.
7
- * @param {number} lineColor - TBD.
8
- * @param {number} lineAlpha - TBD.
9
- * @param {number} fillColor - TBD.
10
- * @param {number} fillAlpha - TBD.
11
- * @param {boolean} fill - TBD.
12
- * @param {object} shape - TBD.
5
+ * Creates a new GraphicsData object.
6
+ * @param {number} lineWidth - The line width.
7
+ * @param {number} lineColor - The line color.
8
+ * @param {number} lineAlpha - The line alpha.
9
+ * @param {number} fillColor - The fill color.
10
+ * @param {number} fillAlpha - The fill alpha.
11
+ * @param {boolean} fill - Whether to fill the shape.
12
+ * @param {object} shape - The shape to draw.
13
13
  */
14
14
  constructor(lineWidth, lineColor, lineAlpha, fillColor, fillAlpha, fill, shape) {
15
15
  this.lineWidth = lineWidth;
@@ -25,8 +25,8 @@ export class GraphicsData {
25
25
  }
26
26
 
27
27
  /**
28
- * TBD.
29
- * @returns {GraphicsData} TBD.
28
+ * Clones this GraphicsData object.
29
+ * @returns {GraphicsData} A new cloned GraphicsData object.
30
30
  */
31
31
  clone() {
32
32
  return clone(this);
@@ -1,9 +1,9 @@
1
1
  import { GraphicsData } from './graphics_data.js';
2
2
 
3
3
  /**
4
- * TBD.
5
- * @param {GraphicsData} source - TBD.
6
- * @returns {GraphicsData} TBD.
4
+ * Clones a GraphicsData object.
5
+ * @param {GraphicsData} source - The source GraphicsData to clone.
6
+ * @returns {GraphicsData} A new cloned GraphicsData object.
7
7
  */
8
8
  export const clone = (source) => {
9
9
  return new GraphicsData(