@vpmedia/phaser 1.123.0 → 1.124.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 (206) hide show
  1. package/dist/index.js +339 -323
  2. package/dist/index.js.map +1 -1
  3. package/dist/phaser/core/animation.d.ts +3 -3
  4. package/dist/phaser/core/animation.d.ts.map +1 -1
  5. package/dist/phaser/core/animation_manager.d.ts.map +1 -1
  6. package/dist/phaser/core/animation_parser.d.ts +27 -2
  7. package/dist/phaser/core/animation_parser.d.ts.map +1 -1
  8. package/dist/phaser/core/array_set.d.ts +11 -11
  9. package/dist/phaser/core/array_set.d.ts.map +1 -1
  10. package/dist/phaser/core/cache.d.ts.map +1 -1
  11. package/dist/phaser/core/callback.d.ts.map +1 -1
  12. package/dist/phaser/core/dom.d.ts +125 -19
  13. package/dist/phaser/core/dom.d.ts.map +1 -1
  14. package/dist/phaser/core/factory.d.ts +3 -2
  15. package/dist/phaser/core/factory.d.ts.map +1 -1
  16. package/dist/phaser/core/input.d.ts +3 -2
  17. package/dist/phaser/core/input.d.ts.map +1 -1
  18. package/dist/phaser/core/input_handler.d.ts.map +1 -1
  19. package/dist/phaser/core/input_mouse.d.ts +5 -1
  20. package/dist/phaser/core/input_mouse.d.ts.map +1 -1
  21. package/dist/phaser/core/input_pointer.d.ts +3 -3
  22. package/dist/phaser/core/input_pointer.d.ts.map +1 -1
  23. package/dist/phaser/core/input_touch.d.ts +8 -8
  24. package/dist/phaser/core/input_touch.d.ts.map +1 -1
  25. package/dist/phaser/core/loader.d.ts +11 -2
  26. package/dist/phaser/core/loader.d.ts.map +1 -1
  27. package/dist/phaser/core/loader_parser.d.ts +14 -1
  28. package/dist/phaser/core/loader_parser.d.ts.map +1 -1
  29. package/dist/phaser/core/raf.d.ts +1 -1
  30. package/dist/phaser/core/raf.d.ts.map +1 -1
  31. package/dist/phaser/core/scale_manager.d.ts.map +1 -1
  32. package/dist/phaser/core/scene_manager.d.ts.map +1 -1
  33. package/dist/phaser/core/signal.d.ts.map +1 -1
  34. package/dist/phaser/core/sound.d.ts.map +1 -1
  35. package/dist/phaser/core/sound_manager.d.ts +1 -1
  36. package/dist/phaser/core/sound_manager.d.ts.map +1 -1
  37. package/dist/phaser/core/stage.d.ts +16 -6
  38. package/dist/phaser/core/stage.d.ts.map +1 -1
  39. package/dist/phaser/core/time.d.ts.map +1 -1
  40. package/dist/phaser/core/timer.d.ts +1 -1
  41. package/dist/phaser/core/timer.d.ts.map +1 -1
  42. package/dist/phaser/core/tween.d.ts +13 -5
  43. package/dist/phaser/core/tween.d.ts.map +1 -1
  44. package/dist/phaser/core/tween_data.d.ts +9 -7
  45. package/dist/phaser/core/tween_data.d.ts.map +1 -1
  46. package/dist/phaser/core/tween_manager.d.ts.map +1 -1
  47. package/dist/phaser/display/button.d.ts +6 -5
  48. package/dist/phaser/display/button.d.ts.map +1 -1
  49. package/dist/phaser/display/canvas/buffer.d.ts +1 -1
  50. package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
  51. package/dist/phaser/display/canvas/masker.d.ts +1 -1
  52. package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
  53. package/dist/phaser/display/canvas/pool.d.ts +2 -2
  54. package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
  55. package/dist/phaser/display/canvas/renderer.d.ts +9 -8
  56. package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
  57. package/dist/phaser/display/display_object.d.ts +3 -1
  58. package/dist/phaser/display/display_object.d.ts.map +1 -1
  59. package/dist/phaser/display/graphics.d.ts +1 -1
  60. package/dist/phaser/display/graphics.d.ts.map +1 -1
  61. package/dist/phaser/display/group.d.ts +1 -1
  62. package/dist/phaser/display/group.d.ts.map +1 -1
  63. package/dist/phaser/display/image.d.ts +6 -5
  64. package/dist/phaser/display/image.d.ts.map +1 -1
  65. package/dist/phaser/display/sprite_util.d.ts +3 -2
  66. package/dist/phaser/display/sprite_util.d.ts.map +1 -1
  67. package/dist/phaser/display/text.d.ts +2 -16
  68. package/dist/phaser/display/text.d.ts.map +1 -1
  69. package/dist/phaser/display/webgl/abstract_filter.d.ts +14 -8
  70. package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
  71. package/dist/phaser/display/webgl/blend_manager.d.ts +2 -3
  72. package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
  73. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +11 -5
  74. package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
  75. package/dist/phaser/display/webgl/filter_manager.d.ts +6 -4
  76. package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
  77. package/dist/phaser/display/webgl/filter_texture.d.ts +4 -4
  78. package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
  79. package/dist/phaser/display/webgl/graphics.d.ts +2 -2
  80. package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
  81. package/dist/phaser/display/webgl/mask_manager.d.ts +3 -2
  82. package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
  83. package/dist/phaser/display/webgl/render_texture.d.ts +11 -8
  84. package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
  85. package/dist/phaser/display/webgl/renderer.d.ts +8 -4
  86. package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
  87. package/dist/phaser/display/webgl/shader/normal.d.ts +28 -3
  88. package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
  89. package/dist/phaser/display/webgl/sprite_batch.d.ts +6 -5
  90. package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
  91. package/dist/phaser/display/webgl/stencil_manager.d.ts +3 -3
  92. package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
  93. package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
  94. package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
  95. package/dist/phaser/display/webgl/util.d.ts +1 -1
  96. package/dist/phaser/display/webgl/util.d.ts.map +1 -1
  97. package/dist/phaser/geom/circle.d.ts.map +1 -1
  98. package/dist/phaser/geom/line.d.ts +10 -1
  99. package/dist/phaser/geom/line.d.ts.map +1 -1
  100. package/dist/phaser/geom/rectangle.d.ts.map +1 -1
  101. package/dist/phaser/geom/util/circle.d.ts +2 -1
  102. package/dist/phaser/geom/util/circle.d.ts.map +1 -1
  103. package/dist/phaser/geom/util/point.d.ts +1 -1
  104. package/dist/phaser/geom/util/point.d.ts.map +1 -1
  105. package/dist/phaser/geom/util/rectangle.d.ts +1 -1
  106. package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
  107. package/dist/phaser/util/math.d.ts.map +1 -1
  108. package/package.json +1 -1
  109. package/src/phaser/core/animation.ts +4 -4
  110. package/src/phaser/core/animation_manager.ts +10 -10
  111. package/src/phaser/core/animation_parser.ts +30 -24
  112. package/src/phaser/core/array_set.ts +27 -27
  113. package/src/phaser/core/cache.test.ts +33 -33
  114. package/src/phaser/core/cache.ts +3 -3
  115. package/src/phaser/core/callback.ts +1 -0
  116. package/src/phaser/core/callback_context.test.ts +8 -8
  117. package/src/phaser/core/dom.ts +15 -5
  118. package/src/phaser/core/factory.ts +9 -2
  119. package/src/phaser/core/frame_data.test.ts +23 -23
  120. package/src/phaser/core/input.ts +9 -8
  121. package/src/phaser/core/input_handler.test.ts +18 -18
  122. package/src/phaser/core/input_handler.ts +1 -1
  123. package/src/phaser/core/input_mouse.ts +9 -8
  124. package/src/phaser/core/input_pointer.test.ts +26 -26
  125. package/src/phaser/core/input_pointer.ts +3 -3
  126. package/src/phaser/core/input_touch.ts +8 -8
  127. package/src/phaser/core/loader.test.ts +26 -26
  128. package/src/phaser/core/loader.ts +25 -25
  129. package/src/phaser/core/loader_parser.test.ts +16 -16
  130. package/src/phaser/core/loader_parser.ts +16 -6
  131. package/src/phaser/core/raf.ts +1 -1
  132. package/src/phaser/core/registry.test.ts +6 -6
  133. package/src/phaser/core/scale_manager.ts +2 -2
  134. package/src/phaser/core/scene_manager.test.ts +30 -30
  135. package/src/phaser/core/scene_manager.ts +1 -1
  136. package/src/phaser/core/signal.test.ts +8 -8
  137. package/src/phaser/core/signal.ts +1 -1
  138. package/src/phaser/core/signal_dispatch.test.ts +30 -30
  139. package/src/phaser/core/sound.ts +20 -8
  140. package/src/phaser/core/sound_manager.ts +6 -6
  141. package/src/phaser/core/stage.ts +19 -9
  142. package/src/phaser/core/time.ts +1 -1
  143. package/src/phaser/core/timer.test.ts +47 -47
  144. package/src/phaser/core/timer.ts +1 -1
  145. package/src/phaser/core/tween.ts +28 -25
  146. package/src/phaser/core/tween_data.test.ts +119 -0
  147. package/src/phaser/core/tween_data.ts +54 -39
  148. package/src/phaser/core/tween_easing.test.ts +5 -5
  149. package/src/phaser/core/tween_manager.ts +2 -2
  150. package/src/phaser/display/bitmap_text.test.ts +30 -30
  151. package/src/phaser/display/button.ts +8 -6
  152. package/src/phaser/display/canvas/buffer.ts +2 -2
  153. package/src/phaser/display/canvas/masker.ts +1 -1
  154. package/src/phaser/display/canvas/pool.test.ts +20 -20
  155. package/src/phaser/display/canvas/pool.ts +3 -3
  156. package/src/phaser/display/canvas/renderer.ts +12 -11
  157. package/src/phaser/display/canvas/util.test.ts +25 -25
  158. package/src/phaser/display/display_object.ts +3 -1
  159. package/src/phaser/display/graphics.test.ts +70 -20
  160. package/src/phaser/display/graphics.ts +38 -32
  161. package/src/phaser/display/group.ts +4 -4
  162. package/src/phaser/display/image.ts +28 -25
  163. package/src/phaser/display/sprite_util.ts +3 -2
  164. package/src/phaser/display/text.test.ts +28 -25
  165. package/src/phaser/display/text.ts +21 -18
  166. package/src/phaser/display/webgl/abstract_filter.ts +20 -10
  167. package/src/phaser/display/webgl/blend_manager.ts +4 -5
  168. package/src/phaser/display/webgl/earcut.test.ts +20 -20
  169. package/src/phaser/display/webgl/fast_sprite_batch.ts +21 -16
  170. package/src/phaser/display/webgl/filter_manager.ts +7 -4
  171. package/src/phaser/display/webgl/filter_texture.ts +5 -5
  172. package/src/phaser/display/webgl/graphics.ts +2 -2
  173. package/src/phaser/display/webgl/mask_manager.ts +9 -14
  174. package/src/phaser/display/webgl/render_texture.ts +15 -14
  175. package/src/phaser/display/webgl/renderer.ts +7 -6
  176. package/src/phaser/display/webgl/shader/normal.ts +41 -31
  177. package/src/phaser/display/webgl/shader/shader.test.ts +24 -24
  178. package/src/phaser/display/webgl/shader_manager.test.ts +18 -18
  179. package/src/phaser/display/webgl/sprite_batch.ts +8 -8
  180. package/src/phaser/display/webgl/stencil_manager.ts +4 -4
  181. package/src/phaser/display/webgl/texture_util.ts +2 -2
  182. package/src/phaser/display/webgl/util.ts +1 -1
  183. package/src/phaser/geom/circle.test.ts +38 -38
  184. package/src/phaser/geom/circle.ts +7 -7
  185. package/src/phaser/geom/ellipse.test.ts +12 -12
  186. package/src/phaser/geom/line.test.ts +15 -15
  187. package/src/phaser/geom/line.ts +5 -2
  188. package/src/phaser/geom/matrix.test.ts +31 -31
  189. package/src/phaser/geom/point.test.ts +31 -31
  190. package/src/phaser/geom/polygon.test.ts +27 -27
  191. package/src/phaser/geom/rectangle.test.ts +87 -87
  192. package/src/phaser/geom/rectangle.ts +11 -11
  193. package/src/phaser/geom/rounded_rectangle.test.ts +9 -9
  194. package/src/phaser/geom/util/circle.test.ts +5 -5
  195. package/src/phaser/geom/util/circle.ts +2 -1
  196. package/src/phaser/geom/util/ellipse.test.ts +2 -2
  197. package/src/phaser/geom/util/line.test.ts +2 -2
  198. package/src/phaser/geom/util/matrix.test.ts +4 -4
  199. package/src/phaser/geom/util/point.test.ts +2 -2
  200. package/src/phaser/geom/util/point.ts +1 -1
  201. package/src/phaser/geom/util/polygon.test.ts +2 -2
  202. package/src/phaser/geom/util/rectangle.test.ts +2 -2
  203. package/src/phaser/geom/util/rectangle.ts +1 -1
  204. package/src/phaser/geom/util/rounded_rectangle.test.ts +2 -2
  205. package/src/phaser/util/math.test.ts +41 -41
  206. package/src/phaser/util/math.ts +5 -2
