@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,25 +26,30 @@ 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
+ /** @type {number} */
36
37
  this.x = x;
38
+ /** @type {number} */
37
39
  this.y = y;
40
+ /** @type {number} */
38
41
  this.width = width;
42
+ /** @type {number} */
39
43
  this.height = height;
44
+ /** @type {number} */
40
45
  this.type = GEOM_RECTANGLE;
41
46
  }
42
47
 
43
48
  /**
44
- * TBD.
45
- * @param {number} dx - TBD.
46
- * @param {number} dy - TBD.
47
- * @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.
48
53
  */
49
54
  offset(dx, dy) {
50
55
  this.x += dx;
@@ -53,21 +58,21 @@ export class Rectangle {
53
58
  }
54
59
 
55
60
  /**
56
- * TBD.
57
- * @param {Point} point - TBD.
58
- * @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.
59
64
  */
60
65
  offsetPoint(point) {
61
66
  return this.offset(point.x, point.y);
62
67
  }
63
68
 
64
69
  /**
65
- * TBD.
66
- * @param {number} x - TBD.
67
- * @param {number} y - TBD.
68
- * @param {number} width - TBD.
69
- * @param {number} height - TBD.
70
- * @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.
71
76
  */
72
77
  setTo(x, y, width, height) {
73
78
  this.x = x;
@@ -78,10 +83,10 @@ export class Rectangle {
78
83
  }
79
84
 
80
85
  /**
81
- * TBD.
82
- * @param {number} x - TBD.
83
- * @param {number} y - TBD.
84
- * @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.
85
90
  */
86
91
  scale(x, y) {
87
92
  if (y === undefined) {
@@ -93,10 +98,10 @@ export class Rectangle {
93
98
  }
94
99
 
95
100
  /**
96
- * TBD.
97
- * @param {number} x - TBD.
98
- * @param {number} y - TBD.
99
- * @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.
100
105
  */
101
106
  centerOn(x, y) {
102
107
  this.centerX = x;
@@ -105,7 +110,7 @@ export class Rectangle {
105
110
  }
106
111
 
107
112
  /**
108
- * TBD.
113
+ * Floors the x and y coordinates of the rectangle (rounds down to nearest integer).
109
114
  */
110
115
  floor() {
111
116
  this.x = Math.floor(this.x);
@@ -113,7 +118,7 @@ export class Rectangle {
113
118
  }
114
119
 
115
120
  /**
116
- * TBD.
121
+ * Floors all coordinates of the rectangle (rounds down to nearest integer).
117
122
  */
118
123
  floorAll() {
119
124
  this.x = Math.floor(this.x);
@@ -123,7 +128,7 @@ export class Rectangle {
123
128
  }
124
129
 
125
130
  /**
126
- * TBD.
131
+ * Ceils the x and y coordinates of the rectangle (rounds up to nearest integer).
127
132
  */
128
133
  ceil() {
129
134
  this.x = Math.ceil(this.x);
@@ -131,7 +136,7 @@ export class Rectangle {
131
136
  }
132
137
 
133
138
  /**
134
- * TBD.
139
+ * Ceils all coordinates of the rectangle (rounds up to nearest integer).
135
140
  */
136
141
  ceilAll() {
137
142
  this.x = Math.ceil(this.x);
@@ -141,18 +146,18 @@ export class Rectangle {
141
146
  }
142
147
 
143
148
  /**
144
- * TBD.
145
- * @param {Rectangle} source - TBD.
146
- * @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.
147
152
  */
148
153
  copyFrom(source) {
149
154
  return this.setTo(source.x, source.y, source.width, source.height);
150
155
  }
151
156
 
152
157
  /**
153
- * TBD.
154
- * @param {Rectangle} dest - TBD.
155
- * @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.
156
161
  */
157
162
  copyTo(dest) {
158
163
  dest.x = this.x;
@@ -163,29 +168,29 @@ export class Rectangle {
163
168
  }
164
169
 
165
170
  /**
166
- * TBD.
167
- * @param {number} dx - TBD.
168
- * @param {number} dy - TBD.
169
- * @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.
170
175
  */
171
176
  inflate(dx, dy) {
172
177
  return inflate(this, dx, dy);
173
178
  }
174
179
 
175
180
  /**
176
- * TBD.
177
- * @param {Point} output - TBD.
178
- * @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.
179
184
  */
180
185
  size(output) {
181
186
  return size(this, output);
182
187
  }
183
188
 
184
189
  /**
185
- * TBD.
186
- * @param {number} width - TBD.
187
- * @param {number} height - TBD.
188
- * @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.
189
194
  */
190
195
  resize(width, height) {
191
196
  this.width = width;
@@ -194,88 +199,88 @@ export class Rectangle {
194
199
  }
195
200
 
196
201
  /**
197
- * TBD.
198
- * @param {Rectangle} output - TBD.
199
- * @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.
200
205
  */
201
206
  clone(output) {
202
207
  return clone(this, output);
203
208
  }
204
209
 
205
210
  /**
206
- * TBD.
207
- * @param {number} x - TBD.
208
- * @param {number} y - TBD.
209
- * @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.
210
215
  */
211
216
  contains(x, y) {
212
217
  return contains(this, x, y);
213
218
  }
214
219
 
215
220
  /**
216
- * TBD.
217
- * @param {Rectangle} b - TBD.
218
- * @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.
219
224
  */
220
225
  containsRect(b) {
221
226
  return containsRect(b, this);
222
227
  }
223
228
 
224
229
  /**
225
- * TBD.
226
- * @param {Rectangle} b - TBD.
227
- * @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.
228
233
  */
229
234
  equals(b) {
230
235
  return equals(this, b);
231
236
  }
232
237
 
233
238
  /**
234
- * TBD.
235
- * @param {Rectangle} b - TBD.
236
- * @param {Rectangle} out - TBD.
237
- * @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.
238
243
  */
239
244
  intersection(b, out) {
240
245
  return intersection(this, b, out);
241
246
  }
242
247
 
243
248
  /**
244
- * TBD.
245
- * @param {Rectangle} b - TBD.
246
- * @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.
247
252
  */
248
253
  intersects(b) {
249
254
  return intersects(this, b);
250
255
  }
251
256
 
252
257
  /**
253
- * TBD.
254
- * @param {number} left - TBD.
255
- * @param {number} right - TBD.
256
- * @param {number} top - TBD.
257
- * @param {number} bottom - TBD.
258
- * @param {number} tolerance - TBD.
259
- * @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.
260
265
  */
261
266
  intersectsRaw(left, right, top, bottom, tolerance) {
262
267
  return intersectsRaw(this, left, right, top, bottom, tolerance);
263
268
  }
264
269
 
265
270
  /**
266
- * TBD.
267
- * @param {Rectangle} b - TBD.
268
- * @param {Rectangle} out - TBD.
269
- * @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.
270
275
  */
271
276
  union(b, out) {
272
277
  return union(this, b, out);
273
278
  }
274
279
 
275
280
  /**
276
- * TBD.
277
- * @param {Point} output - TBD.
278
- * @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.
279
284
  */
280
285
  random(output = null) {
281
286
  const result = output || new Point();
@@ -285,10 +290,10 @@ export class Rectangle {
285
290
  }
286
291
 
287
292
  /**
288
- * TBD.
289
- * @param {number} position - TBD.
290
- * @param {Point} output - TBD.
291
- * @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.
292
297
  */
293
298
  getPoint(position, output = null) {
294
299
  const result = output || new Point();
@@ -317,39 +322,39 @@ export class Rectangle {
317
322
  }
318
323
 
319
324
  /**
320
- * TBD.
321
- * @returns {string} TBD.
325
+ * Returns a string representation of this rectangle.
326
+ * @returns {string} A string representation of the rectangle.
322
327
  */
323
328
  toString() {
324
329
  return `[{Rectangle (x=${this.x} y=${this.y} width=${this.width} height=${this.height} empty=${this.empty})}]`;
325
330
  }
326
331
 
327
332
  /**
328
- * TBD.
329
- * @returns {number} TBD.
333
+ * Gets half the width of this rectangle.
334
+ * @returns {number} Half the width of this rectangle.
330
335
  */
331
336
  get halfWidth() {
332
337
  return Math.round(this.width / 2);
333
338
  }
334
339
 
335
340
  /**
336
- * TBD.
337
- * @returns {number} TBD.
341
+ * Gets half the height of this rectangle.
342
+ * @returns {number} Half the height of this rectangle.
338
343
  */
339
344
  get halfHeight() {
340
345
  return Math.round(this.height / 2);
341
346
  }
342
347
 
343
348
  /**
344
- * TBD.
345
- * @returns {number} TBD.
349
+ * Gets the top coordinate of this rectangle.
350
+ * @returns {number} The top coordinate of this rectangle.
346
351
  */
347
352
  get top() {
348
353
  return this.y;
349
354
  }
350
355
 
351
356
  /**
352
- * TBD.
357
+ * Sets the top coordinate of this rectangle.
353
358
  */
354
359
  set top(value) {
355
360
  if (value >= this.bottom) {
@@ -361,15 +366,15 @@ export class Rectangle {
361
366
  }
362
367
 
363
368
  /**
364
- * TBD.
365
- * @returns {Point} TBD.
369
+ * Gets the top-left point of this rectangle.
370
+ * @returns {Point} The top-left point of this rectangle.
366
371
  */
367
372
  get topLeft() {
368
373
  return new Point(this.x, this.y);
369
374
  }
370
375
 
371
376
  /**
372
- * TBD.
377
+ * Sets the top-left point of this rectangle.
373
378
  */
374
379
  set topLeft(value) {
375
380
  this.x = value.x;
@@ -377,15 +382,15 @@ export class Rectangle {
377
382
  }
378
383
 
379
384
  /**
380
- * TBD.
381
- * @returns {Point} TBD.
385
+ * Gets the top-right point of this rectangle.
386
+ * @returns {Point} The top-right point of this rectangle.
382
387
  */
383
388
  get topRight() {
384
389
  return new Point(this.x + this.width, this.y);
385
390
  }
386
391
 
387
392
  /**
388
- * TBD.
393
+ * Sets the top-right point of this rectangle.
389
394
  */
390
395
  set topRight(value) {
391
396
  this.right = value.x;
@@ -393,15 +398,15 @@ export class Rectangle {
393
398
  }
394
399
 
395
400
  /**
396
- * TBD.
397
- * @returns {number} TBD.
401
+ * Gets the bottom coordinate of this rectangle.
402
+ * @returns {number} The bottom coordinate of this rectangle.
398
403
  */
399
404
  get bottom() {
400
405
  return this.y + this.height;
401
406
  }
402
407
 
403
408
  /**
404
- * TBD.
409
+ * Sets the bottom coordinate of this rectangle.
405
410
  */
406
411
  set bottom(value) {
407
412
  if (value <= this.y) {
@@ -412,15 +417,15 @@ export class Rectangle {
412
417
  }
413
418
 
414
419
  /**
415
- * TBD.
416
- * @returns {Point} TBD.
420
+ * Gets the bottom-left point of this rectangle.
421
+ * @returns {Point} The bottom-left point of this rectangle.
417
422
  */
418
423
  get bottomLeft() {
419
424
  return new Point(this.x, this.bottom);
420
425
  }
421
426
 
422
427
  /**
423
- * TBD.
428
+ * Sets the bottom-left point of this rectangle.
424
429
  */
425
430
  set bottomLeft(value) {
426
431
  this.x = value.x;
@@ -428,15 +433,15 @@ export class Rectangle {
428
433
  }
429
434
 
430
435
  /**
431
- * TBD.
432
- * @returns {Point} TBD.
436
+ * Gets the bottom-right point of this rectangle.
437
+ * @returns {Point} The bottom-right point of this rectangle.
433
438
  */
434
439
  get bottomRight() {
435
440
  return new Point(this.right, this.bottom);
436
441
  }
437
442
 
438
443
  /**
439
- * TBD.
444
+ * Sets the bottom-right point of this rectangle.
440
445
  */
441
446
  set bottomRight(value) {
442
447
  this.right = value.x;
@@ -444,15 +449,15 @@ export class Rectangle {
444
449
  }
445
450
 
446
451
  /**
447
- * TBD.
448
- * @returns {number} TBD.
452
+ * Gets the left coordinate of this rectangle.
453
+ * @returns {number} The left coordinate of this rectangle.
449
454
  */
450
455
  get left() {
451
456
  return this.x;
452
457
  }
453
458
 
454
459
  /**
455
- * TBD.
460
+ * Sets the left coordinate of this rectangle.
456
461
  */
457
462
  set left(value) {
458
463
  if (value >= this.right) {
@@ -464,15 +469,15 @@ export class Rectangle {
464
469
  }
465
470
 
466
471
  /**
467
- * TBD.
468
- * @returns {number} TBD.
472
+ * Gets the right coordinate of this rectangle.
473
+ * @returns {number} The right coordinate of this rectangle.
469
474
  */
470
475
  get right() {
471
476
  return this.x + this.width;
472
477
  }
473
478
 
474
479
  /**
475
- * TBD.
480
+ * Sets the right coordinate of this rectangle.
476
481
  */
477
482
  set right(value) {
478
483
  if (value <= this.x) {
@@ -483,77 +488,77 @@ export class Rectangle {
483
488
  }
484
489
 
485
490
  /**
486
- * TBD.
487
- * @returns {number} TBD.
491
+ * Gets the volume (area) of this rectangle.
492
+ * @returns {number} The volume (area) of this rectangle.
488
493
  */
489
494
  get volume() {
490
495
  return this.width * this.height;
491
496
  }
492
497
 
493
498
  /**
494
- * TBD.
495
- * @returns {number} TBD.
499
+ * Gets the perimeter of this rectangle.
500
+ * @returns {number} The perimeter of this rectangle.
496
501
  */
497
502
  get perimeter() {
498
503
  return this.width * 2 + this.height * 2;
499
504
  }
500
505
 
501
506
  /**
502
- * TBD.
503
- * @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.
504
509
  */
505
510
  get centerX() {
506
511
  return this.x + this.halfWidth;
507
512
  }
508
513
 
509
514
  /**
510
- * TBD.
515
+ * Sets the x coordinate of the center of this rectangle.
511
516
  */
512
517
  set centerX(value) {
513
518
  this.x = value - this.halfWidth;
514
519
  }
515
520
 
516
521
  /**
517
- * TBD.
518
- * @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.
519
524
  */
520
525
  get centerY() {
521
526
  return this.y + this.halfHeight;
522
527
  }
523
528
 
524
529
  /**
525
- * TBD.
530
+ * Sets the y coordinate of the center of this rectangle.
526
531
  */
527
532
  set centerY(value) {
528
533
  this.y = value - this.halfHeight;
529
534
  }
530
535
 
531
536
  /**
532
- * TBD.
533
- * @returns {number} TBD.
537
+ * Gets a random x coordinate within this rectangle.
538
+ * @returns {number} A random x coordinate within this rectangle.
534
539
  */
535
540
  get randomX() {
536
541
  return this.x + Math.random() * this.width;
537
542
  }
538
543
 
539
544
  /**
540
- * TBD.
541
- * @returns {number} TBD.
545
+ * Gets a random y coordinate within this rectangle.
546
+ * @returns {number} A random y coordinate within this rectangle.
542
547
  */
543
548
  get randomY() {
544
549
  return this.y + Math.random() * this.height;
545
550
  }
546
551
 
547
552
  /**
548
- * TBD.
549
- * @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.
550
555
  */
551
556
  get empty() {
552
557
  return !this.width || !this.height;
553
558
  }
554
559
 
555
560
  /**
556
- * TBD.
561
+ * Sets whether this rectangle is empty (zero width or height).
557
562
  */
558
563
  set empty(value) {
559
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);