@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
@@ -6,34 +6,39 @@ 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
+ /** @type {number} */
15
16
  this.x = x;
17
+ /** @type {number} */
16
18
  this.y = y;
19
+ /** @type {number} */
17
20
  this._diameter = diameter;
21
+ /** @type {number} */
18
22
  this._radius = 0;
19
23
  if (diameter > 0) {
20
24
  this._radius = diameter * 0.5;
21
25
  }
26
+ /** @type {number} */
22
27
  this.type = GEOM_CIRCLE;
23
28
  }
24
29
 
25
30
  /**
26
- * TBD.
27
- * @returns {number} TBD.
31
+ * Calculates the circumference of this circle.
32
+ * @returns {number} The circumference of this circle.
28
33
  */
29
34
  circumference() {
30
35
  return 2 * (Math.PI * this._radius);
31
36
  }
32
37
 
33
38
  /**
34
- * TBD.
35
- * @param {Point} output - TBD.
36
- * @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.
37
42
  */
38
43
  random(output = null) {
39
44
  const result = output || new Point();
@@ -48,19 +53,19 @@ export class Circle {
48
53
  }
49
54
 
50
55
  /**
51
- * TBD.
52
- * @returns {Rectangle} TBD.
56
+ * Gets the bounding rectangle of this circle.
57
+ * @returns {Rectangle} The bounding rectangle of this circle.
53
58
  */
54
59
  getBounds() {
55
60
  return new Rectangle(this.x - this.radius, this.y - this.radius, this.diameter, this.diameter);
56
61
  }
57
62
 
58
63
  /**
59
- * TBD.
60
- * @param {number} x - TBD.
61
- * @param {number} y - TBD.
62
- * @param {number} diameter - TBD.
63
- * @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.
64
69
  */
65
70
  setTo(x, y, diameter) {
66
71
  this.x = x;
@@ -71,18 +76,18 @@ export class Circle {
71
76
  }
72
77
 
73
78
  /**
74
- * TBD.
75
- * @param {Circle} source - TBD.
76
- * @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.
77
82
  */
78
83
  copyFrom(source) {
79
84
  return this.setTo(source.x, source.y, source.diameter);
80
85
  }
81
86
 
82
87
  /**
83
- * TBD.
84
- * @param {Circle} dest - TBD.
85
- * @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.
86
91
  */
87
92
  copyTo(dest) {
88
93
  dest.x = this.x;
@@ -92,10 +97,10 @@ export class Circle {
92
97
  }
93
98
 
94
99
  /**
95
- * TBD.
96
- * @param {Circle} dest - TBD.
97
- * @param {boolean} round - TBD.
98
- * @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.
99
104
  */
100
105
  distance(dest, round = false) {
101
106
  const d = distance(this.x, this.y, dest.x, dest.y);
@@ -103,39 +108,39 @@ export class Circle {
103
108
  }
104
109
 
105
110
  /**
106
- * TBD.
107
- * @returns {Circle} TBD.
111
+ * Creates a clone of this circle.
112
+ * @returns {Circle} A new circle with the same values as this one.
108
113
  */
109
114
  clone() {
110
115
  return clone(this);
111
116
  }
112
117
 
113
118
  /**
114
- * TBD.
115
- * @param {number} x - TBD.
116
- * @param {number} y - TBD.
117
- * @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.
118
123
  */
119
124
  contains(x, y) {
120
125
  return contains(this, x, y);
121
126
  }
122
127
 
123
128
  /**
124
- * TBD.
125
- * @param {number} angle - TBD.
126
- * @param {boolean} asDegrees - TBD.
127
- * @param {Point} out - TBD.
128
- * @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.
129
134
  */
130
135
  circumferencePoint(angle, asDegrees, out) {
131
136
  return circumferencePoint(this, angle, asDegrees, out);
132
137
  }
133
138
 
134
139
  /**
135
- * TBD.
136
- * @param {number} dx - TBD.
137
- * @param {number} dy - TBD.
138
- * @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.
139
144
  */
140
145
  offset(dx, dy) {
141
146
  this.x += dx;
@@ -144,32 +149,32 @@ export class Circle {
144
149
  }
145
150
 
146
151
  /**
147
- * TBD.
148
- * @param {Point} point - TBD.
149
- * @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.
150
155
  */
151
156
  offsetPoint(point) {
152
157
  return this.offset(point.x, point.y);
153
158
  }
154
159
 
155
160
  /**
156
- * TBD.
157
- * @returns {string} TBD.
161
+ * Returns a string representation of this circle.
162
+ * @returns {string} A string representation of the circle.
158
163
  */
159
164
  toString() {
160
165
  return `[{Circle (x=${this.x} y=${this.y} diameter=${this.diameter} radius=${this.radius})}]`;
161
166
  }
162
167
 
163
168
  /**
164
- * TBD.
165
- * @returns {number} TBD.
169
+ * Gets the diameter of this circle.
170
+ * @returns {number} The diameter of this circle.
166
171
  */
167
172
  get diameter() {
168
173
  return this._diameter;
169
174
  }
170
175
 
171
176
  /**
172
- * TBD.
177
+ * Sets the diameter of this circle.
173
178
  */
174
179
  set diameter(value) {
175
180
  if (value > 0) {
@@ -179,15 +184,15 @@ export class Circle {
179
184
  }
180
185
 
181
186
  /**
182
- * TBD.
183
- * @returns {number} TBD.
187
+ * Gets the radius of this circle.
188
+ * @returns {number} The radius of this circle.
184
189
  */
185
190
  get radius() {
186
191
  return this._radius;
187
192
  }
188
193
 
189
194
  /**
190
- * TBD.
195
+ * Sets the radius of this circle.
191
196
  */
192
197
  set radius(value) {
193
198
  if (value > 0) {
@@ -197,15 +202,15 @@ export class Circle {
197
202
  }
198
203
 
199
204
  /**
200
- * TBD.
201
- * @returns {number} TBD.
205
+ * Gets the left coordinate of this circle.
206
+ * @returns {number} The left coordinate of this circle.
202
207
  */
203
208
  get left() {
204
209
  return this.x - this._radius;
205
210
  }
206
211
 
207
212
  /**
208
- * TBD.
213
+ * Sets the left coordinate of this circle.
209
214
  */
210
215
  set left(value) {
211
216
  if (value > this.x) {
@@ -217,15 +222,15 @@ export class Circle {
217
222
  }
218
223
 
219
224
  /**
220
- * TBD.
221
- * @returns {number} TBD.
225
+ * Gets the right coordinate of this circle.
226
+ * @returns {number} The right coordinate of this circle.
222
227
  */
223
228
  get right() {
224
229
  return this.x + this._radius;
225
230
  }
226
231
 
227
232
  /**
228
- * TBD.
233
+ * Sets the right coordinate of this circle.
229
234
  */
230
235
  set right(value) {
231
236
  if (value < this.x) {
@@ -237,15 +242,15 @@ export class Circle {
237
242
  }
238
243
 
239
244
  /**
240
- * TBD.
241
- * @returns {number} TBD.
245
+ * Gets the top coordinate of this circle.
246
+ * @returns {number} The top coordinate of this circle.
242
247
  */
243
248
  get top() {
244
249
  return this.y - this._radius;
245
250
  }
246
251
 
247
252
  /**
248
- * TBD.
253
+ * Sets the top coordinate of this circle.
249
254
  */
250
255
  set top(value) {
251
256
  if (value > this.y) {
@@ -257,15 +262,15 @@ export class Circle {
257
262
  }
258
263
 
259
264
  /**
260
- * TBD.
261
- * @returns {number} TBD.
265
+ * Gets the bottom coordinate of this circle.
266
+ * @returns {number} The bottom coordinate of this circle.
262
267
  */
263
268
  get bottom() {
264
269
  return this.y + this._radius;
265
270
  }
266
271
 
267
272
  /**
268
- * TBD.
273
+ * Sets the bottom coordinate of this circle.
269
274
  */
270
275
  set bottom(value) {
271
276
  if (value < this.y) {
@@ -277,8 +282,8 @@ export class Circle {
277
282
  }
278
283
 
279
284
  /**
280
- * TBD.
281
- * @returns {number} TBD.
285
+ * Gets the area of this circle.
286
+ * @returns {number} The area of this circle.
282
287
  */
283
288
  get area() {
284
289
  if (this._radius > 0) {
@@ -288,15 +293,15 @@ export class Circle {
288
293
  }
289
294
 
290
295
  /**
291
- * TBD.
292
- * @returns {boolean} TBD.
296
+ * Checks if this circle is empty (has zero diameter).
297
+ * @returns {boolean} True if the circle is empty, false otherwise.
293
298
  */
294
299
  get empty() {
295
300
  return this._diameter === 0;
296
301
  }
297
302
 
298
303
  /**
299
- * TBD.
304
+ * Sets whether this circle is empty (zero diameter).
300
305
  */
301
306
  set empty(value) {
302
307
  if (value === true) {
@@ -5,27 +5,32 @@ 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
+ /** @type {number} */
15
16
  this.x = x;
17
+ /** @type {number} */
16
18
  this.y = y;
19
+ /** @type {number} */
17
20
  this.width = width;
21
+ /** @type {number} */
18
22
  this.height = height;
23
+ /** @type {number} */
19
24
  this.type = GEOM_ELLIPSE;
20
25
  }
21
26
 
22
27
  /**
23
- * TBD.
24
- * @param {number} x - TBD.
25
- * @param {number} y - TBD.
26
- * @param {number} width - TBD.
27
- * @param {number} height - TBD.
28
- * @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.
29
34
  */
30
35
  setTo(x, y, width, height) {
31
36
  this.x = x;
@@ -36,26 +41,26 @@ export class Ellipse {
36
41
  }
37
42
 
38
43
  /**
39
- * TBD.
40
- * @returns {Rectangle} TBD.
44
+ * Gets the bounding rectangle of this ellipse.
45
+ * @returns {Rectangle} The bounding rectangle of this ellipse.
41
46
  */
42
47
  getBounds() {
43
48
  return new Rectangle(this.x - this.width, this.y - this.height, this.width, this.height);
44
49
  }
45
50
 
46
51
  /**
47
- * TBD.
48
- * @param {Ellipse} source - TBD.
49
- * @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.
50
55
  */
51
56
  copyFrom(source) {
52
57
  return this.setTo(source.x, source.y, source.width, source.height);
53
58
  }
54
59
 
55
60
  /**
56
- * TBD.
57
- * @param {Ellipse} dest - TBD.
58
- * @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.
59
64
  */
60
65
  copyTo(dest) {
61
66
  dest.x = this.x;
@@ -66,19 +71,19 @@ export class Ellipse {
66
71
  }
67
72
 
68
73
  /**
69
- * TBD.
70
- * @param {number} x - TBD.
71
- * @param {number} y - TBD.
72
- * @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.
73
78
  */
74
79
  contains(x, y) {
75
80
  return contains(this, x, y);
76
81
  }
77
82
 
78
83
  /**
79
- * TBD.
80
- * @param {Point} output - TBD.
81
- * @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.
82
87
  */
83
88
  random(output = null) {
84
89
  const result = output || new Point();
@@ -92,8 +97,8 @@ export class Ellipse {
92
97
  }
93
98
 
94
99
  /**
95
- * TBD.
96
- * @returns {string} TBD.
100
+ * Returns a string representation of this ellipse.
101
+ * @returns {string} A string representation of the ellipse.
97
102
  */
98
103
  toString() {
99
104
  return `[{Ellipse (x=${this.x} y=${this.y} width=${this.width} height=${this.height})}]`;