@@ -6,13 +6,13 @@ const square = (): Polygon => new Polygon([new Point(0, 0), new Point(10, 0), ne
6
6
 
7
7
  const triangle = (): Polygon => new Polygon([new Point(0, 0), new Point(10, 0), new Point(0, 10)]);
8
8
 
9
- describe('Polygon', () => {
10
- describe('contains', () => {
11
- it('accepts a point well inside a square', () => {
9
+ describe('Polygon', (): void => {
10
+ describe('contains', (): void => {
11
+ it('accepts a point well inside a square', (): void => {
12
12
  expect(square().contains(5, 5)).toBe(true);
13
13
  });
14
14
 
15
- it('rejects points outside a square on every side', () => {
15
+ it('rejects points outside a square on every side', (): void => {
16
16
  const polygon = square();
17
17
  expect(polygon.contains(-1, 5)).toBe(false);
18
18
  expect(polygon.contains(11, 5)).toBe(false);
@@ -20,13 +20,13 @@ describe('Polygon', () => {
20
20
  expect(polygon.contains(5, 11)).toBe(false);
21
21
  });
22
22
 
23
- it('accepts a point inside a triangle and rejects one in the cut corner', () => {
23
+ it('accepts a point inside a triangle and rejects one in the cut corner', (): void => {
24
24
  const polygon = triangle();
25
25
  expect(polygon.contains(2, 2)).toBe(true);
26
26
  expect(polygon.contains(8, 8)).toBe(false);
27
27
  });
28
28
 
29
- it('agrees with itself once flattened', () => {
29
+ it('agrees with itself once flattened', (): void => {
30
30
  const probes: [number, number][] = [
31
31
  [5, 5],
32
32
  [-1, 5],
@@ -42,7 +42,7 @@ describe('Polygon', () => {
42
42
  }
43
43
  });
44
44
 
45
- it('agrees with itself once flattened for a triangle', () => {
45
+ it('agrees with itself once flattened for a triangle', (): void => {
46
46
  const probes: [number, number][] = [
47
47
  [2, 2],
48
48
  [8, 8],
@@ -57,35 +57,35 @@ describe('Polygon', () => {
57
57
  }
58
58
  });
59
59
 
60
- it('reports false for a polygon with no points', () => {
60
+ it('reports false for a polygon with no points', (): void => {
61
61
  expect(new Polygon().contains(0, 0)).toBe(false);
62
62
  });
63
63
  });
64
64
 
65
- describe('toNumberArray', () => {
66
- it('flattens points to x/y pairs', () => {
65
+ describe('toNumberArray', (): void => {
66
+ it('flattens points to x/y pairs', (): void => {
67
67
  expect(square().toNumberArray()).toStrictEqual([0, 0, 10, 0, 10, 10, 0, 10]);
68
68
  });
69
69
 
70
- it('passes an already flattened polygon through unchanged', () => {
70
+ it('passes an already flattened polygon through unchanged', (): void => {
71
71
  expect(square().flatten().toNumberArray()).toStrictEqual([0, 0, 10, 0, 10, 10, 0, 10]);
72
72
  });
73
73
  });
74
74
 
75
- describe('flatten', () => {
76
- it('marks the polygon flattened and swaps the point representation', () => {
75
+ describe('flatten', (): void => {
76
+ it('marks the polygon flattened and swaps the point representation', (): void => {
77
77
  const polygon = square().flatten();
78
78
  expect(polygon.flattened).toBe(true);
79
- expect(polygon._points.every((value) => typeof value === 'number')).toBe(true);
79
+ expect(polygon._points.every((value): boolean => typeof value === 'number')).toBe(true);
80
80
  });
81
81
  });
82
82
 
83
- describe('setTo', () => {
84
- it('reads a flat list of loose numbers as x/y pairs', () => {
83
+ describe('setTo', (): void => {
84
+ it('reads a flat list of loose numbers as x/y pairs', (): void => {
85
85
  expect(new Polygon([0, 0, 10, 0, 10, 10]).toNumberArray()).toStrictEqual([0, 0, 10, 0, 10, 10]);
86
86
  });
87
87
 
88
- it('reads a list of x/y tuples', () => {
88
+ it('reads a list of x/y tuples', (): void => {
89
89
  expect(
90
90
  new Polygon([
91
91
  [0, 0],
@@ -95,23 +95,23 @@ describe('Polygon', () => {
95
95
  ).toStrictEqual([0, 0, 10, 0, 10, 10]);
96
96
  });
97
97
 
98
- it('reads a list of plain x/y objects', () => {
98
+ it('reads a list of plain x/y objects', (): void => {
99
99
  expect(new Polygon([{ x: 0, y: 0 }, { x: 10, y: 0 }, new Point(10, 10)]).toNumberArray()).toStrictEqual([
100
100
  0, 0, 10, 0, 10, 10,
101
101
  ]);
102
102
  });
103
103
 
104
- it('stores every vertex as a point whatever form it came in as', () => {
105
- expect(new Polygon([0, 0, 10, 0]).points.every((value) => value instanceof Point)).toBe(true);
104
+ it('stores every vertex as a point whatever form it came in as', (): void => {
105
+ expect(new Polygon([0, 0, 10, 0]).points.every((value): boolean => value instanceof Point)).toBe(true);
106
106
  });
107
107
 
108
- it('replaces the previous points', () => {
108
+ it('replaces the previous points', (): void => {
109
109
  const polygon = square();
110
110
  polygon.points = [new Point(1, 1), new Point(2, 2)];
111
111
  expect(polygon.toNumberArray()).toStrictEqual([1, 1, 2, 2]);
112
112
  });
113
113
 
114
- it('empties the polygon when the points are cleared', () => {
114
+ it('empties the polygon when the points are cleared', (): void => {
115
115
  const polygon = square();
116
116
  polygon.points = null;
117
117
  expect(polygon.points).toStrictEqual([]);
@@ -119,18 +119,18 @@ describe('Polygon', () => {
119
119
  });
120
120
  });
121
121
 
122
- describe('calculateArea', () => {
123
- it('measures a square', () => {
122
+ describe('calculateArea', (): void => {
123
+ it('measures a square', (): void => {
124
124
  expect(Math.abs(square().area)).toBe(100);
125
125
  });
126
126
 
127
- it('measures a triangle as half its bounding square', () => {
127
+ it('measures a triangle as half its bounding square', (): void => {
128
128
  expect(Math.abs(triangle().area)).toBe(50);
129
129
  });
130
130
  });
131
131
 
132
- describe('clone', () => {
133
- it('copies the vertices into a detached polygon', () => {
132
+ describe('clone', (): void => {
133
+ it('copies the vertices into a detached polygon', (): void => {
134
134
  const original = square();
135
135
  const copy = original.clone();
136
136
  expect(copy.toNumberArray()).toStrictEqual(original.toNumberArray());
@@ -3,9 +3,9 @@ import { TOP_LEFT } from '../core/const.js';
3
3
  import { Point } from './point.js';
4
4
  import { Rectangle } from './rectangle.js';
5
5
 
6
- describe('Rectangle', () => {
7
- describe('offset()', () => {
8
- it('should update x and y properties when dx and dy are provided', () => {
6
+ describe('Rectangle', (): void => {
7
+ describe('offset()', (): void => {
8
+ it('should update x and y properties when dx and dy are provided', (): void => {
9
9
  const rect = new Rectangle(0, 0, 10, 10);
10
10
  rect.offset(10, 20);
11
11
  expect(rect.x).toBe(10);
@@ -13,8 +13,8 @@ describe('Rectangle', () => {
13
13
  });
14
14
  });
15
15
 
16
- describe('offsetPoint()', () => {
17
- it('should call offset() with point.x and point.y as arguments when a Point object is provided', () => {
16
+ describe('offsetPoint()', (): void => {
17
+ it('should call offset() with point.x and point.y as arguments when a Point object is provided', (): void => {
18
18
  const rect = new Rectangle(0, 0, 10, 10);
19
19
  const point = new Point(15, 25);
20
20
  rect.offsetPoint(point);
@@ -23,8 +23,8 @@ describe('Rectangle', () => {
23
23
  });
24
24
  });
25
25
 
26
- describe('setTo()', () => {
27
- it('should update x, y, width and height properties when all arguments are provided', () => {
26
+ describe('setTo()', (): void => {
27
+ it('should update x, y, width and height properties when all arguments are provided', (): void => {
28
28
  const rect = new Rectangle(0, 0, 10, 10);
29
29
  rect.setTo(100, 200, 300, 400);
30
30
  expect(rect.x).toBe(100);
@@ -34,15 +34,15 @@ describe('Rectangle', () => {
34
34
  });
35
35
  });
36
36
 
37
- describe('scale()', () => {
38
- it('should update width and height properties when x is provided', () => {
37
+ describe('scale()', (): void => {
38
+ it('should update width and height properties when x is provided', (): void => {
39
39
  const rect = new Rectangle(0, 0, 10, 10);
40
40
  rect.scale(2);
41
41
  expect(rect.width).toBe(20);
42
42
  expect(rect.height).toBe(20);
43
43
  });
44
44
 
45
- it('should update width and height properties when both x and y are provided', () => {
45
+ it('should update width and height properties when both x and y are provided', (): void => {
46
46
  const rect = new Rectangle(0, 0, 10, 10);
47
47
  const point = new Point(3, 4);
48
48
  rect.scale(point.x, point.y);
@@ -51,8 +51,8 @@ describe('Rectangle', () => {
51
51
  });
52
52
  });
53
53
 
54
- describe('centerOn()', () => {
55
- it('should update centerX and centerY properties when both x and y are provided', () => {
54
+ describe('centerOn()', (): void => {
55
+ it('should update centerX and centerY properties when both x and y are provided', (): void => {
56
56
  const rect = new Rectangle(0, 0, 10, 10);
57
57
  const point = new Point(150, 250);
58
58
  rect.centerOn(point.x, point.y);
@@ -61,8 +61,8 @@ describe('Rectangle', () => {
61
61
  });
62
62
  });
63
63
 
64
- describe('floor()', () => {
65
- it('should update x and y properties by rounding down', () => {
64
+ describe('floor()', (): void => {
65
+ it('should update x and y properties by rounding down', (): void => {
66
66
  const rect = new Rectangle(0, 0, 10, 10);
67
67
  rect.floor();
68
68
  expect(rect.x).toBe(Math.floor(rect.x));
@@ -70,8 +70,8 @@ describe('Rectangle', () => {
70
70
  });
71
71
  });
72
72
 
73
- describe('floorAll()', () => {
74
- it('should update x, y, width and height properties by rounding down', () => {
73
+ describe('floorAll()', (): void => {
74
+ it('should update x, y, width and height properties by rounding down', (): void => {
75
75
  const rect = new Rectangle(0, 0, 10, 10);
76
76
  rect.floorAll();
77
77
  expect(rect.x).toBe(Math.floor(rect.x));
@@ -81,8 +81,8 @@ describe('Rectangle', () => {
81
81
  });
82
82
  });
83
83
 
84
- describe('ceil()', () => {
85
- it('should update x and y properties by rounding up', () => {
84
+ describe('ceil()', (): void => {
85
+ it('should update x and y properties by rounding up', (): void => {
86
86
  const rect = new Rectangle(0, 0, 10, 10);
87
87
  rect.ceil();
88
88
  expect(rect.x).toBe(Math.ceil(rect.x));
@@ -90,8 +90,8 @@ describe('Rectangle', () => {
90
90
  });
91
91
  });
92
92
 
93
- describe('ceilAll()', () => {
94
- it('should update x, y, width and height properties by rounding up', () => {
93
+ describe('ceilAll()', (): void => {
94
+ it('should update x, y, width and height properties by rounding up', (): void => {
95
95
  const rect = new Rectangle(0, 0, 10, 10);
96
96
  rect.ceilAll();
97
97
  expect(rect.x).toBe(Math.ceil(rect.x));
@@ -101,8 +101,8 @@ describe('Rectangle', () => {
101
101
  });
102
102
  });
103
103
 
104
- describe('copyFrom()', () => {
105
- it('should return a new Rectangle object with the same properties as the provided rectangle', () => {
104
+ describe('copyFrom()', (): void => {
105
+ it('should return a new Rectangle object with the same properties as the provided rectangle', (): void => {
106
106
  const rect = new Rectangle(0, 0, 10, 10);
107
107
  const source = new Rectangle();
108
108
  source.setTo(500, 600, 700, 800);
@@ -114,8 +114,8 @@ describe('Rectangle', () => {
114
114
  });
115
115
  });
116
116
 
117
- describe('copyTo()', () => {
118
- it('should update the provided rectangle with the same properties as this rectangle', () => {
117
+ describe('copyTo()', (): void => {
118
+ it('should update the provided rectangle with the same properties as this rectangle', (): void => {
119
119
  const rect = new Rectangle(0, 0, 10, 10);
120
120
  const dest = new Rectangle();
121
121
  rect.setTo(50, 60, 70, 80);
@@ -127,8 +127,8 @@ describe('Rectangle', () => {
127
127
  });
128
128
  });
129
129
 
130
- describe('inflate()', () => {
131
- it('should call the inflate() function from another module with this rectangle and dx and dy as arguments', () => {
130
+ describe('inflate()', (): void => {
131
+ it('should call the inflate() function from another module with this rectangle and dx and dy as arguments', (): void => {
132
132
  const rect = new Rectangle(0, 0, 10, 10);
133
133
  const inflated = rect.inflate(10, 20);
134
134
  expect(inflated.x).toBe(-10);
@@ -136,8 +136,8 @@ describe('Rectangle', () => {
136
136
  });
137
137
  });
138
138
 
139
- describe('size()', () => {
140
- it('should call the size() function from another module with this rectangle and an output point as arguments', () => {
139
+ describe('size()', (): void => {
140
+ it('should call the size() function from another module with this rectangle and an output point as arguments', (): void => {
141
141
  const rect = new Rectangle(0, 0, 10, 10);
142
142
  const point = new Point();
143
143
  const sized = rect.size(point);
@@ -146,8 +146,8 @@ describe('Rectangle', () => {
146
146
  });
147
147
  });
148
148
 
149
- describe('resize()', () => {
150
- it('should update width and height properties when both x and y are provided', () => {
149
+ describe('resize()', (): void => {
150
+ it('should update width and height properties when both x and y are provided', (): void => {
151
151
  const rect = new Rectangle(0, 0, 10, 10);
152
152
  rect.resize(120, 140);
153
153
  expect(rect.width).toBe(120);
@@ -155,8 +155,8 @@ describe('Rectangle', () => {
155
155
  });
156
156
  });
157
157
 
158
- describe('clone()', () => {
159
- it('should return a new Rectangle object with the same properties as this rectangle', () => {
158
+ describe('clone()', (): void => {
159
+ it('should return a new Rectangle object with the same properties as this rectangle', (): void => {
160
160
  const rect = new Rectangle(0, 0, 10, 10);
161
161
  const clone = rect.clone();
162
162
  expect(clone.x).toBe(rect.x);
@@ -166,15 +166,15 @@ describe('Rectangle', () => {
166
166
  });
167
167
  });
168
168
 
169
- describe('contains()', () => {
170
- it('should return true if the point x, y is within this rectangle', () => {
169
+ describe('contains()', (): void => {
170
+ it('should return true if the point x, y is within this rectangle', (): void => {
171
171
  const rect = new Rectangle(0, 0, 10, 10);
172
172
  rect.setTo(100, 200, 300, 400);
173
173
  const contains = rect.contains(150, 250);
174
174
  expect(contains).toBe(true);
175
175
  });
176
176
 
177
- it('should return false if the point x, y is outside this rectangle', () => {
177
+ it('should return false if the point x, y is outside this rectangle', (): void => {
178
178
  const rect = new Rectangle(0, 0, 10, 10);
179
179
  rect.setTo(100, 200, 300, 400);
180
180
  const contains = rect.contains(500, 600);
@@ -182,8 +182,8 @@ describe('Rectangle', () => {
182
182
  });
183
183
  });
184
184
 
185
- describe('containsRect()', () => {
186
- it('should return true if the rectangle b is within this rectangle', () => {
185
+ describe('containsRect()', (): void => {
186
+ it('should return true if the rectangle b is within this rectangle', (): void => {
187
187
  const rect = new Rectangle(0, 0, 10, 10);
188
188
  const source = new Rectangle();
189
189
  source.setTo(100, 200, 300, 400);
@@ -191,7 +191,7 @@ describe('Rectangle', () => {
191
191
  expect(contains).toBe(false);
192
192
  });
193
193
 
194
- it('should return false if the rectangle b is outside this rectangle', () => {
194
+ it('should return false if the rectangle b is outside this rectangle', (): void => {
195
195
  const rect = new Rectangle(0, 0, 10, 10);
196
196
  const source = new Rectangle();
197
197
  source.setTo(-500, -600, 700, 800);
@@ -200,8 +200,8 @@ describe('Rectangle', () => {
200
200
  });
201
201
  });
202
202
 
203
- describe('equals()', () => {
204
- it('should return true if the rectangle b has the same properties as this rectangle', () => {
203
+ describe('equals()', (): void => {
204
+ it('should return true if the rectangle b has the same properties as this rectangle', (): void => {
205
205
  const rect = new Rectangle(0, 0, 10, 10);
206
206
  const source = new Rectangle();
207
207
  source.setTo(100, 200, 300, 400);
@@ -209,7 +209,7 @@ describe('Rectangle', () => {
209
209
  expect(equals).toBe(false);
210
210
  });
211
211
 
212
- it('should return false if the rectangle b does not have the same properties as this rectangle', () => {
212
+ it('should return false if the rectangle b does not have the same properties as this rectangle', (): void => {
213
213
  const rect = new Rectangle(0, 0, 10, 10);
214
214
  const source = new Rectangle();
215
215
  source.setTo(-500, -600, 700, 800);
@@ -218,8 +218,8 @@ describe('Rectangle', () => {
218
218
  });
219
219
  });
220
220
 
221
- describe('intersection()', () => {
222
- it('should return a new Rectangle object that represents the intersection of this rectangle and b', () => {
221
+ describe('intersection()', (): void => {
222
+ it('should return a new Rectangle object that represents the intersection of this rectangle and b', (): void => {
223
223
  const rect = new Rectangle(0, 0, 10, 10);
224
224
  const source = new Rectangle();
225
225
  source.setTo(100, 200, 300, 400);
@@ -231,8 +231,8 @@ describe('Rectangle', () => {
231
231
  });
232
232
  });
233
233
 
234
- describe('intersects()', () => {
235
- it('should return true if the rectangle b intersects with this rectangle', () => {
234
+ describe('intersects()', (): void => {
235
+ it('should return true if the rectangle b intersects with this rectangle', (): void => {
236
236
  const rect = new Rectangle(0, 0, 10, 10);
237
237
  const source = new Rectangle();
238
238
  source.setTo(100, 200, 300, 400);
@@ -240,7 +240,7 @@ describe('Rectangle', () => {
240
240
  expect(intersects).toBe(false);
241
241
  });
242
242
 
243
- it('should return false if the rectangle b does not intersect with this rectangle', () => {
243
+ it('should return false if the rectangle b does not intersect with this rectangle', (): void => {
244
244
  const rect = new Rectangle(0, 0, 10, 10);
245
245
  const source = new Rectangle();
246
246
  source.setTo(-500, -600, 700, 800);
@@ -249,8 +249,8 @@ describe('Rectangle', () => {
249
249
  });
250
250
  });
251
251
 
252
- describe('intersectsRaw()', () => {
253
- it('should return true if the rectangle b intersects with this rectangle at left, right, top and bottom', () => {
252
+ describe('intersectsRaw()', (): void => {
253
+ it('should return true if the rectangle b intersects with this rectangle at left, right, top and bottom', (): void => {
254
254
  const rect = new Rectangle(0, 0, 10, 10);
255
255
  const source = new Rectangle();
256
256
  source.setTo(100, 200, 300, 400);
@@ -258,7 +258,7 @@ describe('Rectangle', () => {
258
258
  expect(intersects).toBe(false);
259
259
  });
260
260
 
261
- it('should return false if the rectangle b does not intersect with this rectangle at left, right, top and bottom', () => {
261
+ it('should return false if the rectangle b does not intersect with this rectangle at left, right, top and bottom', (): void => {
262
262
  const rect = new Rectangle(0, 0, 10, 10);
263
263
  const source = new Rectangle();
264
264
  source.setTo(-500, -600, 700, 800);
@@ -267,8 +267,8 @@ describe('Rectangle', () => {
267
267
  });
268
268
  });
269
269
 
270
- describe('union()', () => {
271
- it('should return a new Rectangle object that represents the union of this rectangle and b', () => {
270
+ describe('union()', (): void => {
271
+ it('should return a new Rectangle object that represents the union of this rectangle and b', (): void => {
272
272
  const rect = new Rectangle(0, 0, 10, 10);
273
273
  const source = new Rectangle();
274
274
  source.setTo(100, 200, 300, 400);
@@ -280,8 +280,8 @@ describe('Rectangle', () => {
280
280
  });
281
281
  });
282
282
 
283
- describe('random()', () => {
284
- it('should return a new Point object with x and y coordinates within this rectangle', () => {
283
+ describe('random()', (): void => {
284
+ it('should return a new Point object with x and y coordinates within this rectangle', (): void => {
285
285
  const rect = new Rectangle(0, 0, 10, 10);
286
286
  const random = rect.random();
287
287
  expect(random.x >= rect.left && random.x <= rect.right).toBe(true);
@@ -289,8 +289,8 @@ describe('Rectangle', () => {
289
289
  });
290
290
  });
291
291
 
292
- describe('getPoint()', () => {
293
- it('should return a new Point object at the specified position within this rectangle', () => {
292
+ describe('getPoint()', (): void => {
293
+ it('should return a new Point object at the specified position within this rectangle', (): void => {
294
294
  const rect = new Rectangle(0, 0, 10, 10);
295
295
  const point = rect.getPoint(TOP_LEFT);
296
296
  expect(point.x).toBe(rect.left);
@@ -298,8 +298,8 @@ describe('Rectangle', () => {
298
298
  });
299
299
  });
300
300
 
301
- describe('toString()', () => {
302
- it('should return a string representation of this rectangle', () => {
301
+ describe('toString()', (): void => {
302
+ it('should return a string representation of this rectangle', (): void => {
303
303
  const rect = new Rectangle(0, 0, 10, 10);
304
304
  const string = rect.toString();
305
305
  expect(string).toContain(`x=${rect.x}`);
@@ -309,24 +309,24 @@ describe('Rectangle', () => {
309
309
  });
310
310
  });
311
311
 
312
- describe('halfWidth', () => {
313
- it('should return half the width of this rectangle', () => {
312
+ describe('halfWidth', (): void => {
313
+ it('should return half the width of this rectangle', (): void => {
314
314
  const rect = new Rectangle(0, 0, 10, 10);
315
315
  const half = rect.halfWidth;
316
316
  expect(half).toBe(Math.round(rect.width / 2));
317
317
  });
318
318
  });
319
319
 
320
- describe('halfHeight', () => {
321
- it('should return half the height of this rectangle', () => {
320
+ describe('halfHeight', (): void => {
321
+ it('should return half the height of this rectangle', (): void => {
322
322
  const rect = new Rectangle(0, 0, 10, 10);
323
323
  const half = rect.halfHeight;
324
324
  expect(half).toBe(Math.round(rect.height / 2));
325
325
  });
326
326
  });
327
327
 
328
- describe('top', () => {
329
- it('should get and set the top coordinate of this rectangle', () => {
328
+ describe('top', (): void => {
329
+ it('should get and set the top coordinate of this rectangle', (): void => {
330
330
  const rect = new Rectangle(0, 0, 10, 10);
331
331
  const { top } = rect;
332
332
  expect(top).toBe(rect.y);
@@ -335,8 +335,8 @@ describe('Rectangle', () => {
335
335
  });
336
336
  });
337
337
 
338
- describe('left', () => {
339
- it('should get and set the left coordinate of this rectangle', () => {
338
+ describe('left', (): void => {
339
+ it('should get and set the left coordinate of this rectangle', (): void => {
340
340
  const rect = new Rectangle(0, 0, 10, 10);
341
341
  const { left } = rect;
342
342
  expect(left).toBe(rect.x);
@@ -345,8 +345,8 @@ describe('Rectangle', () => {
345
345
  });
346
346
  });
347
347
 
348
- describe('right', () => {
349
- it('should get and set the right coordinate of this rectangle', () => {
348
+ describe('right', (): void => {
349
+ it('should get and set the right coordinate of this rectangle', (): void => {
350
350
  const rect = new Rectangle(0, 0, 10, 10);
351
351
  const { right } = rect;
352
352
  expect(right).toBe(rect.x + rect.width);
@@ -355,8 +355,8 @@ describe('Rectangle', () => {
355
355
  });
356
356
  });
357
357
 
358
- describe('bottom', () => {
359
- it('should get and set the bottom coordinate of this rectangle', () => {
358
+ describe('bottom', (): void => {
359
+ it('should get and set the bottom coordinate of this rectangle', (): void => {
360
360
  const rect = new Rectangle(0, 0, 10, 10);
361
361
  const { bottom } = rect;
362
362
  expect(bottom).toBe(rect.y + rect.height);
@@ -365,8 +365,8 @@ describe('Rectangle', () => {
365
365
  });
366
366
  });
367
367
 
368
- describe('topLeft', () => {
369
- it('should get and set the top-left coordinates of this rectangle', () => {
368
+ describe('topLeft', (): void => {
369
+ it('should get and set the top-left coordinates of this rectangle', (): void => {
370
370
  const rect = new Rectangle(0, 0, 10, 10);
371
371
  const { topLeft } = rect;
372
372
  expect(topLeft.x).toBe(rect.left);
@@ -377,8 +377,8 @@ describe('Rectangle', () => {
377
377
  });
378
378
  });
379
379
 
380
- describe('topRight', () => {
381
- it('should get and set the top-right coordinates of this rectangle', () => {
380
+ describe('topRight', (): void => {
381
+ it('should get and set the top-right coordinates of this rectangle', (): void => {
382
382
  const rect = new Rectangle(0, 0, 10, 10);
383
383
  const { topRight } = rect;
384
384
  expect(topRight.x).toBe(rect.right);
@@ -389,8 +389,8 @@ describe('Rectangle', () => {
389
389
  });
390
390
  });
391
391
 
392
- describe('bottomLeft', () => {
393
- it('should get and set the bottom-left coordinates of this rectangle', () => {
392
+ describe('bottomLeft', (): void => {
393
+ it('should get and set the bottom-left coordinates of this rectangle', (): void => {
394
394
  const rect = new Rectangle(0, 0, 10, 10);
395
395
  const { bottomLeft } = rect;
396
396
  expect(bottomLeft.x).toBe(rect.left);
@@ -401,8 +401,8 @@ describe('Rectangle', () => {
401
401
  });
402
402
  });
403
403
 
404
- describe('bottomRight', () => {
405
- it('should get and set the bottom-right coordinates of this rectangle', () => {
404
+ describe('bottomRight', (): void => {
405
+ it('should get and set the bottom-right coordinates of this rectangle', (): void => {
406
406
  const rect = new Rectangle(0, 0, 10, 10);
407
407
  const { bottomRight } = rect;
408
408
  expect(bottomRight.x).toBe(rect.right);
@@ -413,8 +413,8 @@ describe('Rectangle', () => {
413
413
  });
414
414
  });
415
415
 
416
- describe('centerX', () => {
417
- it('should get and set the center x coordinate of this rectangle', () => {
416
+ describe('centerX', (): void => {
417
+ it('should get and set the center x coordinate of this rectangle', (): void => {
418
418
  const rect = new Rectangle(0, 0, 10, 10);
419
419
  const { centerX } = rect;
420
420
  expect(centerX).toBe(rect.x + rect.halfWidth);
@@ -423,8 +423,8 @@ describe('Rectangle', () => {
423
423
  });
424
424
  });
425
425
 
426
- describe('centerY', () => {
427
- it('should get and set the center y coordinate of this rectangle', () => {
426
+ describe('centerY', (): void => {
427
+ it('should get and set the center y coordinate of this rectangle', (): void => {
428
428
  const rect = new Rectangle(0, 0, 10, 10);
429
429
  const { centerY } = rect;
430
430
  expect(centerY).toBe(rect.y + rect.halfHeight);
@@ -433,24 +433,24 @@ describe('Rectangle', () => {
433
433
  });
434
434
  });
435
435
 
436
- describe('randomX', () => {
437
- it('should return a random x coordinate within this rectangle', () => {
436
+ describe('randomX', (): void => {
437
+ it('should return a random x coordinate within this rectangle', (): void => {
438
438
  const rect = new Rectangle(0, 0, 10, 10);
439
439
  const { randomX } = rect;
440
440
  expect(randomX >= rect.left && randomX <= rect.right).toBe(true);
441
441
  });
442
442
  });
443
443
 
444
- describe('randomY', () => {
445
- it('should return a random y coordinate within this rectangle', () => {
444
+ describe('randomY', (): void => {
445
+ it('should return a random y coordinate within this rectangle', (): void => {
446
446
  const rect = new Rectangle(0, 0, 10, 10);
447
447
  const { randomY } = rect;
448
448
  expect(randomY >= rect.top && randomY <= rect.bottom).toBe(true);
449
449
  });
450
450
  });
451
451
 
452
- describe('empty', () => {
453
- it('should get and set whether this rectangle is empty or not', () => {
452
+ describe('empty', (): void => {
453
+ it('should get and set whether this rectangle is empty or not', (): void => {
454
454
  const rect = new Rectangle(0, 0, 10, 10);
455
455
  const { empty } = rect;
456
456
  expect(empty).toBe(!rect.width || !rect.height);