@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
@@ -26,11 +26,11 @@ import {
26
26
 
27
27
  export class Rectangle {
28
28
  /**
29
- * TBD.
30
- * @param {number} x - TBD.
31
- * @param {number} y - TBD.
32
- * @param {number} width - TBD.
33
- * @param {number} height - TBD.
29
+ * Creates a new Rectangle instance.
30
+ * @param {number} x - The x coordinate of the top-left corner of the rectangle (default: 0).
31
+ * @param {number} y - The y coordinate of the top-left corner of the rectangle (default: 0).
32
+ * @param {number} width - The width of the rectangle (default: 0).
33
+ * @param {number} height - The height of the rectangle (default: 0).
34
34
  */
35
35
  constructor(x = 0, y = 0, width = 0, height = 0) {
36
36
  /** @type {number} */
@@ -46,10 +46,10 @@ export class Rectangle {
46
46
  }
47
47
 
48
48
  /**
49
- * TBD.
50
- * @param {number} dx - TBD.
51
- * @param {number} dy - TBD.
52
- * @returns {Rectangle} TBD.
49
+ * Offsets the rectangle's position by the specified amounts.
50
+ * @param {number} dx - The amount to offset the x coordinate by.
51
+ * @param {number} dy - The amount to offset the y coordinate by.
52
+ * @returns {Rectangle} This rectangle instance for chaining.
53
53
  */
54
54
  offset(dx, dy) {
55
55
  this.x += dx;
@@ -58,21 +58,21 @@ export class Rectangle {
58
58
  }
59
59
 
60
60
  /**
61
- * TBD.
62
- * @param {Point} point - TBD.
63
- * @returns {Rectangle} TBD.
61
+ * Offsets the rectangle's position by the specified point coordinates.
62
+ * @param {Point} point - The point to offset the rectangle by.
63
+ * @returns {Rectangle} This rectangle instance for chaining.
64
64
  */
65
65
  offsetPoint(point) {
66
66
  return this.offset(point.x, point.y);
67
67
  }
68
68
 
69
69
  /**
70
- * TBD.
71
- * @param {number} x - TBD.
72
- * @param {number} y - TBD.
73
- * @param {number} width - TBD.
74
- * @param {number} height - TBD.
75
- * @returns {Rectangle} TBD.
70
+ * Sets the rectangle's position and size to new values.
71
+ * @param {number} x - The new x coordinate of the top-left corner of the rectangle.
72
+ * @param {number} y - The new y coordinate of the top-left corner of the rectangle.
73
+ * @param {number} width - The new width of the rectangle.
74
+ * @param {number} height - The new height of the rectangle.
75
+ * @returns {Rectangle} This rectangle instance for chaining.
76
76
  */
77
77
  setTo(x, y, width, height) {
78
78
  this.x = x;
@@ -83,10 +83,10 @@ export class Rectangle {
83
83
  }
84
84
 
85
85
  /**
86
- * TBD.
87
- * @param {number} x - TBD.
88
- * @param {number} y - TBD.
89
- * @returns {Rectangle} TBD.
86
+ * Scales the rectangle's size by the specified amounts.
87
+ * @param {number} x - The amount to scale the width by.
88
+ * @param {number} y - The amount to scale the height by (default: x).
89
+ * @returns {Rectangle} This rectangle instance for chaining.
90
90
  */
91
91
  scale(x, y) {
92
92
  if (y === undefined) {
@@ -98,10 +98,10 @@ export class Rectangle {
98
98
  }
99
99
 
100
100
  /**
101
- * TBD.
102
- * @param {number} x - TBD.
103
- * @param {number} y - TBD.
104
- * @returns {Rectangle} TBD.
101
+ * Centers the rectangle on the specified point.
102
+ * @param {number} x - The x coordinate to center the rectangle on.
103
+ * @param {number} y - The y coordinate to center the rectangle on.
104
+ * @returns {Rectangle} This rectangle instance for chaining.
105
105
  */
106
106
  centerOn(x, y) {
107
107
  this.centerX = x;
@@ -110,7 +110,7 @@ export class Rectangle {
110
110
  }
111
111
 
112
112
  /**
113
- * TBD.
113
+ * Floors the x and y coordinates of the rectangle (rounds down to nearest integer).
114
114
  */
115
115
  floor() {
116
116
  this.x = Math.floor(this.x);
@@ -118,7 +118,7 @@ export class Rectangle {
118
118
  }
119
119
 
120
120
  /**
121
- * TBD.
121
+ * Floors all coordinates of the rectangle (rounds down to nearest integer).
122
122
  */
123
123
  floorAll() {
124
124
  this.x = Math.floor(this.x);
@@ -128,7 +128,7 @@ export class Rectangle {
128
128
  }
129
129
 
130
130
  /**
131
- * TBD.
131
+ * Ceils the x and y coordinates of the rectangle (rounds up to nearest integer).
132
132
  */
133
133
  ceil() {
134
134
  this.x = Math.ceil(this.x);
@@ -136,7 +136,7 @@ export class Rectangle {
136
136
  }
137
137
 
138
138
  /**
139
- * TBD.
139
+ * Ceils all coordinates of the rectangle (rounds up to nearest integer).
140
140
  */
141
141
  ceilAll() {
142
142
  this.x = Math.ceil(this.x);
@@ -146,18 +146,18 @@ export class Rectangle {
146
146
  }
147
147
 
148
148
  /**
149
- * TBD.
150
- * @param {Rectangle} source - TBD.
151
- * @returns {Rectangle} TBD.
149
+ * Copies the values from another rectangle to this rectangle.
150
+ * @param {Rectangle} source - The rectangle to copy values from.
151
+ * @returns {Rectangle} This rectangle instance for chaining.
152
152
  */
153
153
  copyFrom(source) {
154
154
  return this.setTo(source.x, source.y, source.width, source.height);
155
155
  }
156
156
 
157
157
  /**
158
- * TBD.
159
- * @param {Rectangle} dest - TBD.
160
- * @returns {Rectangle} TBD.
158
+ * Copies the values of this rectangle to another rectangle.
159
+ * @param {Rectangle} dest - The rectangle to copy values to.
160
+ * @returns {Rectangle} The destination rectangle.
161
161
  */
162
162
  copyTo(dest) {
163
163
  dest.x = this.x;
@@ -168,29 +168,29 @@ export class Rectangle {
168
168
  }
169
169
 
170
170
  /**
171
- * TBD.
172
- * @param {number} dx - TBD.
173
- * @param {number} dy - TBD.
174
- * @returns {Rectangle} TBD.
171
+ * Increases the size of the rectangle by the specified amounts.
172
+ * @param {number} dx - The amount to increase the width by.
173
+ * @param {number} dy - The amount to increase the height by.
174
+ * @returns {Rectangle} This rectangle instance for chaining.
175
175
  */
176
176
  inflate(dx, dy) {
177
177
  return inflate(this, dx, dy);
178
178
  }
179
179
 
180
180
  /**
181
- * TBD.
182
- * @param {Point} output - TBD.
183
- * @returns {Point} TBD.
181
+ * Gets the size of the rectangle as a point.
182
+ * @param {Point} output - The point to store the size in (optional).
183
+ * @returns {Point} The size of the rectangle as a point.
184
184
  */
185
185
  size(output) {
186
186
  return size(this, output);
187
187
  }
188
188
 
189
189
  /**
190
- * TBD.
191
- * @param {number} width - TBD.
192
- * @param {number} height - TBD.
193
- * @returns {Rectangle} TBD.
190
+ * Resizes the rectangle to the specified dimensions.
191
+ * @param {number} width - The new width of the rectangle.
192
+ * @param {number} height - The new height of the rectangle.
193
+ * @returns {Rectangle} This rectangle instance for chaining.
194
194
  */
195
195
  resize(width, height) {
196
196
  this.width = width;
@@ -199,88 +199,88 @@ export class Rectangle {
199
199
  }
200
200
 
201
201
  /**
202
- * TBD.
203
- * @param {Rectangle} output - TBD.
204
- * @returns {Rectangle} TBD.
202
+ * Creates a clone of this rectangle.
203
+ * @param {Rectangle} output - The rectangle to store the clone in (optional).
204
+ * @returns {Rectangle} A new rectangle with the same values as this one.
205
205
  */
206
206
  clone(output) {
207
207
  return clone(this, output);
208
208
  }
209
209
 
210
210
  /**
211
- * TBD.
212
- * @param {number} x - TBD.
213
- * @param {number} y - TBD.
214
- * @returns {boolean} TBD.
211
+ * Checks if the specified point is contained within this rectangle.
212
+ * @param {number} x - The x coordinate of the point to check.
213
+ * @param {number} y - The y coordinate of the point to check.
214
+ * @returns {boolean} True if the point is contained within this rectangle, false otherwise.
215
215
  */
216
216
  contains(x, y) {
217
217
  return contains(this, x, y);
218
218
  }
219
219
 
220
220
  /**
221
- * TBD.
222
- * @param {Rectangle} b - TBD.
223
- * @returns {boolean} TBD.
221
+ * Checks if the specified rectangle is fully contained within this rectangle.
222
+ * @param {Rectangle} b - The rectangle to check if it's contained.
223
+ * @returns {boolean} True if the rectangle is contained within this rectangle, false otherwise.
224
224
  */
225
225
  containsRect(b) {
226
226
  return containsRect(b, this);
227
227
  }
228
228
 
229
229
  /**
230
- * TBD.
231
- * @param {Rectangle} b - TBD.
232
- * @returns {boolean} TBD.
230
+ * Checks if this rectangle is equal to another rectangle.
231
+ * @param {Rectangle} b - The rectangle to compare with.
232
+ * @returns {boolean} True if the rectangles have the same values, false otherwise.
233
233
  */
234
234
  equals(b) {
235
235
  return equals(this, b);
236
236
  }
237
237
 
238
238
  /**
239
- * TBD.
240
- * @param {Rectangle} b - TBD.
241
- * @param {Rectangle} out - TBD.
242
- * @returns {Rectangle} TBD.
239
+ * Gets the intersection of this rectangle and another rectangle.
240
+ * @param {Rectangle} b - The rectangle to intersect with.
241
+ * @param {Rectangle} out - The rectangle to store the result in (optional).
242
+ * @returns {Rectangle} The intersection of the two rectangles.
243
243
  */
244
244
  intersection(b, out) {
245
245
  return intersection(this, b, out);
246
246
  }
247
247
 
248
248
  /**
249
- * TBD.
250
- * @param {Rectangle} b - TBD.
251
- * @returns {boolean} TBD.
249
+ * Checks if this rectangle intersects with another rectangle.
250
+ * @param {Rectangle} b - The rectangle to check for intersection with.
251
+ * @returns {boolean} True if the rectangles intersect, false otherwise.
252
252
  */
253
253
  intersects(b) {
254
254
  return intersects(this, b);
255
255
  }
256
256
 
257
257
  /**
258
- * TBD.
259
- * @param {number} left - TBD.
260
- * @param {number} right - TBD.
261
- * @param {number} top - TBD.
262
- * @param {number} bottom - TBD.
263
- * @param {number} tolerance - TBD.
264
- * @returns {boolean} TBD.
258
+ * Checks if this rectangle intersects with the specified bounds.
259
+ * @param {number} left - The left boundary of the area to check for intersection.
260
+ * @param {number} right - The right boundary of the area to check for intersection.
261
+ * @param {number} top - The top boundary of the area to check for intersection.
262
+ * @param {number} bottom - The bottom boundary of the area to check for intersection.
263
+ * @param {number} tolerance - A tolerance value to use when checking (default: 0).
264
+ * @returns {boolean} True if the rectangle intersects with the bounds, false otherwise.
265
265
  */
266
266
  intersectsRaw(left, right, top, bottom, tolerance) {
267
267
  return intersectsRaw(this, left, right, top, bottom, tolerance);
268
268
  }
269
269
 
270
270
  /**
271
- * TBD.
272
- * @param {Rectangle} b - TBD.
273
- * @param {Rectangle} out - TBD.
274
- * @returns {Rectangle} TBD.
271
+ * Gets the union of this rectangle and another rectangle.
272
+ * @param {Rectangle} b - The rectangle to union with.
273
+ * @param {Rectangle} out - The rectangle to store the result in (optional).
274
+ * @returns {Rectangle} The union of the two rectangles.
275
275
  */
276
276
  union(b, out) {
277
277
  return union(this, b, out);
278
278
  }
279
279
 
280
280
  /**
281
- * TBD.
282
- * @param {Point} output - TBD.
283
- * @returns {Point} TBD.
281
+ * Gets a random point within this rectangle.
282
+ * @param {Point} output - The point to store the result in (optional).
283
+ * @returns {Point} A random point within this rectangle.
284
284
  */
285
285
  random(output = null) {
286
286
  const result = output || new Point();
@@ -290,10 +290,10 @@ export class Rectangle {
290
290
  }
291
291
 
292
292
  /**
293
- * TBD.
294
- * @param {number} position - TBD.
295
- * @param {Point} output - TBD.
296
- * @returns {Point} TBD.
293
+ * Gets a point at a specific position on the rectangle.
294
+ * @param {number} position - The position to get the point for (TOP_LEFT, TOP_CENTER, etc.).
295
+ * @param {Point} output - The point to store the result in (optional).
296
+ * @returns {Point} A point at the specified position on the rectangle.
297
297
  */
298
298
  getPoint(position, output = null) {
299
299
  const result = output || new Point();
@@ -322,39 +322,39 @@ export class Rectangle {
322
322
  }
323
323
 
324
324
  /**
325
- * TBD.
326
- * @returns {string} TBD.
325
+ * Returns a string representation of this rectangle.
326
+ * @returns {string} A string representation of the rectangle.
327
327
  */
328
328
  toString() {
329
329
  return `[{Rectangle (x=${this.x} y=${this.y} width=${this.width} height=${this.height} empty=${this.empty})}]`;
330
330
  }
331
331
 
332
332
  /**
333
- * TBD.
334
- * @returns {number} TBD.
333
+ * Gets half the width of this rectangle.
334
+ * @returns {number} Half the width of this rectangle.
335
335
  */
336
336
  get halfWidth() {
337
337
  return Math.round(this.width / 2);
338
338
  }
339
339
 
340
340
  /**
341
- * TBD.
342
- * @returns {number} TBD.
341
+ * Gets half the height of this rectangle.
342
+ * @returns {number} Half the height of this rectangle.
343
343
  */
344
344
  get halfHeight() {
345
345
  return Math.round(this.height / 2);
346
346
  }
347
347
 
348
348
  /**
349
- * TBD.
350
- * @returns {number} TBD.
349
+ * Gets the top coordinate of this rectangle.
350
+ * @returns {number} The top coordinate of this rectangle.
351
351
  */
352
352
  get top() {
353
353
  return this.y;
354
354
  }
355
355
 
356
356
  /**
357
- * TBD.
357
+ * Sets the top coordinate of this rectangle.
358
358
  */
359
359
  set top(value) {
360
360
  if (value >= this.bottom) {
@@ -366,15 +366,15 @@ export class Rectangle {
366
366
  }
367
367
 
368
368
  /**
369
- * TBD.
370
- * @returns {Point} TBD.
369
+ * Gets the top-left point of this rectangle.
370
+ * @returns {Point} The top-left point of this rectangle.
371
371
  */
372
372
  get topLeft() {
373
373
  return new Point(this.x, this.y);
374
374
  }
375
375
 
376
376
  /**
377
- * TBD.
377
+ * Sets the top-left point of this rectangle.
378
378
  */
379
379
  set topLeft(value) {
380
380
  this.x = value.x;
@@ -382,15 +382,15 @@ export class Rectangle {
382
382
  }
383
383
 
384
384
  /**
385
- * TBD.
386
- * @returns {Point} TBD.
385
+ * Gets the top-right point of this rectangle.
386
+ * @returns {Point} The top-right point of this rectangle.
387
387
  */
388
388
  get topRight() {
389
389
  return new Point(this.x + this.width, this.y);
390
390
  }
391
391
 
392
392
  /**
393
- * TBD.
393
+ * Sets the top-right point of this rectangle.
394
394
  */
395
395
  set topRight(value) {
396
396
  this.right = value.x;
@@ -398,15 +398,15 @@ export class Rectangle {
398
398
  }
399
399
 
400
400
  /**
401
- * TBD.
402
- * @returns {number} TBD.
401
+ * Gets the bottom coordinate of this rectangle.
402
+ * @returns {number} The bottom coordinate of this rectangle.
403
403
  */
404
404
  get bottom() {
405
405
  return this.y + this.height;
406
406
  }
407
407
 
408
408
  /**
409
- * TBD.
409
+ * Sets the bottom coordinate of this rectangle.
410
410
  */
411
411
  set bottom(value) {
412
412
  if (value <= this.y) {
@@ -417,15 +417,15 @@ export class Rectangle {
417
417
  }
418
418
 
419
419
  /**
420
- * TBD.
421
- * @returns {Point} TBD.
420
+ * Gets the bottom-left point of this rectangle.
421
+ * @returns {Point} The bottom-left point of this rectangle.
422
422
  */
423
423
  get bottomLeft() {
424
424
  return new Point(this.x, this.bottom);
425
425
  }
426
426
 
427
427
  /**
428
- * TBD.
428
+ * Sets the bottom-left point of this rectangle.
429
429
  */
430
430
  set bottomLeft(value) {
431
431
  this.x = value.x;
@@ -433,15 +433,15 @@ export class Rectangle {
433
433
  }
434
434
 
435
435
  /**
436
- * TBD.
437
- * @returns {Point} TBD.
436
+ * Gets the bottom-right point of this rectangle.
437
+ * @returns {Point} The bottom-right point of this rectangle.
438
438
  */
439
439
  get bottomRight() {
440
440
  return new Point(this.right, this.bottom);
441
441
  }
442
442
 
443
443
  /**
444
- * TBD.
444
+ * Sets the bottom-right point of this rectangle.
445
445
  */
446
446
  set bottomRight(value) {
447
447
  this.right = value.x;
@@ -449,15 +449,15 @@ export class Rectangle {
449
449
  }
450
450
 
451
451
  /**
452
- * TBD.
453
- * @returns {number} TBD.
452
+ * Gets the left coordinate of this rectangle.
453
+ * @returns {number} The left coordinate of this rectangle.
454
454
  */
455
455
  get left() {
456
456
  return this.x;
457
457
  }
458
458
 
459
459
  /**
460
- * TBD.
460
+ * Sets the left coordinate of this rectangle.
461
461
  */
462
462
  set left(value) {
463
463
  if (value >= this.right) {
@@ -469,15 +469,15 @@ export class Rectangle {
469
469
  }
470
470
 
471
471
  /**
472
- * TBD.
473
- * @returns {number} TBD.
472
+ * Gets the right coordinate of this rectangle.
473
+ * @returns {number} The right coordinate of this rectangle.
474
474
  */
475
475
  get right() {
476
476
  return this.x + this.width;
477
477
  }
478
478
 
479
479
  /**
480
- * TBD.
480
+ * Sets the right coordinate of this rectangle.
481
481
  */
482
482
  set right(value) {
483
483
  if (value <= this.x) {
@@ -488,77 +488,77 @@ export class Rectangle {
488
488
  }
489
489
 
490
490
  /**
491
- * TBD.
492
- * @returns {number} TBD.
491
+ * Gets the volume (area) of this rectangle.
492
+ * @returns {number} The volume (area) of this rectangle.
493
493
  */
494
494
  get volume() {
495
495
  return this.width * this.height;
496
496
  }
497
497
 
498
498
  /**
499
- * TBD.
500
- * @returns {number} TBD.
499
+ * Gets the perimeter of this rectangle.
500
+ * @returns {number} The perimeter of this rectangle.
501
501
  */
502
502
  get perimeter() {
503
503
  return this.width * 2 + this.height * 2;
504
504
  }
505
505
 
506
506
  /**
507
- * TBD.
508
- * @returns {number} TBD.
507
+ * Gets the x coordinate of the center of this rectangle.
508
+ * @returns {number} The x coordinate of the center of this rectangle.
509
509
  */
510
510
  get centerX() {
511
511
  return this.x + this.halfWidth;
512
512
  }
513
513
 
514
514
  /**
515
- * TBD.
515
+ * Sets the x coordinate of the center of this rectangle.
516
516
  */
517
517
  set centerX(value) {
518
518
  this.x = value - this.halfWidth;
519
519
  }
520
520
 
521
521
  /**
522
- * TBD.
523
- * @returns {number} TBD.
522
+ * Gets the y coordinate of the center of this rectangle.
523
+ * @returns {number} The y coordinate of the center of this rectangle.
524
524
  */
525
525
  get centerY() {
526
526
  return this.y + this.halfHeight;
527
527
  }
528
528
 
529
529
  /**
530
- * TBD.
530
+ * Sets the y coordinate of the center of this rectangle.
531
531
  */
532
532
  set centerY(value) {
533
533
  this.y = value - this.halfHeight;
534
534
  }
535
535
 
536
536
  /**
537
- * TBD.
538
- * @returns {number} TBD.
537
+ * Gets a random x coordinate within this rectangle.
538
+ * @returns {number} A random x coordinate within this rectangle.
539
539
  */
540
540
  get randomX() {
541
541
  return this.x + Math.random() * this.width;
542
542
  }
543
543
 
544
544
  /**
545
- * TBD.
546
- * @returns {number} TBD.
545
+ * Gets a random y coordinate within this rectangle.
546
+ * @returns {number} A random y coordinate within this rectangle.
547
547
  */
548
548
  get randomY() {
549
549
  return this.y + Math.random() * this.height;
550
550
  }
551
551
 
552
552
  /**
553
- * TBD.
554
- * @returns {boolean} TBD.
553
+ * Checks if this rectangle is empty (has zero width or height).
554
+ * @returns {boolean} True if the rectangle is empty, false otherwise.
555
555
  */
556
556
  get empty() {
557
557
  return !this.width || !this.height;
558
558
  }
559
559
 
560
560
  /**
561
- * TBD.
561
+ * Sets whether this rectangle is empty (zero width or height).
562
562
  */
563
563
  set empty(value) {
564
564
  if (value === true) {
@@ -3,12 +3,12 @@ import { GEOM_ROUNDED_RECTANGLE } from '../core/const.js';
3
3
 
4
4
  export class RoundedRectangle {
5
5
  /**
6
- * TBD.
7
- * @param {number} x - TBD.
8
- * @param {number} y - TBD.
9
- * @param {number} width - TBD.
10
- * @param {number} height - TBD.
11
- * @param {number} radius - TBD.
6
+ * Creates a new RoundedRectangle instance.
7
+ * @param {number} x - The x coordinate of the top-left corner of the rectangle (default: 0).
8
+ * @param {number} y - The y coordinate of the top-left corner of the rectangle (default: 0).
9
+ * @param {number} width - The width of the rectangle (default: 0).
10
+ * @param {number} height - The height of the rectangle (default: 0).
11
+ * @param {number} radius - The corner radius (default: 20).
12
12
  */
13
13
  constructor(x = 0, y = 0, width = 0, height = 0, radius = 20) {
14
14
  this.x = x;
@@ -20,10 +20,10 @@ export class RoundedRectangle {
20
20
  }
21
21
 
22
22
  /**
23
- * TBD.
24
- * @param {number} x - TBD.
25
- * @param {number} y - TBD.
26
- * @returns {boolean} TBD.
23
+ * Checks if the specified point is contained within this rounded rectangle.
24
+ * @param {number} x - The x coordinate of the point to check.
25
+ * @param {number} y - The y coordinate of the point to check.
26
+ * @returns {boolean} True if the point is contained within this rounded rectangle, false otherwise.
27
27
  */
28
28
  contains(x, y) {
29
29
  if (this.width <= 0 || this.height <= 0) {
@@ -38,8 +38,8 @@ export class RoundedRectangle {
38
38
  }
39
39
 
40
40
  /**
41
- * TBD.
42
- * @returns {RoundedRectangle} TBD.
41
+ * Creates a clone of this rounded rectangle.
42
+ * @returns {RoundedRectangle} A new rounded rectangle with the same values as this one.
43
43
  */
44
44
  clone() {
45
45
  return clone(this);