@vpmedia/phaser 1.104.0 → 1.105.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 (297) hide show
  1. package/dist/index.js +151 -574
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts +35 -57
  4. package/dist/phaser/core/animation.d.ts.map +1 -1
  5. package/dist/phaser/core/animation_manager.d.ts +11 -10
  6. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  7. package/dist/phaser/core/animation_parser.d.ts +2 -2
  8. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  9. package/dist/phaser/core/array_set.d.ts +3 -3
  10. package/dist/phaser/core/array_set.d.ts.map +1 -1
  11. package/dist/phaser/core/cache.d.ts +60 -60
  12. package/dist/phaser/core/cache.d.ts.map +1 -1
  13. package/dist/phaser/core/device.d.ts.map +1 -1
  14. package/dist/phaser/core/device_util.d.ts +10 -10
  15. package/dist/phaser/core/device_util.d.ts.map +1 -1
  16. package/dist/phaser/core/dom.d.ts +6 -5
  17. package/dist/phaser/core/dom.d.ts.map +1 -1
  18. package/dist/phaser/core/event_manager.d.ts +49 -174
  19. package/dist/phaser/core/event_manager.d.ts.map +1 -1
  20. package/dist/phaser/core/factory.d.ts +7 -7
  21. package/dist/phaser/core/factory.d.ts.map +1 -1
  22. package/dist/phaser/core/frame.d.ts +27 -48
  23. package/dist/phaser/core/frame.d.ts.map +1 -1
  24. package/dist/phaser/core/frame_data.d.ts +11 -60
  25. package/dist/phaser/core/frame_data.d.ts.map +1 -1
  26. package/dist/phaser/core/frame_util.d.ts +4 -14
  27. package/dist/phaser/core/frame_util.d.ts.map +1 -1
  28. package/dist/phaser/core/game.d.ts +49 -58
  29. package/dist/phaser/core/game.d.ts.map +1 -1
  30. package/dist/phaser/core/input.d.ts +15 -13
  31. package/dist/phaser/core/input.d.ts.map +1 -1
  32. package/dist/phaser/core/input_handler.d.ts +23 -20
  33. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  34. package/dist/phaser/core/input_mouse.d.ts +26 -1
  35. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  36. package/dist/phaser/core/input_mspointer.d.ts +2 -2
  37. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  38. package/dist/phaser/core/input_pointer.d.ts +9 -9
  39. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  40. package/dist/phaser/core/input_touch.d.ts +2 -1
  41. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  42. package/dist/phaser/core/loader.d.ts +28 -28
  43. package/dist/phaser/core/loader.d.ts.map +1 -1
  44. package/dist/phaser/core/loader_parser.d.ts +4 -4
  45. package/dist/phaser/core/loader_parser.d.ts.map +1 -1
  46. package/dist/phaser/core/raf.d.ts +2 -2
  47. package/dist/phaser/core/raf.d.ts.map +1 -1
  48. package/dist/phaser/core/scale_manager.d.ts +22 -17
  49. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  50. package/dist/phaser/core/scene.d.ts +1 -1
  51. package/dist/phaser/core/scene.d.ts.map +1 -1
  52. package/dist/phaser/core/scene_manager.d.ts +10 -9
  53. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  54. package/dist/phaser/core/signal.d.ts +9 -8
  55. package/dist/phaser/core/signal.d.ts.map +1 -1
  56. package/dist/phaser/core/signal_binding.d.ts +2 -2
  57. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  58. package/dist/phaser/core/sound.d.ts +56 -101
  59. package/dist/phaser/core/sound.d.ts.map +1 -1
  60. package/dist/phaser/core/sound_manager.d.ts +11 -9
  61. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  62. package/dist/phaser/core/sound_sprite.d.ts +4 -4
  63. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  64. package/dist/phaser/core/stage.d.ts +3 -3
  65. package/dist/phaser/core/stage.d.ts.map +1 -1
  66. package/dist/phaser/core/time.d.ts +5 -5
  67. package/dist/phaser/core/time.d.ts.map +1 -1
  68. package/dist/phaser/core/timer.d.ts +10 -10
  69. package/dist/phaser/core/timer.d.ts.map +1 -1
  70. package/dist/phaser/core/timer_event.d.ts +11 -21
  71. package/dist/phaser/core/timer_event.d.ts.map +1 -1
  72. package/dist/phaser/core/tween.d.ts +37 -59
  73. package/dist/phaser/core/tween.d.ts.map +1 -1
  74. package/dist/phaser/core/tween_data.d.ts +6 -5
  75. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  76. package/dist/phaser/core/tween_easing.d.ts +31 -31
  77. package/dist/phaser/core/tween_easing.d.ts.map +1 -1
  78. package/dist/phaser/core/tween_manager.d.ts +4 -4
  79. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  80. package/dist/phaser/core/world.d.ts +1 -1
  81. package/dist/phaser/core/world.d.ts.map +1 -1
  82. package/dist/phaser/display/bitmap_text.d.ts +22 -20
  83. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  84. package/dist/phaser/display/button.d.ts +23 -35
  85. package/dist/phaser/display/button.d.ts.map +1 -1
  86. package/dist/phaser/display/canvas/buffer.d.ts +2 -2
  87. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  88. package/dist/phaser/display/canvas/graphics.d.ts +3 -3
  89. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  90. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  91. package/dist/phaser/display/canvas/pool.d.ts +2 -2
  92. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  93. package/dist/phaser/display/canvas/renderer.d.ts +5 -5
  94. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  95. package/dist/phaser/display/canvas/tinter.d.ts +3 -3
  96. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  97. package/dist/phaser/display/canvas/util.d.ts +9 -9
  98. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  99. package/dist/phaser/display/display_object.d.ts +45 -42
  100. package/dist/phaser/display/display_object.d.ts.map +1 -1
  101. package/dist/phaser/display/graphics.d.ts +24 -16
  102. package/dist/phaser/display/graphics.d.ts.map +1 -1
  103. package/dist/phaser/display/graphics_data.d.ts +1 -1
  104. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  105. package/dist/phaser/display/graphics_data_util.d.ts +1 -1
  106. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  107. package/dist/phaser/display/group.d.ts +24 -37
  108. package/dist/phaser/display/group.d.ts.map +1 -1
  109. package/dist/phaser/display/image.d.ts +34 -49
  110. package/dist/phaser/display/image.d.ts.map +1 -1
  111. package/dist/phaser/display/sprite_batch.d.ts +1 -1
  112. package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
  113. package/dist/phaser/display/sprite_util.d.ts +5 -5
  114. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  115. package/dist/phaser/display/text.d.ts +86 -66
  116. package/dist/phaser/display/text.d.ts.map +1 -1
  117. package/dist/phaser/display/webgl/abstract_filter.d.ts +2 -1
  118. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  119. package/dist/phaser/display/webgl/base_texture.d.ts +2 -2
  120. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  121. package/dist/phaser/display/webgl/blend_manager.d.ts +3 -2
  122. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  123. package/dist/phaser/display/webgl/earcut.d.ts +10 -10
  124. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  125. package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
  126. package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  127. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +2 -1
  128. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  129. package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
  130. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  131. package/dist/phaser/display/webgl/filter_texture.d.ts +3 -2
  132. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  133. package/dist/phaser/display/webgl/graphics.d.ts +11 -10
  134. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  135. package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
  136. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  137. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  138. package/dist/phaser/display/webgl/render_texture.d.ts +2 -1
  139. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  140. package/dist/phaser/display/webgl/renderer.d.ts +8 -6
  141. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  142. package/dist/phaser/display/webgl/shader/complex.d.ts +2 -1
  143. package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  144. package/dist/phaser/display/webgl/shader/fast.d.ts +2 -1
  145. package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  146. package/dist/phaser/display/webgl/shader/normal.d.ts +1 -0
  147. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  148. package/dist/phaser/display/webgl/shader/primitive.d.ts +2 -1
  149. package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  150. package/dist/phaser/display/webgl/shader/strip.d.ts +2 -1
  151. package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  152. package/dist/phaser/display/webgl/shader_manager.d.ts +4 -2
  153. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  154. package/dist/phaser/display/webgl/sprite_batch.d.ts +3 -2
  155. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  156. package/dist/phaser/display/webgl/stencil_manager.d.ts +5 -4
  157. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  158. package/dist/phaser/display/webgl/texture.d.ts +15 -2
  159. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  160. package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
  161. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  162. package/dist/phaser/display/webgl/util.d.ts +6 -6
  163. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  164. package/dist/phaser/geom/circle.d.ts +11 -10
  165. package/dist/phaser/geom/circle.d.ts.map +1 -1
  166. package/dist/phaser/geom/ellipse.d.ts +6 -5
  167. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  168. package/dist/phaser/geom/line.d.ts +14 -14
  169. package/dist/phaser/geom/line.d.ts.map +1 -1
  170. package/dist/phaser/geom/matrix.d.ts +13 -12
  171. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  172. package/dist/phaser/geom/point.d.ts +19 -19
  173. package/dist/phaser/geom/point.d.ts.map +1 -1
  174. package/dist/phaser/geom/polygon.d.ts +6 -6
  175. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  176. package/dist/phaser/geom/rectangle.d.ts +20 -20
  177. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  178. package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
  179. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  180. package/dist/phaser/geom/util/circle.d.ts +9 -7
  181. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  182. package/dist/phaser/geom/util/ellipse.d.ts +1 -1
  183. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  184. package/dist/phaser/geom/util/line.d.ts +5 -3
  185. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  186. package/dist/phaser/geom/util/matrix.d.ts +2 -1
  187. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  188. package/dist/phaser/geom/util/point.d.ts +19 -19
  189. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  190. package/dist/phaser/geom/util/polygon.d.ts +2 -1
  191. package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
  192. package/dist/phaser/geom/util/rectangle.d.ts +17 -15
  193. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  194. package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
  195. package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  196. package/dist/phaser/util/math.d.ts +51 -142
  197. package/dist/phaser/util/math.d.ts.map +1 -1
  198. package/package.json +1 -1
  199. package/src/phaser/core/animation.ts +38 -61
  200. package/src/phaser/core/animation_manager.ts +21 -21
  201. package/src/phaser/core/animation_parser.ts +11 -3
  202. package/src/phaser/core/array_set.ts +8 -8
  203. package/src/phaser/core/cache.ts +75 -68
  204. package/src/phaser/core/device.ts +23 -24
  205. package/src/phaser/core/device_util.ts +10 -10
  206. package/src/phaser/core/dom.ts +5 -5
  207. package/src/phaser/core/event_manager.ts +52 -193
  208. package/src/phaser/core/factory.ts +25 -18
  209. package/src/phaser/core/frame.ts +37 -51
  210. package/src/phaser/core/frame_data.ts +29 -76
  211. package/src/phaser/core/frame_util.ts +3 -16
  212. package/src/phaser/core/game.ts +36 -63
  213. package/src/phaser/core/input.ts +68 -68
  214. package/src/phaser/core/input_handler.ts +81 -86
  215. package/src/phaser/core/input_mouse.ts +42 -36
  216. package/src/phaser/core/input_mspointer.ts +24 -25
  217. package/src/phaser/core/input_pointer.ts +55 -56
  218. package/src/phaser/core/input_touch.ts +26 -26
  219. package/src/phaser/core/loader.ts +97 -70
  220. package/src/phaser/core/loader_parser.ts +6 -7
  221. package/src/phaser/core/raf.ts +2 -2
  222. package/src/phaser/core/scale_manager.ts +85 -82
  223. package/src/phaser/core/scene.ts +3 -4
  224. package/src/phaser/core/scene_manager.ts +26 -26
  225. package/src/phaser/core/signal.ts +10 -10
  226. package/src/phaser/core/signal_binding.ts +2 -2
  227. package/src/phaser/core/sound.ts +65 -112
  228. package/src/phaser/core/sound_manager.ts +31 -30
  229. package/src/phaser/core/sound_sprite.ts +10 -11
  230. package/src/phaser/core/stage.ts +8 -8
  231. package/src/phaser/core/time.ts +33 -34
  232. package/src/phaser/core/timer.ts +40 -34
  233. package/src/phaser/core/timer_event.ts +23 -23
  234. package/src/phaser/core/tween.ts +42 -68
  235. package/src/phaser/core/tween_data.ts +31 -31
  236. package/src/phaser/core/tween_easing.ts +31 -31
  237. package/src/phaser/core/tween_manager.ts +10 -11
  238. package/src/phaser/core/world.ts +1 -2
  239. package/src/phaser/display/bitmap_text.ts +41 -31
  240. package/src/phaser/display/button.ts +24 -51
  241. package/src/phaser/display/canvas/buffer.ts +6 -7
  242. package/src/phaser/display/canvas/graphics.ts +3 -4
  243. package/src/phaser/display/canvas/masker.ts +2 -3
  244. package/src/phaser/display/canvas/pool.ts +3 -4
  245. package/src/phaser/display/canvas/renderer.ts +19 -20
  246. package/src/phaser/display/canvas/tinter.ts +4 -5
  247. package/src/phaser/display/canvas/util.ts +9 -9
  248. package/src/phaser/display/display_object.ts +49 -50
  249. package/src/phaser/display/graphics.ts +56 -43
  250. package/src/phaser/display/graphics_data.ts +11 -12
  251. package/src/phaser/display/graphics_data_util.ts +1 -2
  252. package/src/phaser/display/group.ts +32 -42
  253. package/src/phaser/display/image.ts +32 -52
  254. package/src/phaser/display/sprite_batch.ts +1 -2
  255. package/src/phaser/display/sprite_util.ts +5 -6
  256. package/src/phaser/display/text.ts +82 -56
  257. package/src/phaser/display/webgl/abstract_filter.ts +8 -8
  258. package/src/phaser/display/webgl/base_texture.ts +14 -15
  259. package/src/phaser/display/webgl/blend_manager.ts +5 -5
  260. package/src/phaser/display/webgl/earcut.ts +27 -27
  261. package/src/phaser/display/webgl/earcut_node.ts +1 -1
  262. package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -19
  263. package/src/phaser/display/webgl/filter_manager.ts +5 -5
  264. package/src/phaser/display/webgl/filter_texture.ts +7 -7
  265. package/src/phaser/display/webgl/graphics.ts +10 -11
  266. package/src/phaser/display/webgl/graphics_data.ts +11 -11
  267. package/src/phaser/display/webgl/mask_manager.ts +2 -3
  268. package/src/phaser/display/webgl/render_texture.ts +12 -12
  269. package/src/phaser/display/webgl/renderer.ts +24 -24
  270. package/src/phaser/display/webgl/shader/complex.ts +7 -7
  271. package/src/phaser/display/webgl/shader/fast.ts +8 -8
  272. package/src/phaser/display/webgl/shader/normal.ts +12 -12
  273. package/src/phaser/display/webgl/shader/primitive.ts +7 -7
  274. package/src/phaser/display/webgl/shader/strip.ts +7 -7
  275. package/src/phaser/display/webgl/shader_manager.ts +13 -13
  276. package/src/phaser/display/webgl/sprite_batch.ts +20 -20
  277. package/src/phaser/display/webgl/stencil_manager.ts +8 -8
  278. package/src/phaser/display/webgl/texture.ts +35 -24
  279. package/src/phaser/display/webgl/texture_util.ts +2 -3
  280. package/src/phaser/display/webgl/util.ts +6 -6
  281. package/src/phaser/geom/circle.ts +10 -10
  282. package/src/phaser/geom/ellipse.ts +6 -6
  283. package/src/phaser/geom/line.ts +14 -14
  284. package/src/phaser/geom/matrix.ts +12 -12
  285. package/src/phaser/geom/point.ts +19 -19
  286. package/src/phaser/geom/polygon.ts +5 -5
  287. package/src/phaser/geom/rectangle.ts +21 -21
  288. package/src/phaser/geom/rounded_rectangle.ts +2 -2
  289. package/src/phaser/geom/util/circle.ts +7 -7
  290. package/src/phaser/geom/util/ellipse.ts +1 -1
  291. package/src/phaser/geom/util/line.ts +5 -5
  292. package/src/phaser/geom/util/matrix.ts +1 -1
  293. package/src/phaser/geom/util/point.ts +20 -20
  294. package/src/phaser/geom/util/polygon.ts +1 -1
  295. package/src/phaser/geom/util/rectangle.ts +15 -15
  296. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
  297. package/src/phaser/util/math.ts +65 -151
