@vpmedia/phaser 1.103.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 (298) hide show
  1. package/dist/index.js +997 -403
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts +35 -11
  4. package/dist/phaser/core/animation.d.ts.map +1 -1
  5. package/dist/phaser/core/animation_manager.d.ts +20 -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 +68 -60
  12. package/dist/phaser/core/cache.d.ts.map +1 -1
  13. package/dist/phaser/core/device.d.ts +23 -0
  14. package/dist/phaser/core/device.d.ts.map +1 -1
  15. package/dist/phaser/core/device_util.d.ts +10 -10
  16. package/dist/phaser/core/device_util.d.ts.map +1 -1
  17. package/dist/phaser/core/dom.d.ts +6 -5
  18. package/dist/phaser/core/dom.d.ts.map +1 -1
  19. package/dist/phaser/core/event_manager.d.ts +49 -158
  20. package/dist/phaser/core/event_manager.d.ts.map +1 -1
  21. package/dist/phaser/core/factory.d.ts +8 -7
  22. package/dist/phaser/core/factory.d.ts.map +1 -1
  23. package/dist/phaser/core/frame.d.ts +27 -48
  24. package/dist/phaser/core/frame.d.ts.map +1 -1
  25. package/dist/phaser/core/frame_data.d.ts +11 -58
  26. package/dist/phaser/core/frame_data.d.ts.map +1 -1
  27. package/dist/phaser/core/frame_util.d.ts +4 -14
  28. package/dist/phaser/core/frame_util.d.ts.map +1 -1
  29. package/dist/phaser/core/game.d.ts +50 -3
  30. package/dist/phaser/core/game.d.ts.map +1 -1
  31. package/dist/phaser/core/input.d.ts +66 -13
  32. package/dist/phaser/core/input.d.ts.map +1 -1
  33. package/dist/phaser/core/input_handler.d.ts +64 -20
  34. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  35. package/dist/phaser/core/input_mouse.d.ts +26 -1
  36. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  37. package/dist/phaser/core/input_mspointer.d.ts +18 -2
  38. package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
  39. package/dist/phaser/core/input_pointer.d.ts +53 -9
  40. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  41. package/dist/phaser/core/input_touch.d.ts +19 -1
  42. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  43. package/dist/phaser/core/loader.d.ts +56 -28
  44. package/dist/phaser/core/loader.d.ts.map +1 -1
  45. package/dist/phaser/core/loader_parser.d.ts +4 -4
  46. package/dist/phaser/core/loader_parser.d.ts.map +1 -1
  47. package/dist/phaser/core/raf.d.ts +2 -2
  48. package/dist/phaser/core/raf.d.ts.map +1 -1
  49. package/dist/phaser/core/scale_manager.d.ts +77 -17
  50. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  51. package/dist/phaser/core/scene.d.ts +3 -1
  52. package/dist/phaser/core/scene.d.ts.map +1 -1
  53. package/dist/phaser/core/scene_manager.d.ts +25 -9
  54. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  55. package/dist/phaser/core/signal.d.ts +9 -8
  56. package/dist/phaser/core/signal.d.ts.map +1 -1
  57. package/dist/phaser/core/signal_binding.d.ts +2 -2
  58. package/dist/phaser/core/signal_binding.d.ts.map +1 -1
  59. package/dist/phaser/core/sound.d.ts +58 -10
  60. package/dist/phaser/core/sound.d.ts.map +1 -1
  61. package/dist/phaser/core/sound_manager.d.ts +28 -9
  62. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  63. package/dist/phaser/core/sound_sprite.d.ts +10 -4
  64. package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
  65. package/dist/phaser/core/stage.d.ts +7 -3
  66. package/dist/phaser/core/stage.d.ts.map +1 -1
  67. package/dist/phaser/core/time.d.ts +32 -5
  68. package/dist/phaser/core/time.d.ts.map +1 -1
  69. package/dist/phaser/core/timer.d.ts +30 -10
  70. package/dist/phaser/core/timer.d.ts.map +1 -1
  71. package/dist/phaser/core/timer_event.d.ts +11 -12
  72. package/dist/phaser/core/timer_event.d.ts.map +1 -1
  73. package/dist/phaser/core/tween.d.ts +38 -14
  74. package/dist/phaser/core/tween.d.ts.map +1 -1
  75. package/dist/phaser/core/tween_data.d.ts +30 -5
  76. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  77. package/dist/phaser/core/tween_easing.d.ts +31 -31
  78. package/dist/phaser/core/tween_easing.d.ts.map +1 -1
  79. package/dist/phaser/core/tween_manager.d.ts +8 -4
  80. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  81. package/dist/phaser/core/world.d.ts +1 -1
  82. package/dist/phaser/core/world.d.ts.map +1 -1
  83. package/dist/phaser/display/bitmap_text.d.ts +35 -20
  84. package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
  85. package/dist/phaser/display/button.d.ts +24 -8
  86. package/dist/phaser/display/button.d.ts.map +1 -1
  87. package/dist/phaser/display/canvas/buffer.d.ts +6 -2
  88. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  89. package/dist/phaser/display/canvas/graphics.d.ts +3 -3
  90. package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
  91. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  92. package/dist/phaser/display/canvas/pool.d.ts +2 -2
  93. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  94. package/dist/phaser/display/canvas/renderer.d.ts +18 -5
  95. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  96. package/dist/phaser/display/canvas/tinter.d.ts +3 -3
  97. package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
  98. package/dist/phaser/display/canvas/util.d.ts +9 -9
  99. package/dist/phaser/display/canvas/util.d.ts.map +1 -1
  100. package/dist/phaser/display/display_object.d.ts +82 -23
  101. package/dist/phaser/display/display_object.d.ts.map +1 -1
  102. package/dist/phaser/display/graphics.d.ts +42 -16
  103. package/dist/phaser/display/graphics.d.ts.map +1 -1
  104. package/dist/phaser/display/graphics_data.d.ts +11 -1
  105. package/dist/phaser/display/graphics_data.d.ts.map +1 -1
  106. package/dist/phaser/display/graphics_data_util.d.ts +1 -1
  107. package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
  108. package/dist/phaser/display/group.d.ts +24 -9
  109. package/dist/phaser/display/group.d.ts.map +1 -1
  110. package/dist/phaser/display/image.d.ts +36 -13
  111. package/dist/phaser/display/image.d.ts.map +1 -1
  112. package/dist/phaser/display/sprite_batch.d.ts +1 -1
  113. package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
  114. package/dist/phaser/display/sprite_util.d.ts +5 -5
  115. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  116. package/dist/phaser/display/text.d.ts +86 -66
  117. package/dist/phaser/display/text.d.ts.map +1 -1
  118. package/dist/phaser/display/webgl/abstract_filter.d.ts +8 -1
  119. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  120. package/dist/phaser/display/webgl/base_texture.d.ts +14 -2
  121. package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
  122. package/dist/phaser/display/webgl/blend_manager.d.ts +5 -2
  123. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  124. package/dist/phaser/display/webgl/earcut.d.ts +10 -10
  125. package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
  126. package/dist/phaser/display/webgl/earcut_node.d.ts +1 -1
  127. package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
  128. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +17 -1
  129. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  130. package/dist/phaser/display/webgl/filter_manager.d.ts +5 -1
  131. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  132. package/dist/phaser/display/webgl/filter_texture.d.ts +7 -2
  133. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  134. package/dist/phaser/display/webgl/graphics.d.ts +11 -10
  135. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  136. package/dist/phaser/display/webgl/graphics_data.d.ts +11 -1
  137. package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
  138. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  139. package/dist/phaser/display/webgl/render_texture.d.ts +12 -1
  140. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  141. package/dist/phaser/display/webgl/renderer.d.ts +25 -6
  142. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  143. package/dist/phaser/display/webgl/shader/complex.d.ts +7 -1
  144. package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
  145. package/dist/phaser/display/webgl/shader/fast.d.ts +8 -1
  146. package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
  147. package/dist/phaser/display/webgl/shader/normal.d.ts +11 -0
  148. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  149. package/dist/phaser/display/webgl/shader/primitive.d.ts +7 -1
  150. package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
  151. package/dist/phaser/display/webgl/shader/strip.d.ts +7 -1
  152. package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
  153. package/dist/phaser/display/webgl/shader_manager.d.ts +14 -2
  154. package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
  155. package/dist/phaser/display/webgl/sprite_batch.d.ts +19 -2
  156. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  157. package/dist/phaser/display/webgl/stencil_manager.d.ts +8 -4
  158. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  159. package/dist/phaser/display/webgl/texture.d.ts +35 -2
  160. package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
  161. package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
  162. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  163. package/dist/phaser/display/webgl/util.d.ts +6 -6
  164. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  165. package/dist/phaser/geom/circle.d.ts +11 -10
  166. package/dist/phaser/geom/circle.d.ts.map +1 -1
  167. package/dist/phaser/geom/ellipse.d.ts +6 -5
  168. package/dist/phaser/geom/ellipse.d.ts.map +1 -1
  169. package/dist/phaser/geom/line.d.ts +14 -14
  170. package/dist/phaser/geom/line.d.ts.map +1 -1
  171. package/dist/phaser/geom/matrix.d.ts +13 -12
  172. package/dist/phaser/geom/matrix.d.ts.map +1 -1
  173. package/dist/phaser/geom/point.d.ts +19 -19
  174. package/dist/phaser/geom/point.d.ts.map +1 -1
  175. package/dist/phaser/geom/polygon.d.ts +6 -6
  176. package/dist/phaser/geom/polygon.d.ts.map +1 -1
  177. package/dist/phaser/geom/rectangle.d.ts +20 -20
  178. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  179. package/dist/phaser/geom/rounded_rectangle.d.ts +2 -2
  180. package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
  181. package/dist/phaser/geom/util/circle.d.ts +9 -7
  182. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  183. package/dist/phaser/geom/util/ellipse.d.ts +1 -1
  184. package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
  185. package/dist/phaser/geom/util/line.d.ts +5 -3
  186. package/dist/phaser/geom/util/line.d.ts.map +1 -1
  187. package/dist/phaser/geom/util/matrix.d.ts +2 -1
  188. package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
  189. package/dist/phaser/geom/util/point.d.ts +19 -19
  190. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  191. package/dist/phaser/geom/util/polygon.d.ts +2 -1
  192. package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
  193. package/dist/phaser/geom/util/rectangle.d.ts +17 -15
  194. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  195. package/dist/phaser/geom/util/rounded_rectangle.d.ts +2 -1
  196. package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
  197. package/dist/phaser/util/math.d.ts +51 -142
  198. package/dist/phaser/util/math.d.ts.map +1 -1
  199. package/package.json +2 -2
  200. package/src/phaser/core/animation.ts +41 -18
  201. package/src/phaser/core/animation_manager.ts +21 -12
  202. package/src/phaser/core/animation_parser.ts +11 -3
  203. package/src/phaser/core/array_set.ts +8 -8
  204. package/src/phaser/core/cache.ts +75 -60
  205. package/src/phaser/core/device.ts +23 -1
  206. package/src/phaser/core/device_util.ts +10 -10
  207. package/src/phaser/core/dom.ts +5 -5
  208. package/src/phaser/core/event_manager.ts +52 -177
  209. package/src/phaser/core/factory.ts +25 -17
  210. package/src/phaser/core/frame.ts +37 -51
  211. package/src/phaser/core/frame_data.ts +29 -74
  212. package/src/phaser/core/frame_util.ts +3 -16
  213. package/src/phaser/core/game.ts +40 -11
  214. package/src/phaser/core/input.ts +68 -17
  215. package/src/phaser/core/input_handler.ts +81 -45
  216. package/src/phaser/core/input_mouse.ts +42 -13
  217. package/src/phaser/core/input_mspointer.ts +24 -9
  218. package/src/phaser/core/input_pointer.ts +55 -12
  219. package/src/phaser/core/input_touch.ts +26 -9
  220. package/src/phaser/core/loader.ts +97 -42
  221. package/src/phaser/core/loader_parser.ts +6 -7
  222. package/src/phaser/core/raf.ts +2 -2
  223. package/src/phaser/core/scale_manager.ts +85 -27
  224. package/src/phaser/core/scene.ts +3 -2
  225. package/src/phaser/core/scene_manager.ts +26 -11
  226. package/src/phaser/core/signal.ts +10 -10
  227. package/src/phaser/core/signal_binding.ts +2 -2
  228. package/src/phaser/core/sound.ts +72 -26
  229. package/src/phaser/core/sound_manager.ts +31 -13
  230. package/src/phaser/core/sound_sprite.ts +10 -5
  231. package/src/phaser/core/stage.ts +8 -4
  232. package/src/phaser/core/time.ts +33 -7
  233. package/src/phaser/core/timer.ts +40 -14
  234. package/src/phaser/core/timer_event.ts +23 -14
  235. package/src/phaser/core/tween.ts +43 -23
  236. package/src/phaser/core/tween_data.ts +31 -7
  237. package/src/phaser/core/tween_easing.ts +31 -31
  238. package/src/phaser/core/tween_manager.ts +10 -7
  239. package/src/phaser/core/world.ts +1 -2
  240. package/src/phaser/display/bitmap_text.ts +41 -18
  241. package/src/phaser/display/button.ts +24 -23
  242. package/src/phaser/display/canvas/buffer.ts +6 -3
  243. package/src/phaser/display/canvas/graphics.ts +3 -4
  244. package/src/phaser/display/canvas/masker.ts +2 -3
  245. package/src/phaser/display/canvas/pool.ts +3 -4
  246. package/src/phaser/display/canvas/renderer.ts +19 -7
  247. package/src/phaser/display/canvas/tinter.ts +4 -5
  248. package/src/phaser/display/canvas/util.ts +9 -9
  249. package/src/phaser/display/display_object.ts +120 -61
  250. package/src/phaser/display/graphics.ts +56 -25
  251. package/src/phaser/display/graphics_data.ts +11 -2
  252. package/src/phaser/display/graphics_data_util.ts +1 -2
  253. package/src/phaser/display/group.ts +32 -14
  254. package/src/phaser/display/image.ts +37 -19
  255. package/src/phaser/display/sprite_batch.ts +1 -2
  256. package/src/phaser/display/sprite_util.ts +5 -6
  257. package/src/phaser/display/text.ts +82 -56
  258. package/src/phaser/display/webgl/abstract_filter.ts +8 -2
  259. package/src/phaser/display/webgl/base_texture.ts +14 -3
  260. package/src/phaser/display/webgl/blend_manager.ts +5 -3
  261. package/src/phaser/display/webgl/earcut.ts +27 -27
  262. package/src/phaser/display/webgl/earcut_node.ts +1 -1
  263. package/src/phaser/display/webgl/fast_sprite_batch.ts +19 -4
  264. package/src/phaser/display/webgl/filter_manager.ts +5 -2
  265. package/src/phaser/display/webgl/filter_texture.ts +7 -3
  266. package/src/phaser/display/webgl/graphics.ts +10 -11
  267. package/src/phaser/display/webgl/graphics_data.ts +11 -2
  268. package/src/phaser/display/webgl/mask_manager.ts +2 -3
  269. package/src/phaser/display/webgl/render_texture.ts +12 -2
  270. package/src/phaser/display/webgl/renderer.ts +24 -7
  271. package/src/phaser/display/webgl/shader/complex.ts +7 -2
  272. package/src/phaser/display/webgl/shader/fast.ts +8 -2
  273. package/src/phaser/display/webgl/shader/normal.ts +12 -2
  274. package/src/phaser/display/webgl/shader/primitive.ts +7 -2
  275. package/src/phaser/display/webgl/shader/strip.ts +7 -2
  276. package/src/phaser/display/webgl/shader_manager.ts +13 -3
  277. package/src/phaser/display/webgl/sprite_batch.ts +20 -4
  278. package/src/phaser/display/webgl/stencil_manager.ts +8 -5
  279. package/src/phaser/display/webgl/texture.ts +35 -4
  280. package/src/phaser/display/webgl/texture_util.ts +2 -3
  281. package/src/phaser/display/webgl/util.ts +6 -6
  282. package/src/phaser/geom/circle.ts +10 -10
  283. package/src/phaser/geom/ellipse.ts +6 -6
  284. package/src/phaser/geom/line.ts +14 -14
  285. package/src/phaser/geom/matrix.ts +12 -12
  286. package/src/phaser/geom/point.ts +19 -19
  287. package/src/phaser/geom/polygon.ts +5 -5
  288. package/src/phaser/geom/rectangle.ts +21 -21
  289. package/src/phaser/geom/rounded_rectangle.ts +2 -2
  290. package/src/phaser/geom/util/circle.ts +7 -7
  291. package/src/phaser/geom/util/ellipse.ts +1 -1
  292. package/src/phaser/geom/util/line.ts +5 -5
  293. package/src/phaser/geom/util/matrix.ts +1 -1
  294. package/src/phaser/geom/util/point.ts +20 -20
  295. package/src/phaser/geom/util/polygon.ts +1 -1
  296. package/src/phaser/geom/util/rectangle.ts +15 -15
  297. package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
  298. package/src/phaser/util/math.ts +65 -151
