@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
@@ -6,10 +6,10 @@ import { GEOM_CIRCLE } from '../core/const.js';
6
6
 
7
7
  export class Circle {
8
8
  /**
9
- * TBD.
10
- * @param {number} x - TBD.
11
- * @param {number} y - TBD.
12
- * @param {number} diameter - TBD.
9
+ * Creates a new Circle instance.
10
+ * @param {number} x - The x coordinate of the center point (default: 0).
11
+ * @param {number} y - The y coordinate of the center point (default: 0).
12
+ * @param {number} diameter - The diameter of the circle (default: 0).
13
13
  */
14
14
  constructor(x = 0, y = 0, diameter = 0) {
15
15
  /** @type {number} */
@@ -28,17 +28,17 @@ export class Circle {
28
28
  }
29
29
 
30
30
  /**
31
- * TBD.
32
- * @returns {number} TBD.
31
+ * Calculates the circumference of this circle.
32
+ * @returns {number} The circumference of this circle.
33
33
  */
34
34
  circumference() {
35
35
  return 2 * (Math.PI * this._radius);
36
36
  }
37
37
 
38
38
  /**
39
- * TBD.
40
- * @param {Point} output - TBD.
41
- * @returns {Point} TBD.
39
+ * Returns a random point within this circle.
40
+ * @param {Point} output - The point to store the result in (optional).
41
+ * @returns {Point} A random point within this circle.
42
42
  */
43
43
  random(output = null) {
44
44
  const result = output || new Point();
@@ -53,19 +53,19 @@ export class Circle {
53
53
  }
54
54
 
55
55
  /**
56
- * TBD.
57
- * @returns {Rectangle} TBD.
56
+ * Gets the bounding rectangle of this circle.
57
+ * @returns {Rectangle} The bounding rectangle of this circle.
58
58
  */
59
59
  getBounds() {
60
60
  return new Rectangle(this.x - this.radius, this.y - this.radius, this.diameter, this.diameter);
61
61
  }
62
62
 
63
63
  /**
64
- * TBD.
65
- * @param {number} x - TBD.
66
- * @param {number} y - TBD.
67
- * @param {number} diameter - TBD.
68
- * @returns {Circle} TBD.
64
+ * Sets the position and size of this circle to new values.
65
+ * @param {number} x - The new x coordinate of the center point.
66
+ * @param {number} y - The new y coordinate of the center point.
67
+ * @param {number} diameter - The new diameter of the circle.
68
+ * @returns {Circle} This circle instance for chaining.
69
69
  */
70
70
  setTo(x, y, diameter) {
71
71
  this.x = x;
@@ -76,18 +76,18 @@ export class Circle {
76
76
  }
77
77
 
78
78
  /**
79
- * TBD.
80
- * @param {Circle} source - TBD.
81
- * @returns {Circle} TBD.
79
+ * Copies the values from another circle to this circle.
80
+ * @param {Circle} source - The circle to copy values from.
81
+ * @returns {Circle} This circle instance for chaining.
82
82
  */
83
83
  copyFrom(source) {
84
84
  return this.setTo(source.x, source.y, source.diameter);
85
85
  }
86
86
 
87
87
  /**
88
- * TBD.
89
- * @param {Circle} dest - TBD.
90
- * @returns {Circle} TBD.
88
+ * Copies the values of this circle to another circle.
89
+ * @param {Circle} dest - The circle to copy values to.
90
+ * @returns {Circle} The destination circle.
91
91
  */
92
92
  copyTo(dest) {
93
93
  dest.x = this.x;
@@ -97,10 +97,10 @@ export class Circle {
97
97
  }
98
98
 
99
99
  /**
100
- * TBD.
101
- * @param {Circle} dest - TBD.
102
- * @param {boolean} round - TBD.
103
- * @returns {number} TBD.
100
+ * Calculates the distance between this circle and another circle.
101
+ * @param {Circle} dest - The other circle to calculate the distance to.
102
+ * @param {boolean} round - Whether to round the result (default: false).
103
+ * @returns {number} The distance between the circles.
104
104
  */
105
105
  distance(dest, round = false) {
106
106
  const d = distance(this.x, this.y, dest.x, dest.y);
@@ -108,39 +108,39 @@ export class Circle {
108
108
  }
109
109
 
110
110
  /**
111
- * TBD.
112
- * @returns {Circle} TBD.
111
+ * Creates a clone of this circle.
112
+ * @returns {Circle} A new circle with the same values as this one.
113
113
  */
114
114
  clone() {
115
115
  return clone(this);
116
116
  }
117
117
 
118
118
  /**
119
- * TBD.
120
- * @param {number} x - TBD.
121
- * @param {number} y - TBD.
122
- * @returns {boolean} TBD.
119
+ * Checks if the specified point is contained within this circle.
120
+ * @param {number} x - The x coordinate of the point to check.
121
+ * @param {number} y - The y coordinate of the point to check.
122
+ * @returns {boolean} True if the point is contained within this circle, false otherwise.
123
123
  */
124
124
  contains(x, y) {
125
125
  return contains(this, x, y);
126
126
  }
127
127
 
128
128
  /**
129
- * TBD.
130
- * @param {number} angle - TBD.
131
- * @param {boolean} asDegrees - TBD.
132
- * @param {Point} out - TBD.
133
- * @returns {Point} TBD.
129
+ * Gets a point at a specific angle on the circumference of this circle.
130
+ * @param {number} angle - The angle in radians (or degrees if asDegrees is true) to get the point for.
131
+ * @param {boolean} asDegrees - Whether the angle is provided in degrees (default: false).
132
+ * @param {Point} out - The point to store the result in (optional).
133
+ * @returns {Point} A point at the specified angle on the circumference of this circle.
134
134
  */
135
135
  circumferencePoint(angle, asDegrees, out) {
136
136
  return circumferencePoint(this, angle, asDegrees, out);
137
137
  }
138
138
 
139
139
  /**
140
- * TBD.
141
- * @param {number} dx - TBD.
142
- * @param {number} dy - TBD.
143
- * @returns {Circle} TBD.
140
+ * Offsets the position of this circle by the specified amounts.
141
+ * @param {number} dx - The amount to offset the x coordinate by.
142
+ * @param {number} dy - The amount to offset the y coordinate by.
143
+ * @returns {Circle} This circle instance for chaining.
144
144
  */
145
145
  offset(dx, dy) {
146
146
  this.x += dx;
@@ -149,32 +149,32 @@ export class Circle {
149
149
  }
150
150
 
151
151
  /**
152
- * TBD.
153
- * @param {Point} point - TBD.
154
- * @returns {Circle} TBD.
152
+ * Offsets the position of this circle by the specified point coordinates.
153
+ * @param {Point} point - The point to offset the circle by.
154
+ * @returns {Circle} This circle instance for chaining.
155
155
  */
156
156
  offsetPoint(point) {
157
157
  return this.offset(point.x, point.y);
158
158
  }
159
159
 
160
160
  /**
161
- * TBD.
162
- * @returns {string} TBD.
161
+ * Returns a string representation of this circle.
162
+ * @returns {string} A string representation of the circle.
163
163
  */
164
164
  toString() {
165
165
  return `[{Circle (x=${this.x} y=${this.y} diameter=${this.diameter} radius=${this.radius})}]`;
166
166
  }
167
167
 
168
168
  /**
169
- * TBD.
170
- * @returns {number} TBD.
169
+ * Gets the diameter of this circle.
170
+ * @returns {number} The diameter of this circle.
171
171
  */
172
172
  get diameter() {
173
173
  return this._diameter;
174
174
  }
175
175
 
176
176
  /**
177
- * TBD.
177
+ * Sets the diameter of this circle.
178
178
  */
179
179
  set diameter(value) {
180
180
  if (value > 0) {
@@ -184,15 +184,15 @@ export class Circle {
184
184
  }
185
185
 
186
186
  /**
187
- * TBD.
188
- * @returns {number} TBD.
187
+ * Gets the radius of this circle.
188
+ * @returns {number} The radius of this circle.
189
189
  */
190
190
  get radius() {
191
191
  return this._radius;
192
192
  }
193
193
 
194
194
  /**
195
- * TBD.
195
+ * Sets the radius of this circle.
196
196
  */
197
197
  set radius(value) {
198
198
  if (value > 0) {
@@ -202,15 +202,15 @@ export class Circle {
202
202
  }
203
203
 
204
204
  /**
205
- * TBD.
206
- * @returns {number} TBD.
205
+ * Gets the left coordinate of this circle.
206
+ * @returns {number} The left coordinate of this circle.
207
207
  */
208
208
  get left() {
209
209
  return this.x - this._radius;
210
210
  }
211
211
 
212
212
  /**
213
- * TBD.
213
+ * Sets the left coordinate of this circle.
214
214
  */
215
215
  set left(value) {
216
216
  if (value > this.x) {
@@ -222,15 +222,15 @@ export class Circle {
222
222
  }
223
223
 
224
224
  /**
225
- * TBD.
226
- * @returns {number} TBD.
225
+ * Gets the right coordinate of this circle.
226
+ * @returns {number} The right coordinate of this circle.
227
227
  */
228
228
  get right() {
229
229
  return this.x + this._radius;
230
230
  }
231
231
 
232
232
  /**
233
- * TBD.
233
+ * Sets the right coordinate of this circle.
234
234
  */
235
235
  set right(value) {
236
236
  if (value < this.x) {
@@ -242,15 +242,15 @@ export class Circle {
242
242
  }
243
243
 
244
244
  /**
245
- * TBD.
246
- * @returns {number} TBD.
245
+ * Gets the top coordinate of this circle.
246
+ * @returns {number} The top coordinate of this circle.
247
247
  */
248
248
  get top() {
249
249
  return this.y - this._radius;
250
250
  }
251
251
 
252
252
  /**
253
- * TBD.
253
+ * Sets the top coordinate of this circle.
254
254
  */
255
255
  set top(value) {
256
256
  if (value > this.y) {
@@ -262,15 +262,15 @@ export class Circle {
262
262
  }
263
263
 
264
264
  /**
265
- * TBD.
266
- * @returns {number} TBD.
265
+ * Gets the bottom coordinate of this circle.
266
+ * @returns {number} The bottom coordinate of this circle.
267
267
  */
268
268
  get bottom() {
269
269
  return this.y + this._radius;
270
270
  }
271
271
 
272
272
  /**
273
- * TBD.
273
+ * Sets the bottom coordinate of this circle.
274
274
  */
275
275
  set bottom(value) {
276
276
  if (value < this.y) {
@@ -282,8 +282,8 @@ export class Circle {
282
282
  }
283
283
 
284
284
  /**
285
- * TBD.
286
- * @returns {number} TBD.
285
+ * Gets the area of this circle.
286
+ * @returns {number} The area of this circle.
287
287
  */
288
288
  get area() {
289
289
  if (this._radius > 0) {
@@ -293,15 +293,15 @@ export class Circle {
293
293
  }
294
294
 
295
295
  /**
296
- * TBD.
297
- * @returns {boolean} TBD.
296
+ * Checks if this circle is empty (has zero diameter).
297
+ * @returns {boolean} True if the circle is empty, false otherwise.
298
298
  */
299
299
  get empty() {
300
300
  return this._diameter === 0;
301
301
  }
302
302
 
303
303
  /**
304
- * TBD.
304
+ * Sets whether this circle is empty (zero diameter).
305
305
  */
306
306
  set empty(value) {
307
307
  if (value === true) {
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Circle } from './circle.js';
2
3
  import { Point } from './point.js';
3
4
 
@@ -5,11 +5,11 @@ import { contains } from './util/ellipse.js';
5
5
 
6
6
  export class Ellipse {
7
7
  /**
8
- * TBD.
9
- * @param {number} x - TBD.
10
- * @param {number} y - TBD.
11
- * @param {number} width - TBD.
12
- * @param {number} height - TBD.
8
+ * Creates a new Ellipse instance.
9
+ * @param {number} x - The x coordinate of the center point (default: 0).
10
+ * @param {number} y - The y coordinate of the center point (default: 0).
11
+ * @param {number} width - The width of the ellipse (default: 0).
12
+ * @param {number} height - The height of the ellipse (default: 0).
13
13
  */
14
14
  constructor(x = 0, y = 0, width = 0, height = 0) {
15
15
  /** @type {number} */
@@ -25,12 +25,12 @@ export class Ellipse {
25
25
  }
26
26
 
27
27
  /**
28
- * TBD.
29
- * @param {number} x - TBD.
30
- * @param {number} y - TBD.
31
- * @param {number} width - TBD.
32
- * @param {number} height - TBD.
33
- * @returns {Ellipse} TBD.
28
+ * Sets the position and size of this ellipse to new values.
29
+ * @param {number} x - The new x coordinate of the center point.
30
+ * @param {number} y - The new y coordinate of the center point.
31
+ * @param {number} width - The new width of the ellipse.
32
+ * @param {number} height - The new height of the ellipse.
33
+ * @returns {Ellipse} This ellipse instance for chaining.
34
34
  */
35
35
  setTo(x, y, width, height) {
36
36
  this.x = x;
@@ -41,26 +41,26 @@ export class Ellipse {
41
41
  }
42
42
 
43
43
  /**
44
- * TBD.
45
- * @returns {Rectangle} TBD.
44
+ * Gets the bounding rectangle of this ellipse.
45
+ * @returns {Rectangle} The bounding rectangle of this ellipse.
46
46
  */
47
47
  getBounds() {
48
48
  return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);
49
49
  }
50
50
 
51
51
  /**
52
- * TBD.
53
- * @param {Ellipse} source - TBD.
54
- * @returns {Ellipse} TBD.
52
+ * Copies the values from another ellipse to this ellipse.
53
+ * @param {Ellipse} source - The ellipse to copy values from.
54
+ * @returns {Ellipse} This ellipse instance for chaining.
55
55
  */
56
56
  copyFrom(source) {
57
57
  return this.setTo(source.x, source.y, source.width, source.height);
58
58
  }
59
59
 
60
60
  /**
61
- * TBD.
62
- * @param {Ellipse} dest - TBD.
63
- * @returns {Ellipse} TBD.
61
+ * Copies the values of this ellipse to another ellipse.
62
+ * @param {Ellipse} dest - The ellipse to copy values to.
63
+ * @returns {Ellipse} The destination ellipse.
64
64
  */
65
65
  copyTo(dest) {
66
66
  dest.x = this.x;
@@ -71,19 +71,19 @@ export class Ellipse {
71
71
  }
72
72
 
73
73
  /**
74
- * TBD.
75
- * @param {number} x - TBD.
76
- * @param {number} y - TBD.
77
- * @returns {boolean} TBD.
74
+ * Checks if the specified point is contained within this ellipse.
75
+ * @param {number} x - The x coordinate of the point to check.
76
+ * @param {number} y - The y coordinate of the point to check.
77
+ * @returns {boolean} True if the point is contained within this ellipse, false otherwise.
78
78
  */
79
79
  contains(x, y) {
80
80
  return contains(this, x, y);
81
81
  }
82
82
 
83
83
  /**
84
- * TBD.
85
- * @param {Point} output - TBD.
86
- * @returns {Point} TBD.
84
+ * Returns a random point within this ellipse.
85
+ * @param {Point} output - The point to store the result in (optional).
86
+ * @returns {Point} A random point within this ellipse.
87
87
  */
88
88
  random(output = null) {
89
89
  const result = output || new Point();
@@ -97,8 +97,8 @@ export class Ellipse {
97
97
  }
98
98
 
99
99
  /**
100
- * TBD.
101
- * @returns {string} TBD.
100
+ * Returns a string representation of this ellipse.
101
+ * @returns {string} A string representation of the ellipse.
102
102
  */
103
103
  toString() {
104
104
  return `[{Ellipse (x=${this.x} y=${this.y} width=${this.width} height=${this.height})}]`;
@@ -1,3 +1,4 @@
1
+ import { expect } from 'vitest';
1
2
  import { Ellipse } from './ellipse.js';
2
3
 
3
4
  it('should create an ellipse with default values', () => {