@@ -15,7 +15,7 @@ export class Line {
15
15
  * @param {number} x2 - The x coordinate of the end point (default: 0).
16
16
  * @param {number} y2 - The y coordinate of the end point (default: 0).
17
17
  */
18
- constructor(x1 = 0, y1 = 0, x2 = 0, y2 = 0) {
18
+ constructor(x1: number = 0, y1: number = 0, x2: number = 0, y2: number = 0) {
19
19
  /** @type {Point} */
20
20
  this.start = new Point(x1, y1);
21
21
  /** @type {Point} */
@@ -32,7 +32,7 @@ export class Line {
32
32
  * @param {number} y2 - The new y coordinate of the end point.
33
33
  * @returns {Line} This line instance for chaining.
34
34
  */
35
- setTo(x1, y1, x2, y2) {
35
+ setTo(x1: number, y1: number, x2: number, y2: number) {
36
36
  this.start.setTo(x1, y1);
37
37
  this.end.setTo(x2, y2);
38
38
  return this;
@@ -45,7 +45,7 @@ export class Line {
45
45
  * @param {boolean} useCenter - Whether to use the center of the sprites (default: false).
46
46
  * @returns {Line} This line instance for chaining.
47
47
  */
48
- fromSprite(startSprite, endSprite, useCenter = false) {
48
+ fromSprite(startSprite: any, endSprite: any, useCenter: boolean = false) {
49
49
  if (useCenter) {
50
50
  return this.setTo(startSprite.center.x, startSprite.center.y, endSprite.center.x, endSprite.center.y);
51
51
  }
@@ -60,7 +60,7 @@ export class Line {
60
60
  * @param {number} length - The length of the line.
61
61
  * @returns {Line} This line instance for chaining.
62
62
  */
63
- fromAngle(x, y, angle, length) {
63
+ fromAngle(x: number, y: number, angle: number, length: number) {
64
64
  this.start.setTo(x, y);
65
65
  this.end.setTo(x + Math.cos(angle) * length, y + Math.sin(angle) * length);
66
66
  return this;
@@ -72,7 +72,7 @@ export class Line {
72
72
  * @param {boolean} asDegrees - Whether the angle is provided in degrees (default: false).
73
73
  * @returns {Line} This line instance for chaining.
74
74
  */
75
- rotate(angle, asDegrees = false) {
75
+ rotate(angle: number, asDegrees: boolean = false) {
76
76
  const cx = (this.start.x + this.end.x) / 2;
77
77
  const cy = (this.start.y + this.end.y) / 2;
78
78
  this.start.rotate(cx, cy, angle, asDegrees);
@@ -88,7 +88,7 @@ export class Line {
88
88
  * @param {boolean} asDegrees - Whether the angle is provided in degrees (default: false).
89
89
  * @returns {Line} This line instance for chaining.
90
90
  */
91
- rotateAround(x, y, angle, asDegrees = false) {
91
+ rotateAround(x: number, y: number, angle: number, asDegrees: boolean = false) {
92
92
  this.start.rotate(x, y, angle, asDegrees);
93
93
  this.end.rotate(x, y, angle, asDegrees);
94
94
  return this;
@@ -101,7 +101,7 @@ export class Line {
101
101
  * @param {Point} result - The point to store the intersection in (optional).
102
102
  * @returns {Point} The intersection point, or null if no intersection occurs.
103
103
  */
104
- intersects(line, asSegment, result) {
104
+ intersects(line: Line, asSegment: boolean, result: Point) {
105
105
  return intersectsPoints(this.start, this.end, line.start, line.end, asSegment, result);
106
106
  }
107
107
 
@@ -110,7 +110,7 @@ export class Line {
110
110
  * @param {Line} line - The line to reflect off.
111
111
  * @returns {number} The angle of reflection in radians.
112
112
  */
113
- reflect(line) {
113
+ reflect(line: Line) {
114
114
  return reflect(this, line);
115
115
  }
116
116
 
@@ -119,7 +119,7 @@ export class Line {
119
119
  * @param {Point} output - The point to store the result in (optional).
120
120
  * @returns {Point} The midpoint of this line.
121
121
  */
122
- midPoint(output = null) {
122
+ midPoint(output: Point = null) {
123
123
  const result = output || new Point();
124
124
  result.x = (this.start.x + this.end.x) / 2;
125
125
  result.y = (this.start.y + this.end.y) / 2;
@@ -131,7 +131,7 @@ export class Line {
131
131
  * @param {number} x - The x coordinate to center the line on.
132
132
  * @param {number} y - The y coordinate to center the line on.
133
133
  */
134
- centerOn(x, y) {
134
+ centerOn(x: number, y: number) {
135
135
  const cx = (this.start.x + this.end.x) / 2;
136
136
  const cy = (this.start.y + this.end.y) / 2;
137
137
  const tx = x - cx;
@@ -146,7 +146,7 @@ export class Line {
146
146
  * @param {number} y - The y coordinate of the point to check.
147
147
  * @returns {boolean} True if the point lies on this line, false otherwise.
148
148
  */
149
- pointOnLine(x, y) {
149
+ pointOnLine(x: number, y: number) {
150
150
  return (x - this.start.x) * (this.end.y - this.start.y) === (this.end.x - this.start.x) * (y - this.start.y);
151
151
  }
152
152
 
@@ -156,7 +156,7 @@ export class Line {
156
156
  * @param {number} y - The y coordinate of the point to check.
157
157
  * @returns {boolean} True if the point lies on this line segment, false otherwise.
158
158
  */
159
- pointOnSegment(x, y) {
159
+ pointOnSegment(x: number, y: number) {
160
160
  const xMin = Math.min(this.start.x, this.end.x);
161
161
  const xMax = Math.max(this.start.x, this.end.x);
162
162
  const yMin = Math.min(this.start.y, this.end.y);
@@ -169,7 +169,7 @@ export class Line {
169
169
  * @param {Point} output - The point to store the result in (optional).
170
170
  * @returns {Point} A random point on this line.
171
171
  */
172
- random(output = null) {
172
+ random(output: Point = null) {
173
173
  const result = output || new Point();
174
174
  const t = Math.random();
175
175
  result.x = this.start.x + t * (this.end.x - this.start.x);
@@ -183,7 +183,7 @@ export class Line {
183
183
  * @param {number[][]} results - The array to store the results in (optional).
184
184
  * @returns {number[][]} An array of coordinate pairs representing points along this line.
185
185
  */
186
- coordinatesOnLine(stepRate = 1, results = []) {
186
+ coordinatesOnLine(stepRate: number = 1, results: number[][] = []) {
187
187
  let x1 = Math.round(this.start.x);
188
188
  let y1 = Math.round(this.start.y);
189
189
  const x2 = Math.round(this.end.x);
@@ -20,7 +20,7 @@ export class Matrix {
20
20
  * @param {number} tx - The tx component of the matrix (default: 0).
21
21
  * @param {number} ty - The ty component of the matrix (default: 0).
22
22
  */
23
- constructor(a = 1, b = 0, c = 0, d = 1, tx = 0, ty = 0) {
23
+ constructor(a: number = 1, b: number = 0, c: number = 0, d: number = 1, tx: number = 0, ty: number = 0) {
24
24
  /** @type {number} */
25
25
  this.a = a;
26
26
  /** @type {number} */
@@ -42,7 +42,7 @@ export class Matrix {
42
42
  * @param {number[]} array - The array to read the matrix components from (should have 6 elements).
43
43
  * @returns {Matrix} This matrix instance for chaining.
44
44
  */
45
- fromArray(array) {
45
+ fromArray(array: number[]) {
46
46
  return this.setTo(array[0], array[1], array[3], array[4], array[2], array[5]);
47
47
  }
48
48
 
@@ -56,7 +56,7 @@ export class Matrix {
56
56
  * @param {number} ty - The new ty component of the matrix.
57
57
  * @returns {Matrix} This matrix instance for chaining.
58
58
  */
59
- setTo(a, b, c, d, tx, ty) {
59
+ setTo(a: number, b: number, c: number, d: number, tx: number, ty: number) {
60
60
  this.a = a;
61
61
  this.b = b;
62
62
  this.c = c;
@@ -79,7 +79,7 @@ export class Matrix {
79
79
  * @param {Matrix} matrix - The matrix to copy values to.
80
80
  * @returns {Matrix} The destination matrix.
81
81
  */
82
- copyTo(matrix) {
82
+ copyTo(matrix: Matrix) {
83
83
  matrix.copyFrom(this);
84
84
  return matrix;
85
85
  }
@@ -89,7 +89,7 @@ export class Matrix {
89
89
  * @param {Matrix} matrix - The matrix to copy values from.
90
90
  * @returns {Matrix} This matrix instance for chaining.
91
91
  */
92
- copyFrom(matrix) {
92
+ copyFrom(matrix: Matrix) {
93
93
  this.a = matrix.a;
94
94
  this.b = matrix.b;
95
95
  this.c = matrix.c;
@@ -105,7 +105,7 @@ export class Matrix {
105
105
  * @param {Float32Array} output - The array to store the result in (optional).
106
106
  * @returns {Float32Array} A Float32Array containing the matrix elements.
107
107
  */
108
- toArray(transpose = false, output = null) {
108
+ toArray(transpose: boolean = false, output: Float32Array = null) {
109
109
  const result = output || new Float32Array(9);
110
110
  if (transpose) {
111
111
  result[0] = this.a;
@@ -137,7 +137,7 @@ export class Matrix {
137
137
  * @param {Point} output - The point to store the result in (optional).
138
138
  * @returns {Point} The transformed point.
139
139
  */
140
- apply(pos, output = null) {
140
+ apply(pos: Point, output: Point = null) {
141
141
  const result = output || new Point();
142
142
  result.x = this.a * pos.x + this.c * pos.y + this.tx;
143
143
  result.y = this.b * pos.x + this.d * pos.y + this.ty;
@@ -150,7 +150,7 @@ export class Matrix {
150
150
  * @param {Point} output - The point to store the result in (optional).
151
151
  * @returns {Point} The transformed point.
152
152
  */
153
- applyInverse(pos, output = null) {
153
+ applyInverse(pos: Point, output: Point = null) {
154
154
  const result = output || new Point();
155
155
  const id = 1 / (this.a * this.d + this.c * -this.b);
156
156
  const x = pos.x;
@@ -166,7 +166,7 @@ export class Matrix {
166
166
  * @param {number} y - The amount to translate in the y direction.
167
167
  * @returns {Matrix} This matrix instance for chaining.
168
168
  */
169
- translate(x, y) {
169
+ translate(x: number, y: number) {
170
170
  this.tx += x;
171
171
  this.ty += y;
172
172
  return this;
@@ -178,7 +178,7 @@ export class Matrix {
178
178
  * @param {number} y - The amount to scale in the y direction.
179
179
  * @returns {Matrix} This matrix instance for chaining.
180
180
  */
181
- scale(x, y) {
181
+ scale(x: number, y: number) {
182
182
  this.a *= x;
183
183
  this.d *= y;
184
184
  this.c *= x;
@@ -193,7 +193,7 @@ export class Matrix {
193
193
  * @param {number} angle - The angle in radians to rotate by.
194
194
  * @returns {Matrix} This matrix instance for chaining.
195
195
  */
196
- rotate(angle) {
196
+ rotate(angle: number) {
197
197
  const cos = Math.cos(angle);
198
198
  const sin = Math.sin(angle);
199
199
  const a1 = this.a;
@@ -213,7 +213,7 @@ export class Matrix {
213
213
  * @param {Matrix} matrix - The matrix to append.
214
214
  * @returns {Matrix} This matrix instance for chaining.
215
215
  */
216
- append(matrix) {
216
+ append(matrix: Matrix) {
217
217
  const a1 = this.a;
218
218
  const b1 = this.b;
219
219
  const c1 = this.c;
@@ -11,7 +11,7 @@ export class Point {
11
11
  * @param {number} x - The x coordinate of the point (default: 0).
12
12
  * @param {number} y - The y coordinate of the point (default: 0).
13
13
  */
14
- constructor(x = 0, y = 0) {
14
+ constructor(x: number = 0, y: number = 0) {
15
15
  /** @type {number} */
16
16
  this.x = x;
17
17
  /** @type {number} */
@@ -25,7 +25,7 @@ export class Point {
25
25
  * @param {Point} source - The point to copy coordinates from.
26
26
  * @returns {Point} This point instance for chaining.
27
27
  */
28
- copyFrom(source) {
28
+ copyFrom(source: Point) {
29
29
  return this.setTo(source.x, source.y);
30
30
  }
31
31
 
@@ -43,7 +43,7 @@ export class Point {
43
43
  * @param {number} y - The new y coordinate for the point.
44
44
  * @returns {Point} This point instance for chaining.
45
45
  */
46
- setTo(x, y?) {
46
+ setTo(x: number, y?: number) {
47
47
  this.x = x || 0;
48
48
  this.y = y || (y !== 0 ? this.x : 0);
49
49
  return this;
@@ -56,7 +56,7 @@ export class Point {
56
56
  * @returns {Point} This point instance for chaining.
57
57
  * @deprecated Use setTo instead.
58
58
  */
59
- set(x, y) {
59
+ set(x: number, y: number) {
60
60
  this.x = x || 0;
61
61
  this.y = y || (y !== 0 ? this.x : 0);
62
62
  return this;
@@ -68,7 +68,7 @@ export class Point {
68
68
  * @param {number} y - The amount to add to the y coordinate.
69
69
  * @returns {Point} This point instance for chaining.
70
70
  */
71
- add(x, y) {
71
+ add(x: number, y: number) {
72
72
  this.x += x;
73
73
  this.y += y;
74
74
  return this;
@@ -80,7 +80,7 @@ export class Point {
80
80
  * @param {number} y - The amount to subtract from the y coordinate.
81
81
  * @returns {Point} This point instance for chaining.
82
82
  */
83
- subtract(x, y) {
83
+ subtract(x: number, y: number) {
84
84
  this.x -= x;
85
85
  this.y -= y;
86
86
  return this;
@@ -92,7 +92,7 @@ export class Point {
92
92
  * @param {number} y - The amount to multiply the y coordinate by.
93
93
  * @returns {Point} This point instance for chaining.
94
94
  */
95
- multiply(x, y) {
95
+ multiply(x: number, y: number) {
96
96
  this.x *= x;
97
97
  this.y *= y;
98
98
  return this;
@@ -104,7 +104,7 @@ export class Point {
104
104
  * @param {number} y - The amount to divide the y coordinate by.
105
105
  * @returns {Point} This point instance for chaining.
106
106
  */
107
- divide(x, y) {
107
+ divide(x: number, y: number) {
108
108
  this.x /= x;
109
109
  this.y /= y;
110
110
  return this;
@@ -116,7 +116,7 @@ export class Point {
116
116
  * @param {number} max - The maximum value for the x coordinate.
117
117
  * @returns {Point} This point instance for chaining.
118
118
  */
119
- clampX(min, max) {
119
+ clampX(min: number, max: number) {
120
120
  this.x = Math.max(min, Math.min(max, this.x));
121
121
  return this;
122
122
  }
@@ -127,7 +127,7 @@ export class Point {
127
127
  * @param {number} max - The maximum value for the y coordinate.
128
128
  * @returns {Point} This point instance for chaining.
129
129
  */
130
- clampY(min, max) {
130
+ clampY(min: number, max: number) {
131
131
  this.y = Math.max(min, Math.min(max, this.y));
132
132
  return this;
133
133
  }
@@ -138,7 +138,7 @@ export class Point {
138
138
  * @param {number} max - The maximum value for both coordinates.
139
139
  * @returns {Point} This point instance for chaining.
140
140
  */
141
- clamp(min, max) {
141
+ clamp(min: number, max: number) {
142
142
  this.x = Math.max(min, Math.min(max, this.x));
143
143
  this.y = Math.max(min, Math.min(max, this.y));
144
144
  return this;
@@ -157,7 +157,7 @@ export class Point {
157
157
  * @param {Point} dest - The point to copy coordinates to.
158
158
  * @returns {Point} The destination point.
159
159
  */
160
- copyTo(dest) {
160
+ copyTo(dest: Point) {
161
161
  dest.x = this.x;
162
162
  dest.y = this.y;
163
163
  return dest;
@@ -168,7 +168,7 @@ export class Point {
168
168
  * @param {Point} b - The other point to calculate the distance to.
169
169
  * @returns {number} The distance between the two points.
170
170
  */
171
- distance(b) {
171
+ distance(b: Point) {
172
172
  return distance(this, b);
173
173
  }
174
174
 
@@ -177,7 +177,7 @@ export class Point {
177
177
  * @param {Point} a - The other point to compare with.
178
178
  * @returns {boolean} True if the points have the same coordinates, false otherwise.
179
179
  */
180
- equals(a) {
180
+ equals(a: Point) {
181
181
  return a.x === this.x && a.y === this.y;
182
182
  }
183
183
 
@@ -187,7 +187,7 @@ export class Point {
187
187
  * @param {boolean} asDegrees - Whether to return the result in degrees (default: false).
188
188
  * @returns {number} The angle between the two points in radians or degrees.
189
189
  */
190
- angle(a, asDegrees = false) {
190
+ angle(a: Point, asDegrees: boolean = false) {
191
191
  if (asDegrees) {
192
192
  return (180 / Math.PI) * Math.atan2(a.y - this.y, a.x - this.x);
193
193
  }
@@ -203,7 +203,7 @@ export class Point {
203
203
  * @param {number | null | undefined} dist - The distance to rotate from (default: null).
204
204
  * @returns {Point} This point instance for chaining.
205
205
  */
206
- rotate(x, y, angle, asDegrees, dist = null) {
206
+ rotate(x: number, y: number, angle: number, asDegrees: boolean, dist: number | null | undefined = null) {
207
207
  return rotate(this, x, y, angle, asDegrees, dist);
208
208
  }
209
209
 
@@ -228,7 +228,7 @@ export class Point {
228
228
  * @param {number} magnitude - The new magnitude for the point.
229
229
  * @returns {Point} This point instance for chaining.
230
230
  */
231
- setMagnitude(magnitude) {
231
+ setMagnitude(magnitude: number) {
232
232
  return this.normalize().multiply(magnitude, magnitude);
233
233
  }
234
234
 
@@ -258,7 +258,7 @@ export class Point {
258
258
  * @param {Point} a - The other point to calculate the dot product with.
259
259
  * @returns {number} The dot product of the two points.
260
260
  */
261
- dot(a) {
261
+ dot(a: Point) {
262
262
  return this.x * a.x + this.y * a.y;
263
263
  }
264
264
 
@@ -267,7 +267,7 @@ export class Point {
267
267
  * @param {Point} a - The other point to calculate the cross product with.
268
268
  * @returns {number} The cross product of the two points.
269
269
  */
270
- cross(a) {
270
+ cross(a: Point) {
271
271
  return this.x * a.y - this.y * a.x;
272
272
  }
273
273
 
@@ -13,7 +13,7 @@ export class Polygon {
13
13
  * Creates a new Polygon instance.
14
14
  * @param {object[]} points - The array of points to define the polygon (optional).
15
15
  */
16
- constructor(points = null) {
16
+ constructor(points: any[] = null) {
17
17
  /** @type {number} */
18
18
  this.area = 0;
19
19
  /** @type {Point[]} */
@@ -34,7 +34,7 @@ export class Polygon {
34
34
  * @param {number[]} output - The array to store the result in (optional).
35
35
  * @returns {number[]} An array of numbers representing the polygon's points.
36
36
  */
37
- toNumberArray(output = []) {
37
+ toNumberArray(output: number[] = []) {
38
38
  for (let i = 0; i < this._points.length; i += 1) {
39
39
  if (typeof this._points[i] === 'number') {
40
40
  output.push(this._points[i]);
@@ -72,7 +72,7 @@ export class Polygon {
72
72
  * @param {number} y - The y coordinate of the point to check.
73
73
  * @returns {boolean} True if the point is contained within this polygon, false otherwise.
74
74
  */
75
- contains(x, y) {
75
+ contains(x: number, y: number) {
76
76
  // Adapted from http://www.ecse.rpi.edu/Homepages/wrf/Research/Short_Notes/pnpoly.html by Jonas Raoni Soares Silva
77
77
  let inside = false;
78
78
  if (this.flattened) {
@@ -104,7 +104,7 @@ export class Polygon {
104
104
  * @param {object[]} points - The array of points to define the polygon.
105
105
  * @returns {Polygon} This polygon instance for chaining.
106
106
  */
107
- setTo(points) {
107
+ setTo(points: any[]) {
108
108
  this.area = 0;
109
109
  this._points = [];
110
110
  if (points) {
@@ -143,7 +143,7 @@ export class Polygon {
143
143
  * @param {number} y0 - The y coordinate of the lowest boundary (internal use).
144
144
  * @returns {number} The area of this polygon.
145
145
  */
146
- calculateArea(y0) {
146
+ calculateArea(y0: number) {
147
147
  let p1;
148
148
  let p2;
149
149
  let avgHeight;
@@ -38,7 +38,7 @@ export class Rectangle {
38
38
  * @param {number} width - The width of the rectangle (default: 0).
39
39
  * @param {number} height - The height of the rectangle (default: 0).
40
40
  */
41
- constructor(x = 0, y = 0, width = 0, height = 0) {
41
+ constructor(x: number = 0, y: number = 0, width: number = 0, height: number = 0) {
42
42
  /** @type {number} */
43
43
  this.x = x;
44
44
  /** @type {number} */
@@ -57,7 +57,7 @@ export class Rectangle {
57
57
  * @param {number} dy - The amount to offset the y coordinate by.
58
58
  * @returns {Rectangle} This rectangle instance for chaining.
59
59
  */
60
- offset(dx, dy) {
60
+ offset(dx: number, dy: number) {
61
61
  this.x += dx;
62
62
  this.y += dy;
63
63
  return this;
@@ -68,7 +68,7 @@ export class Rectangle {
68
68
  * @param {Point} point - The point to offset the rectangle by.
69
69
  * @returns {Rectangle} This rectangle instance for chaining.
70
70
  */
71
- offsetPoint(point) {
71
+ offsetPoint(point: Point) {
72
72
  return this.offset(point.x, point.y);
73
73
  }
74
74
 
@@ -80,7 +80,7 @@ export class Rectangle {
80
80
  * @param {number} height - The new height of the rectangle.
81
81
  * @returns {Rectangle} This rectangle instance for chaining.
82
82
  */
83
- setTo(x, y, width, height) {
83
+ setTo(x: number, y: number, width: number, height: number) {
84
84
  this.x = x;
85
85
  this.y = y;
86
86
  this.width = width;
@@ -94,7 +94,7 @@ export class Rectangle {
94
94
  * @param {number} y - The amount to scale the height by (default: x).
95
95
  * @returns {Rectangle} This rectangle instance for chaining.
96
96
  */
97
- scale(x, y?) {
97
+ scale(x: number, y?: number) {
98
98
  if (y === undefined) {
99
99
  y = x;
100
100
  }
@@ -109,7 +109,7 @@ export class Rectangle {
109
109
  * @param {number} y - The y coordinate to center the rectangle on.
110
110
  * @returns {Rectangle} This rectangle instance for chaining.
111
111
  */
112
- centerOn(x, y) {
112
+ centerOn(x: number, y: number) {
113
113
  this.centerX = x;
114
114
  this.centerY = y;
115
115
  return this;
@@ -156,7 +156,7 @@ export class Rectangle {
156
156
  * @param {Rectangle} source - The rectangle to copy values from.
157
157
  * @returns {Rectangle} This rectangle instance for chaining.
158
158
  */
159
- copyFrom(source) {
159
+ copyFrom(source: Rectangle) {
160
160
  return this.setTo(source.x, source.y, source.width, source.height);
161
161
  }
162
162
 
@@ -165,7 +165,7 @@ export class Rectangle {
165
165
  * @param {Rectangle} dest - The rectangle to copy values to.
166
166
  * @returns {Rectangle} The destination rectangle.
167
167
  */
168
- copyTo(dest) {
168
+ copyTo(dest: Rectangle) {
169
169
  dest.x = this.x;
170
170
  dest.y = this.y;
171
171
  dest.width = this.width;
@@ -179,7 +179,7 @@ export class Rectangle {
179
179
  * @param {number} dy - The amount to increase the height by.
180
180
  * @returns {Rectangle} This rectangle instance for chaining.
181
181
  */
182
- inflate(dx, dy) {
182
+ inflate(dx: number, dy: number) {
183
183
  return inflate(this, dx, dy);
184
184
  }
185
185
 
@@ -188,7 +188,7 @@ export class Rectangle {
188
188
  * @param {Point} output - The point to store the size in (optional).
189
189
  * @returns {Point} The size of the rectangle as a point.
190
190
  */
191
- size(output) {
191
+ size(output: Point) {
192
192
  return size(this, output);
193
193
  }
194
194
 
@@ -198,7 +198,7 @@ export class Rectangle {
198
198
  * @param {number} height - The new height of the rectangle.
199
199
  * @returns {Rectangle} This rectangle instance for chaining.
200
200
  */
201
- resize(width, height) {
201
+ resize(width: number, height: number) {
202
202
  this.width = width;
203
203
  this.height = height;
204
204
  return this;
@@ -209,7 +209,7 @@ export class Rectangle {
209
209
  * @param {Rectangle} output - The rectangle to store the clone in (optional).
210
210
  * @returns {Rectangle} A new rectangle with the same values as this one.
211
211
  */
212
- clone(output?) {
212
+ clone(output?: Rectangle) {
213
213
  return clone(this, output);
214
214
  }
215
215
 
@@ -219,7 +219,7 @@ export class Rectangle {
219
219
  * @param {number} y - The y coordinate of the point to check.
220
220
  * @returns {boolean} True if the point is contained within this rectangle, false otherwise.
221
221
  */
222
- contains(x, y) {
222
+ contains(x: number, y: number) {
223
223
  return contains(this, x, y);
224
224
  }
225
225
 
@@ -228,7 +228,7 @@ export class Rectangle {
228
228
  * @param {Rectangle} b - The rectangle to check if it's contained.
229
229
  * @returns {boolean} True if the rectangle is contained within this rectangle, false otherwise.
230
230
  */
231
- containsRect(b) {
231
+ containsRect(b: Rectangle) {
232
232
  return containsRect(b, this);
233
233
  }
234
234
 
@@ -237,7 +237,7 @@ export class Rectangle {
237
237
  * @param {Rectangle} b - The rectangle to compare with.
238
238
  * @returns {boolean} True if the rectangles have the same values, false otherwise.
239
239
  */
240
- equals(b) {
240
+ equals(b: Rectangle) {
241
241
  return equals(this, b);
242
242
  }
243
243
 
@@ -247,7 +247,7 @@ export class Rectangle {
247
247
  * @param {Rectangle} out - The rectangle to store the result in (optional).
248
248
  * @returns {Rectangle} The intersection of the two rectangles.
249
249
  */
250
- intersection(b, out?) {
250
+ intersection(b: Rectangle, out?: Rectangle) {
251
251
  return intersection(this, b, out);
252
252
  }
253
253
 
@@ -256,7 +256,7 @@ export class Rectangle {
256
256
  * @param {Rectangle} b - The rectangle to check for intersection with.
257
257
  * @returns {boolean} True if the rectangles intersect, false otherwise.
258
258
  */
259
- intersects(b) {
259
+ intersects(b: Rectangle) {
260
260
  return intersects(this, b);
261
261
  }
262
262
 
@@ -269,7 +269,7 @@ export class Rectangle {
269
269
  * @param {number} tolerance - A tolerance value to use when checking (default: 0).
270
270
  * @returns {boolean} True if the rectangle intersects with the bounds, false otherwise.
271
271
  */
272
- intersectsRaw(left, right, top, bottom, tolerance) {
272
+ intersectsRaw(left: number, right: number, top: number, bottom: number, tolerance: number) {
273
273
  return intersectsRaw(this, left, right, top, bottom, tolerance);
274
274
  }
275
275
 
@@ -279,7 +279,7 @@ export class Rectangle {
279
279
  * @param {Rectangle} out - The rectangle to store the result in (optional).
280
280
  * @returns {Rectangle} The union of the two rectangles.
281
281
  */
282
- union(b, out?) {
282
+ union(b: Rectangle, out?: Rectangle) {
283
283
  return union(this, b, out);
284
284
  }
285
285
 
@@ -288,7 +288,7 @@ export class Rectangle {
288
288
  * @param {Point} output - The point to store the result in (optional).
289
289
  * @returns {Point} A random point within this rectangle.
290
290
  */
291
- random(output = null) {
291
+ random(output: Point = null) {
292
292
  const result = output || new Point();
293
293
  result.x = this.randomX;
294
294
  result.y = this.randomY;
@@ -301,7 +301,7 @@ export class Rectangle {
301
301
  * @param {Point} output - The point to store the result in (optional).
302
302
  * @returns {Point} A point at the specified position on the rectangle.
303
303
  */
304
- getPoint(position, output = null) {
304
+ getPoint(position: number, output: Point = null) {
305
305
  const result = output || new Point();
306
306
  switch (position) {
307
307
  case TOP_LEFT:
@@ -17,7 +17,7 @@ export class RoundedRectangle {
17
17
  * @param {number} height - The height of the rectangle (default: 0).
18
18
  * @param {number} radius - The corner radius (default: 20).
19
19
  */
20
- constructor(x = 0, y = 0, width = 0, height = 0, radius = 20) {
20
+ constructor(x: number = 0, y: number = 0, width: number = 0, height: number = 0, radius: number = 20) {
21
21
  this.x = x;
22
22
  this.y = y;
23
23
  this.width = width;
@@ -32,7 +32,7 @@ export class RoundedRectangle {
32
32
  * @param {number} y - The y coordinate of the point to check.
33
33
  * @returns {boolean} True if the point is contained within this rounded rectangle, false otherwise.
34
34
  */
35
- contains(x, y) {
35
+ contains(x: number, y: number) {
36
36
  if (this.width <= 0 || this.height <= 0) {
37
37
  return false;
38
38
  }