@@ -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
  }
@@ -8,7 +8,7 @@ import { Point } from '../point.js';
8
8
  * @param {Circle} output - Optional circle to store the result in.
9
9
  * @returns {Circle} The cloned circle.
10
10
  */
11
- export const clone = (input, output = null) => {
11
+ export const clone = (input: Circle, output: Circle = null) => {
12
12
  const result = output || new Circle();
13
13
  result.x = input.x;
14
14
  result.y = input.y;
@@ -23,7 +23,7 @@ export const clone = (input, output = null) => {
23
23
  * @param {number} y - The y coordinate of the point.
24
24
  * @returns {boolean} True if the point is contained within the circle, false otherwise.
25
25
  */
26
- export const contains = (a, x, y) => {
26
+ export const contains = (a: Circle, x: number, y: number) => {
27
27
  if (a.radius > 0 && x >= a.left && x <= a.right && y >= a.top && y <= a.bottom) {
28
28
  const dx = (a.x - x) * (a.x - x);
29
29
  const dy = (a.y - y) * (a.y - y);
@@ -38,7 +38,7 @@ export const contains = (a, x, y) => {
38
38
  * @param {Circle} b - The second circle to compare.
39
39
  * @returns {boolean} True if the circles are equal, false otherwise.
40
40
  */
41
- export const equals = (a, b) => {
41
+ export const equals = (a: Circle, b: Circle) => {
42
42
  return a.x === b.x && a.y === b.y && a.diameter === b.diameter;
43
43
  };
44
44
 
@@ -48,7 +48,7 @@ export const equals = (a, b) => {
48
48
  * @param {Circle} b - The second circle to check.
49
49
  * @returns {boolean} True if the circles intersect, false otherwise.
50
50
  */
51
- export const intersects = (a, b) => {
51
+ export const intersects = (a: Circle, b: Circle) => {
52
52
  return distance(a.x, a.y, b.x, b.y) <= a.radius + b.radius;
53
53
  };
54
54
 
@@ -60,7 +60,7 @@ export const intersects = (a, b) => {
60
60
  * @param {Point} output - Optional point to store the result in.
61
61
  * @returns {Point} The point on the circumference of the circle.
62
62
  */
63
- export const circumferencePoint = (a, angle, asDegrees = false, output = null) => {
63
+ export const circumferencePoint = (a: Circle, angle: number, asDegrees: boolean = false, output: Point = null) => {
64
64
  const result = output || new Point();
65
65
  if (asDegrees === true) {
66
66
  angle = degToRad(angle);
@@ -78,7 +78,7 @@ export const circumferencePoint = (a, angle, asDegrees = false, output = null) =
78
78
  * @param {Point} output - Optional point to store the result in.
79
79
  * @returns {Point} The point on the circumference of the circle.
80
80
  */
81
- export const intersectsPoint = (a, angle, asDegrees = false, output = null) => {
81
+ export const intersectsPoint = (a: Circle, angle: number, asDegrees: boolean = false, output: Point = null) => {
82
82
  const result = output || new Point();
83
83
  if (asDegrees === true) {
84
84
  angle = degToRad(angle);
@@ -94,7 +94,7 @@ export const intersectsPoint = (a, angle, asDegrees = false, output = null) => {
94
94
  * @param {object} r - The rectangle to check.
95
95
  * @returns {boolean} True if the circle intersects with the rectangle, false otherwise.
96
96
  */
97
- export const intersectsRectangle = (c, r) => {
97
+ export const intersectsRectangle = (c: Circle, r: any) => {
98
98
  const cx = Math.abs(c.x - r.x - r.halfWidth);
99
99
  const xDist = r.halfWidth + c.radius;
100
100
  if (cx > xDist) {
@@ -5,7 +5,7 @@
5
5
  * @param {number} y - The y coordinate of the point.
6
6
  * @returns {boolean} True if the point is contained within the ellipse, false otherwise.
7
7
  */
8
- export const contains = (a, x, y) => {
8
+ export const contains = (a: import('../ellipse.js').Ellipse, x: number, y: number) => {
9
9
  if (a.width <= 0 || a.height <= 0) {
10
10
  return false;
11
11
  }
@@ -8,7 +8,7 @@ import { intersects as intersectsRect } from './rectangle.js';
8
8
  * @param {Line} output - Optional line to store the result in.
9
9
  * @returns {Line} The cloned line.
10
10
  */
11
- export const clone = (input, output = null) => {
11
+ export const clone = (input: Line, output: Line = null) => {
12
12
  const result = output || new Line();
13
13
  result.start.x = input.start.x;
14
14
  result.start.y = input.start.y;
@@ -27,7 +27,7 @@ export const clone = (input, output = null) => {
27
27
  * @param {Point} output - Optional point to store the result in.
28
28
  * @returns {Point} The intersection point, or null if there is no intersection.
29
29
  */
30
- export const intersectsPoints = (a, b, e, f, asSegment = true, output = null) => {
30
+ export const intersectsPoints = (a: any, b: any, e: any, f: any, asSegment: boolean = true, output: Point = null) => {
31
31
  const result = output || new Point();
32
32
  const a1 = b.y - a.y;
33
33
  const a2 = f.y - e.y;
@@ -61,7 +61,7 @@ export const intersectsPoints = (a, b, e, f, asSegment = true, output = null) =>
61
61
  * @param {Point} result - Optional point to store the result in.
62
62
  * @returns {Point} The intersection point, or null if there is no intersection.
63
63
  */
64
- export const intersects = (a, b, asSegment, result) => {
64
+ export const intersects = (a: any, b: any, asSegment: boolean, result: Point) => {
65
65
  return intersectsPoints(a.start, a.end, b.start, b.end, asSegment, result);
66
66
  };
67
67
 
@@ -71,7 +71,7 @@ export const intersects = (a, b, asSegment, result) => {
71
71
  * @param {object} rect - The rectangle to check (with x, y, width, height properties).
72
72
  * @returns {boolean} True if the line intersects with the rectangle, false otherwise.
73
73
  */
74
- export const intersectsRectangle = (line, rect) => {
74
+ export const intersectsRectangle = (line: any, rect: any) => {
75
75
  // Quick bail out of the Line and Rect bounds don't intersect
76
76
  if (!intersectsRect(line, rect)) {
77
77
  return false;
@@ -125,6 +125,6 @@ export const intersectsRectangle = (line, rect) => {
125
125
  * @param {object} b - The second point (with x, y properties).
126
126
  * @returns {number} The distance between the points.
127
127
  */
128
- export const reflect = (a, b) => {
128
+ export const reflect = (a: any, b: any) => {
129
129
  return 2 * b.normalAngle - 3.141592653589793 - a.angle;
130
130
  };
@@ -6,7 +6,7 @@ import { Matrix } from '../matrix.js';
6
6
  * @param {Matrix} output - Optional matrix to store the result in.
7
7
  * @returns {Matrix} The cloned matrix.
8
8
  */
9
- export const clone = (input, output = null) => {
9
+ export const clone = (input: Matrix, output: Matrix = null) => {
10
10
  const result = output || new Matrix();
11
11
  result.a = input.a;
12
12
  result.b = input.b;