@vpmedia/phaser 1.112.0 → 1.113.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.
- package/dist/index.js +1261 -1314
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +14 -10
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +10 -8
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +5 -4
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts +4 -3
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/const.d.ts.map +1 -1
- package/dist/phaser/core/device.d.ts.map +1 -1
- package/dist/phaser/core/device_util.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +3 -2
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/event_manager.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +1 -1
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/frame.d.ts.map +1 -1
- package/dist/phaser/core/frame_data.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +8 -6
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +40 -30
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +3 -2
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +3 -2
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +6 -4
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +3 -2
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +4 -3
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +9 -8
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts +3 -2
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/registry.d.ts +7 -0
- package/dist/phaser/core/registry.d.ts.map +1 -0
- package/dist/phaser/core/scale_manager.d.ts +1 -1
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +0 -1
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts +1 -1
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +0 -1
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +4 -3
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +6 -4
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +3 -2
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts +5 -4
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts +3 -2
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts +1 -1
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +1 -1
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/timer_event.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +10 -7
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +3 -2
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_easing.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts +3 -2
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts +3 -2
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +3 -2
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +3 -2
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/graphics.d.ts +7 -6
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts +2 -2
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts +10 -8
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +3 -2
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +2 -2
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +14 -12
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +8 -5
- package/dist/phaser/display/graphics.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/dist/phaser/display/group.d.ts +4 -3
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +13 -10
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts +3 -2
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +18 -15
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +11 -9
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts +0 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/dist/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +4 -3
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts +2 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts +2 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +7 -6
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts +2 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts +4 -2
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +16 -11
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts +16 -6
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts +19 -7
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +33 -12
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts +15 -6
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts +15 -6
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +16 -11
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +29 -20
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts +12 -10
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture.d.ts +3 -2
- package/dist/phaser/display/webgl/texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +4 -1
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +1 -1
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/point.d.ts.map +1 -1
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +3 -2
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +2 -2
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/phaser/core/animation.ts +64 -60
- package/src/phaser/core/animation_manager.ts +50 -53
- package/src/phaser/core/animation_parser.ts +9 -9
- package/src/phaser/core/array_set.ts +16 -17
- package/src/phaser/core/cache.ts +92 -93
- package/src/phaser/core/const.ts +1 -1
- package/src/phaser/core/device.ts +24 -29
- package/src/phaser/core/device_util.ts +22 -26
- package/src/phaser/core/dom.ts +54 -65
- package/src/phaser/core/event_manager.ts +64 -94
- package/src/phaser/core/factory.ts +14 -14
- package/src/phaser/core/frame.ts +28 -28
- package/src/phaser/core/frame_data.test.ts +100 -0
- package/src/phaser/core/frame_data.ts +24 -24
- package/src/phaser/core/frame_util.ts +2 -2
- package/src/phaser/core/game.ts +47 -48
- package/src/phaser/core/input.ts +104 -110
- package/src/phaser/core/input_handler.test.ts +113 -0
- package/src/phaser/core/input_handler.ts +199 -218
- package/src/phaser/core/input_mouse.ts +71 -54
- package/src/phaser/core/input_mspointer.ts +52 -39
- package/src/phaser/core/input_pointer.ts +81 -80
- package/src/phaser/core/input_touch.ts +49 -36
- package/src/phaser/core/loader.ts +173 -152
- package/src/phaser/core/loader_parser.ts +39 -57
- package/src/phaser/core/raf.ts +8 -7
- package/src/phaser/core/registry.test.ts +31 -0
- package/src/phaser/core/registry.ts +9 -0
- package/src/phaser/core/scale_manager.ts +156 -152
- package/src/phaser/core/scene.ts +9 -13
- package/src/phaser/core/scene_manager.ts +47 -47
- package/src/phaser/core/signal.test.ts +4 -4
- package/src/phaser/core/signal.ts +41 -52
- package/src/phaser/core/signal_binding.ts +26 -25
- package/src/phaser/core/signal_dispatch.test.ts +180 -0
- package/src/phaser/core/sound.ts +75 -83
- package/src/phaser/core/sound_manager.ts +52 -51
- package/src/phaser/core/sound_sprite.ts +17 -16
- package/src/phaser/core/stage.ts +25 -24
- package/src/phaser/core/time.ts +52 -52
- package/src/phaser/core/timer.test.ts +187 -0
- package/src/phaser/core/timer.ts +82 -69
- package/src/phaser/core/timer_event.ts +10 -10
- package/src/phaser/core/tween.ts +90 -93
- package/src/phaser/core/tween_data.ts +45 -51
- package/src/phaser/core/tween_easing.test.ts +106 -0
- package/src/phaser/core/tween_easing.ts +151 -123
- package/src/phaser/core/tween_manager.ts +19 -18
- package/src/phaser/core/world.ts +4 -3
- package/src/phaser/display/bitmap_text.ts +56 -64
- package/src/phaser/display/button.ts +33 -32
- package/src/phaser/display/canvas/buffer.ts +8 -8
- package/src/phaser/display/canvas/graphics.ts +36 -37
- package/src/phaser/display/canvas/masker.ts +2 -2
- package/src/phaser/display/canvas/pool.test.ts +106 -0
- package/src/phaser/display/canvas/pool.ts +25 -27
- package/src/phaser/display/canvas/renderer.ts +32 -31
- package/src/phaser/display/canvas/tinter.ts +25 -25
- package/src/phaser/display/canvas/util.ts +7 -10
- package/src/phaser/display/display_object.ts +114 -118
- package/src/phaser/display/graphics.ts +121 -119
- package/src/phaser/display/graphics_data.ts +12 -12
- package/src/phaser/display/graphics_data_util.ts +2 -3
- package/src/phaser/display/group.ts +50 -57
- package/src/phaser/display/image.ts +55 -52
- package/src/phaser/display/sprite_batch.ts +3 -2
- package/src/phaser/display/sprite_util.ts +48 -54
- package/src/phaser/display/text.ts +199 -204
- package/src/phaser/display/webgl/abstract_filter.ts +9 -9
- package/src/phaser/display/webgl/base_texture.ts +21 -24
- package/src/phaser/display/webgl/blend_manager.ts +6 -10
- package/src/phaser/display/webgl/earcut.ts +73 -37
- package/src/phaser/display/webgl/earcut_node.ts +10 -10
- package/src/phaser/display/webgl/fast_sprite_batch.ts +34 -34
- package/src/phaser/display/webgl/filter_manager.ts +13 -12
- package/src/phaser/display/webgl/filter_texture.ts +14 -13
- package/src/phaser/display/webgl/graphics.ts +51 -57
- package/src/phaser/display/webgl/graphics_data.ts +15 -14
- package/src/phaser/display/webgl/mask_manager.ts +2 -2
- package/src/phaser/display/webgl/render_texture.ts +26 -25
- package/src/phaser/display/webgl/renderer.ts +57 -62
- package/src/phaser/display/webgl/shader/complex.ts +28 -12
- package/src/phaser/display/webgl/shader/fast.ts +30 -12
- package/src/phaser/display/webgl/shader/normal.ts +70 -57
- package/src/phaser/display/webgl/shader/primitive.ts +26 -11
- package/src/phaser/display/webgl/shader/shader.test.ts +148 -0
- package/src/phaser/display/webgl/shader/strip.ts +27 -12
- package/src/phaser/display/webgl/shader_manager.test.ts +124 -0
- package/src/phaser/display/webgl/shader_manager.ts +26 -34
- package/src/phaser/display/webgl/sprite_batch.ts +67 -61
- package/src/phaser/display/webgl/stencil_manager.ts +23 -34
- package/src/phaser/display/webgl/texture.ts +43 -50
- package/src/phaser/display/webgl/texture_util.ts +2 -3
- package/src/phaser/display/webgl/util.ts +26 -25
- package/src/phaser/geom/circle.test.ts +2 -3
- package/src/phaser/geom/circle.ts +36 -36
- package/src/phaser/geom/ellipse.test.ts +73 -71
- package/src/phaser/geom/ellipse.ts +14 -14
- package/src/phaser/geom/line.test.ts +5 -5
- package/src/phaser/geom/line.ts +35 -35
- package/src/phaser/geom/matrix.test.ts +1 -1
- package/src/phaser/geom/matrix.ts +27 -27
- package/src/phaser/geom/point.test.ts +1 -2
- package/src/phaser/geom/point.ts +35 -35
- package/src/phaser/geom/polygon.test.ts +82 -0
- package/src/phaser/geom/polygon.ts +16 -16
- package/src/phaser/geom/rectangle.test.ts +14 -14
- package/src/phaser/geom/rectangle.ts +83 -75
- package/src/phaser/geom/rounded_rectangle.test.ts +1 -7
- package/src/phaser/geom/rounded_rectangle.ts +9 -9
- package/src/phaser/geom/util/circle.test.ts +25 -23
- package/src/phaser/geom/util/circle.ts +9 -18
- package/src/phaser/geom/util/ellipse.test.ts +7 -5
- package/src/phaser/geom/util/ellipse.ts +3 -2
- package/src/phaser/geom/util/line.test.ts +10 -8
- package/src/phaser/geom/util/line.ts +6 -16
- package/src/phaser/geom/util/matrix.test.ts +20 -18
- package/src/phaser/geom/util/matrix.ts +8 -15
- package/src/phaser/geom/util/point.test.ts +8 -6
- package/src/phaser/geom/util/point.ts +24 -28
- package/src/phaser/geom/util/polygon.test.ts +12 -10
- package/src/phaser/geom/util/polygon.ts +2 -2
- package/src/phaser/geom/util/rectangle.test.ts +10 -8
- package/src/phaser/geom/util/rectangle.ts +18 -37
- package/src/phaser/geom/util/rounded_rectangle.test.ts +11 -9
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
- package/src/phaser/util/math.test.ts +11 -11
- package/src/phaser/util/math.ts +29 -46
|
@@ -9,7 +9,7 @@ import { Point } from '../point.js';
|
|
|
9
9
|
* @returns {Circle} The cloned circle.
|
|
10
10
|
*/
|
|
11
11
|
export const clone = (input: Circle, output: Circle | null = null) => {
|
|
12
|
-
const result = output
|
|
12
|
+
const result = output ?? new Circle();
|
|
13
13
|
result.x = input.x;
|
|
14
14
|
result.y = input.y;
|
|
15
15
|
result.diameter = input.diameter;
|
|
@@ -38,9 +38,7 @@ export const contains = (a: Circle, x: number, y: number) => {
|
|
|
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: Circle, b: Circle) =>
|
|
42
|
-
return a.x === b.x && a.y === b.y && a.diameter === b.diameter;
|
|
43
|
-
};
|
|
41
|
+
export const equals = (a: Circle, b: Circle) => a.x === b.x && a.y === b.y && a.diameter === b.diameter;
|
|
44
42
|
|
|
45
43
|
/**
|
|
46
44
|
* Checks if two circles intersect.
|
|
@@ -48,9 +46,7 @@ export const equals = (a: Circle, b: Circle) => {
|
|
|
48
46
|
* @param {Circle} b - The second circle to check.
|
|
49
47
|
* @returns {boolean} True if the circles intersect, false otherwise.
|
|
50
48
|
*/
|
|
51
|
-
export const intersects = (a: Circle, b: Circle) =>
|
|
52
|
-
return distance(a.x, a.y, b.x, b.y) <= a.radius + b.radius;
|
|
53
|
-
};
|
|
49
|
+
export const intersects = (a: Circle, b: Circle) => distance(a.x, a.y, b.x, b.y) <= a.radius + b.radius;
|
|
54
50
|
|
|
55
51
|
/**
|
|
56
52
|
* Gets a point on the circumference of the circle at the specified angle.
|
|
@@ -60,14 +56,9 @@ export const intersects = (a: Circle, b: Circle) => {
|
|
|
60
56
|
* @param {Point} output - Optional point to store the result in.
|
|
61
57
|
* @returns {Point} The point on the circumference of the circle.
|
|
62
58
|
*/
|
|
63
|
-
export const circumferencePoint = (
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
asDegrees: boolean = false,
|
|
67
|
-
output: Point | null = null
|
|
68
|
-
) => {
|
|
69
|
-
const result = output || new Point();
|
|
70
|
-
if (asDegrees === true) {
|
|
59
|
+
export const circumferencePoint = (a: Circle, angle: number, asDegrees = false, output: Point | null = null) => {
|
|
60
|
+
const result = output ?? new Point();
|
|
61
|
+
if (asDegrees) {
|
|
71
62
|
angle = degToRad(angle);
|
|
72
63
|
}
|
|
73
64
|
result.x = a.x + a.radius * Math.cos(angle);
|
|
@@ -83,9 +74,9 @@ export const circumferencePoint = (
|
|
|
83
74
|
* @param {Point} output - Optional point to store the result in.
|
|
84
75
|
* @returns {Point} The point on the circumference of the circle.
|
|
85
76
|
*/
|
|
86
|
-
export const intersectsPoint = (a: Circle, angle: number, asDegrees
|
|
87
|
-
const result = output
|
|
88
|
-
if (asDegrees
|
|
77
|
+
export const intersectsPoint = (a: Circle, angle: number, asDegrees = false, output: Point | null = null) => {
|
|
78
|
+
const result = output ?? new Point();
|
|
79
|
+
if (asDegrees) {
|
|
89
80
|
angle = degToRad(angle);
|
|
90
81
|
}
|
|
91
82
|
result.x = a.x + a.radius * Math.cos(angle);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { expect } from 'vitest';
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { Ellipse } from '../ellipse.js';
|
|
3
3
|
import { contains } from './ellipse.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
describe('ellipse utils', () => {
|
|
6
|
+
it('should contain an ellipse the given coordinates', () => {
|
|
7
|
+
const ellipse = new Ellipse(0, 0, 10, 10);
|
|
8
|
+
expect(contains(ellipse, 5, 5)).toBe(true);
|
|
9
|
+
expect(contains(ellipse, 15, 15)).toBe(false);
|
|
10
|
+
});
|
|
9
11
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import type { Ellipse } from '../ellipse.js';
|
|
1
2
|
/**
|
|
2
3
|
* Checks if a point is contained within the ellipse.
|
|
3
|
-
* @param {
|
|
4
|
+
* @param {Ellipse} a - The ellipse to check.
|
|
4
5
|
* @param {number} x - The x coordinate of the point.
|
|
5
6
|
* @param {number} y - The y coordinate of the point.
|
|
6
7
|
* @returns {boolean} True if the point is contained within the ellipse, false otherwise.
|
|
7
8
|
*/
|
|
8
|
-
export const contains = (a:
|
|
9
|
+
export const contains = (a: Ellipse, x: number, y: number) => {
|
|
9
10
|
if (a.width <= 0 || a.height <= 0) {
|
|
10
11
|
return false;
|
|
11
12
|
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { expect } from 'vitest';
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { Line } from '../line.js';
|
|
3
3
|
import { clone } from './line.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
describe('line utils', () => {
|
|
6
|
+
it('should clone a line', () => {
|
|
7
|
+
const line1 = new Line(0, 0, 10, 0);
|
|
8
|
+
const line2 = clone(line1);
|
|
9
|
+
expect(line1.start.x).toBe(line2.start.x);
|
|
10
|
+
expect(line1.start.y).toBe(line2.start.y);
|
|
11
|
+
expect(line1.end.x).toBe(line2.end.x);
|
|
12
|
+
expect(line1.end.y).toBe(line2.end.y);
|
|
13
|
+
});
|
|
12
14
|
});
|
|
@@ -9,7 +9,7 @@ import { intersects as intersectsRect } from './rectangle.js';
|
|
|
9
9
|
* @returns {Line} The cloned line.
|
|
10
10
|
*/
|
|
11
11
|
export const clone = (input: Line, output: Line | null = null) => {
|
|
12
|
-
const result = output
|
|
12
|
+
const result = output ?? new Line();
|
|
13
13
|
result.start.x = input.start.x;
|
|
14
14
|
result.start.y = input.start.y;
|
|
15
15
|
result.end.x = input.end.x;
|
|
@@ -27,15 +27,8 @@ export const clone = (input: Line, output: Line | null = 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 = (
|
|
31
|
-
|
|
32
|
-
b: any,
|
|
33
|
-
e: any,
|
|
34
|
-
f: any,
|
|
35
|
-
asSegment: boolean = true,
|
|
36
|
-
output: Point | null = null
|
|
37
|
-
) => {
|
|
38
|
-
const result = output || new Point();
|
|
30
|
+
export const intersectsPoints = (a: any, b: any, e: any, f: any, asSegment = true, output: Point | null = null) => {
|
|
31
|
+
const result = output ?? new Point();
|
|
39
32
|
const a1 = b.y - a.y;
|
|
40
33
|
const a2 = f.y - e.y;
|
|
41
34
|
const b1 = a.x - b.x;
|
|
@@ -68,9 +61,8 @@ export const intersectsPoints = (
|
|
|
68
61
|
* @param {Point} result - Optional point to store the result in.
|
|
69
62
|
* @returns {Point} The intersection point, or null if there is no intersection.
|
|
70
63
|
*/
|
|
71
|
-
export const intersects = (a: any, b: any, asSegment: boolean, result: Point) =>
|
|
72
|
-
|
|
73
|
-
};
|
|
64
|
+
export const intersects = (a: any, b: any, asSegment: boolean, result: Point) =>
|
|
65
|
+
intersectsPoints(a.start, a.end, b.start, b.end, asSegment, result);
|
|
74
66
|
|
|
75
67
|
/**
|
|
76
68
|
* Checks if a line intersects with a rectangle.
|
|
@@ -132,6 +124,4 @@ export const intersectsRectangle = (line: any, rect: any) => {
|
|
|
132
124
|
* @param {object} b - The second point (with x, y properties).
|
|
133
125
|
* @returns {number} The distance between the points.
|
|
134
126
|
*/
|
|
135
|
-
export const reflect = (a: any, b: any) =>
|
|
136
|
-
return 2 * b.normalAngle - 3.141592653589793 - a.angle;
|
|
137
|
-
};
|
|
127
|
+
export const reflect = (a: any, b: any) => 2 * b.normalAngle - Math.PI - a.angle;
|
|
@@ -1,24 +1,26 @@
|
|
|
1
|
-
import { expect } from 'vitest';
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { Matrix } from '../matrix.js';
|
|
3
3
|
import { clone, getIdentityMatrix, getTempMatrix } from './matrix.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
5
|
+
describe('matrix utils', () => {
|
|
6
|
+
it('should clone a matrix', () => {
|
|
7
|
+
const matrix1 = new Matrix(2, 0, 0, 2, 0, 0);
|
|
8
|
+
const matrix2 = clone(matrix1);
|
|
9
|
+
expect(matrix1.a).toBe(matrix2.a);
|
|
10
|
+
expect(matrix1.b).toBe(matrix2.b);
|
|
11
|
+
expect(matrix1.c).toBe(matrix2.c);
|
|
12
|
+
expect(matrix1.d).toBe(matrix2.d);
|
|
13
|
+
expect(matrix1.tx).toBe(matrix2.tx);
|
|
14
|
+
expect(matrix1.ty).toBe(matrix2.ty);
|
|
15
|
+
});
|
|
15
16
|
|
|
16
|
-
it('should create an identity matrix', () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
});
|
|
17
|
+
it('should create an identity matrix', () => {
|
|
18
|
+
const matrix = getIdentityMatrix();
|
|
19
|
+
expect(matrix.a).toBe(1);
|
|
20
|
+
});
|
|
20
21
|
|
|
21
|
-
it('should create a temporary matrix', () => {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
it('should create a temporary matrix', () => {
|
|
23
|
+
const matrix = getTempMatrix();
|
|
24
|
+
expect(matrix.a).toBe(1);
|
|
25
|
+
});
|
|
24
26
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Matrix } from '../matrix.js';
|
|
2
|
+
import { getRegistry } from '../../core/registry.js';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* Clones a matrix.
|
|
@@ -7,7 +8,7 @@ import { Matrix } from '../matrix.js';
|
|
|
7
8
|
* @returns {Matrix} The cloned matrix.
|
|
8
9
|
*/
|
|
9
10
|
export const clone = (input: Matrix, output: Matrix | null = null) => {
|
|
10
|
-
const result = output
|
|
11
|
+
const result = output ?? new Matrix();
|
|
11
12
|
result.a = input.a;
|
|
12
13
|
result.b = input.b;
|
|
13
14
|
result.c = input.c;
|
|
@@ -22,13 +23,9 @@ export const clone = (input: Matrix, output: Matrix | null = null) => {
|
|
|
22
23
|
* @returns {Matrix} A new identity matrix.
|
|
23
24
|
*/
|
|
24
25
|
export const getIdentityMatrix = () => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
if (!window.PhaserRegistry.IDENTITY_MATRIX) {
|
|
29
|
-
window.PhaserRegistry.IDENTITY_MATRIX = new Matrix();
|
|
30
|
-
}
|
|
31
|
-
return window.PhaserRegistry.IDENTITY_MATRIX;
|
|
26
|
+
getRegistry();
|
|
27
|
+
globalThis.PhaserRegistry.IDENTITY_MATRIX ??= new Matrix();
|
|
28
|
+
return globalThis.PhaserRegistry.IDENTITY_MATRIX;
|
|
32
29
|
};
|
|
33
30
|
|
|
34
31
|
/**
|
|
@@ -36,11 +33,7 @@ export const getIdentityMatrix = () => {
|
|
|
36
33
|
* @returns {Matrix} A new matrix.
|
|
37
34
|
*/
|
|
38
35
|
export const getTempMatrix = () => {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (!window.PhaserRegistry.TEMP_MATRIX) {
|
|
43
|
-
window.PhaserRegistry.TEMP_MATRIX = new Matrix();
|
|
44
|
-
}
|
|
45
|
-
return window.PhaserRegistry.TEMP_MATRIX;
|
|
36
|
+
getRegistry();
|
|
37
|
+
globalThis.PhaserRegistry.TEMP_MATRIX ??= new Matrix();
|
|
38
|
+
return globalThis.PhaserRegistry.TEMP_MATRIX;
|
|
46
39
|
};
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
import { expect } from 'vitest';
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { Point } from '../point.js';
|
|
3
3
|
import { clone } from './point.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
describe('point utils', () => {
|
|
6
|
+
it('should clone a point', () => {
|
|
7
|
+
const point1 = new Point(1, 2);
|
|
8
|
+
const point2 = clone(point1);
|
|
9
|
+
expect(point1.x).toBe(point2.x);
|
|
10
|
+
expect(point1.y).toBe(point2.y);
|
|
11
|
+
});
|
|
10
12
|
});
|
|
@@ -8,7 +8,7 @@ import { Point } from '../point.js';
|
|
|
8
8
|
* @returns {Point} A new point containing the sum of the two points.
|
|
9
9
|
*/
|
|
10
10
|
export const add = (a: Point, b: Point, output: Point | null = null) => {
|
|
11
|
-
const result = output
|
|
11
|
+
const result = output ?? new Point();
|
|
12
12
|
result.x = a.x + b.x;
|
|
13
13
|
result.y = a.y + b.y;
|
|
14
14
|
return result;
|
|
@@ -22,7 +22,7 @@ export const add = (a: Point, b: Point, output: Point | null = null) => {
|
|
|
22
22
|
* @returns {Point} A new point containing the difference of the two points.
|
|
23
23
|
*/
|
|
24
24
|
export const subtract = (a: Point, b: Point, output: Point | null = null) => {
|
|
25
|
-
const result = output
|
|
25
|
+
const result = output ?? new Point();
|
|
26
26
|
result.x = a.x - b.x;
|
|
27
27
|
result.y = a.y - b.y;
|
|
28
28
|
return result;
|
|
@@ -36,7 +36,7 @@ export const subtract = (a: Point, b: Point, output: Point | null = null) => {
|
|
|
36
36
|
* @returns {Point} A new point containing the product of the two points.
|
|
37
37
|
*/
|
|
38
38
|
export const multiply = (a: Point, b: Point, output: Point | null = null) => {
|
|
39
|
-
const result = output
|
|
39
|
+
const result = output ?? new Point();
|
|
40
40
|
result.x = a.x * b.x;
|
|
41
41
|
result.y = a.y * b.y;
|
|
42
42
|
return result;
|
|
@@ -50,7 +50,7 @@ export const multiply = (a: Point, b: Point, output: Point | null = null) => {
|
|
|
50
50
|
* @returns {Point} A new point containing the quotient of the two points.
|
|
51
51
|
*/
|
|
52
52
|
export const divide = (a: Point, b: Point, output: Point | null = null) => {
|
|
53
|
-
const result = output
|
|
53
|
+
const result = output ?? new Point();
|
|
54
54
|
result.x = a.x / b.x;
|
|
55
55
|
result.y = a.y / b.y;
|
|
56
56
|
return result;
|
|
@@ -62,9 +62,7 @@ export const divide = (a: Point, b: Point, output: Point | null = null) => {
|
|
|
62
62
|
* @param {Point} b - The second point to compare.
|
|
63
63
|
* @returns {boolean} True if the points are equal, false otherwise.
|
|
64
64
|
*/
|
|
65
|
-
export const equals = (a: Point, b: Point) =>
|
|
66
|
-
return a.x === b.x && a.y === b.y;
|
|
67
|
-
};
|
|
65
|
+
export const equals = (a: Point, b: Point) => a.x === b.x && a.y === b.y;
|
|
68
66
|
|
|
69
67
|
/**
|
|
70
68
|
* Calculates the angle between two points.
|
|
@@ -72,9 +70,7 @@ export const equals = (a: Point, b: Point) => {
|
|
|
72
70
|
* @param {Point} b - The second point to calculate the angle to.
|
|
73
71
|
* @returns {number} The angle between the two points in radians.
|
|
74
72
|
*/
|
|
75
|
-
export const angle = (a: Point, b: Point) =>
|
|
76
|
-
return Math.atan2(a.y - b.y, a.x - b.x);
|
|
77
|
-
};
|
|
73
|
+
export const angle = (a: Point, b: Point) => Math.atan2(a.y - b.y, a.x - b.x);
|
|
78
74
|
|
|
79
75
|
/**
|
|
80
76
|
* Creates a new point with the same coordinates as the input point but with inverted signs.
|
|
@@ -83,7 +79,7 @@ export const angle = (a: Point, b: Point) => {
|
|
|
83
79
|
* @returns {Point} A new point with negated coordinates.
|
|
84
80
|
*/
|
|
85
81
|
export const negative = (a: Point, output: Point | null = null) => {
|
|
86
|
-
const result = output
|
|
82
|
+
const result = output ?? new Point();
|
|
87
83
|
return result.setTo(-a.x, -a.y);
|
|
88
84
|
};
|
|
89
85
|
|
|
@@ -96,7 +92,7 @@ export const negative = (a: Point, output: Point | null = null) => {
|
|
|
96
92
|
* @returns {Point} A new point with the result of the operation.
|
|
97
93
|
*/
|
|
98
94
|
export const multiplyAdd = (a: Point, b: Point, s: number, output: Point | null = null) => {
|
|
99
|
-
const result = output
|
|
95
|
+
const result = output ?? new Point();
|
|
100
96
|
return result.setTo(a.x + b.x * s, a.y + b.y * s);
|
|
101
97
|
};
|
|
102
98
|
|
|
@@ -109,7 +105,7 @@ export const multiplyAdd = (a: Point, b: Point, s: number, output: Point | null
|
|
|
109
105
|
* @returns {Point} A new point interpolated between the two points.
|
|
110
106
|
*/
|
|
111
107
|
export const interpolate = (a: Point, b: Point, f: number, output: Point | null = null) => {
|
|
112
|
-
const result = output
|
|
108
|
+
const result = output ?? new Point();
|
|
113
109
|
return result.setTo(a.x + (b.x - a.x) * f, a.y + (b.y - a.y) * f);
|
|
114
110
|
};
|
|
115
111
|
|
|
@@ -120,7 +116,7 @@ export const interpolate = (a: Point, b: Point, f: number, output: Point | null
|
|
|
120
116
|
* @returns {Point} A new point that is perpendicular to the input point.
|
|
121
117
|
*/
|
|
122
118
|
export const perp = (a: Point, output: Point | null = null) => {
|
|
123
|
-
const result = output
|
|
119
|
+
const result = output ?? new Point();
|
|
124
120
|
return result.setTo(-a.y, a.x);
|
|
125
121
|
};
|
|
126
122
|
|
|
@@ -131,7 +127,7 @@ export const perp = (a: Point, output: Point | null = null) => {
|
|
|
131
127
|
* @returns {Point} A new point that is perpendicular to the input point (rotated clockwise).
|
|
132
128
|
*/
|
|
133
129
|
export const rperp = (a: Point, output: Point | null = null) => {
|
|
134
|
-
const result = output
|
|
130
|
+
const result = output ?? new Point();
|
|
135
131
|
return result.setTo(a.y, -a.x);
|
|
136
132
|
};
|
|
137
133
|
|
|
@@ -142,7 +138,7 @@ export const rperp = (a: Point, output: Point | null = null) => {
|
|
|
142
138
|
* @param {boolean} round - Whether to round the result (default: false).
|
|
143
139
|
* @returns {number} The distance between the two points.
|
|
144
140
|
*/
|
|
145
|
-
export const distance = (a: Point, b: Point, round
|
|
141
|
+
export const distance = (a: Point, b: Point, round = false) => {
|
|
146
142
|
const dx = a.x - b.x;
|
|
147
143
|
const dy = a.y - b.y;
|
|
148
144
|
const abDistance = Math.sqrt(dx * dx + dy * dy);
|
|
@@ -157,7 +153,7 @@ export const distance = (a: Point, b: Point, round: boolean = false) => {
|
|
|
157
153
|
* @returns {Point} A new point with the projected result.
|
|
158
154
|
*/
|
|
159
155
|
export const project = (a: Point, b: Point, output: Point | null = null) => {
|
|
160
|
-
const result = output
|
|
156
|
+
const result = output ?? new Point();
|
|
161
157
|
const amt = a.dot(b) / b.getMagnitudeSq();
|
|
162
158
|
if (amt !== 0) {
|
|
163
159
|
result.setTo(amt * b.x, amt * b.y);
|
|
@@ -173,7 +169,7 @@ export const project = (a: Point, b: Point, output: Point | null = null) => {
|
|
|
173
169
|
* @returns {Point} A new point with the projected result.
|
|
174
170
|
*/
|
|
175
171
|
export const projectUnit = (a: Point, b: Point, output: Point | null = null) => {
|
|
176
|
-
const result = output
|
|
172
|
+
const result = output ?? new Point();
|
|
177
173
|
const amt = a.dot(b);
|
|
178
174
|
if (amt !== 0) {
|
|
179
175
|
result.setTo(amt * b.x, amt * b.y);
|
|
@@ -188,7 +184,7 @@ export const projectUnit = (a: Point, b: Point, output: Point | null = null) =>
|
|
|
188
184
|
* @returns {Point} A new point with the same x coordinate but negated y coordinate.
|
|
189
185
|
*/
|
|
190
186
|
export const normalRightHand = (a: Point, output: Point | null = null) => {
|
|
191
|
-
const result = output
|
|
187
|
+
const result = output ?? new Point();
|
|
192
188
|
return result.setTo(a.y * -1, a.x);
|
|
193
189
|
};
|
|
194
190
|
|
|
@@ -199,7 +195,7 @@ export const normalRightHand = (a: Point, output: Point | null = null) => {
|
|
|
199
195
|
* @returns {Point} A new normalized point.
|
|
200
196
|
*/
|
|
201
197
|
export const normalize = (a: Point, output: Point | null = null) => {
|
|
202
|
-
const result = output
|
|
198
|
+
const result = output ?? new Point();
|
|
203
199
|
const m = a.getMagnitude();
|
|
204
200
|
if (m !== 0) {
|
|
205
201
|
result.setTo(a.x / m, a.y / m);
|
|
@@ -252,17 +248,17 @@ export const rotate = (
|
|
|
252
248
|
* @throws {Error} If the points array is empty.
|
|
253
249
|
*/
|
|
254
250
|
export const centroid = (points: Point[], output: Point | null = null) => {
|
|
255
|
-
const result = output
|
|
251
|
+
const result = output ?? new Point();
|
|
256
252
|
const pointsLen = points.length;
|
|
257
253
|
if (pointsLen < 1) {
|
|
258
254
|
throw new Error('Point(points) array must not be empty');
|
|
259
255
|
}
|
|
260
256
|
if (pointsLen === 1) {
|
|
261
|
-
result.copyFrom(points[0]);
|
|
257
|
+
result.copyFrom(points[0]!);
|
|
262
258
|
return result;
|
|
263
259
|
}
|
|
264
|
-
for (
|
|
265
|
-
add(result,
|
|
260
|
+
for (const point of points) {
|
|
261
|
+
add(result, point, result);
|
|
266
262
|
}
|
|
267
263
|
result.divide(pointsLen, pointsLen);
|
|
268
264
|
return result;
|
|
@@ -275,13 +271,13 @@ export const centroid = (points: Point[], output: Point | null = null) => {
|
|
|
275
271
|
* @param {string} yProp - The name of the property containing the y value (default: 'y').
|
|
276
272
|
* @returns {Point} A new point with parsed x and y values.
|
|
277
273
|
*/
|
|
278
|
-
export const parse = (obj: any, xProp
|
|
274
|
+
export const parse = (obj: any, xProp = 'x', yProp = 'y') => {
|
|
279
275
|
const point = new Point();
|
|
280
276
|
if (obj[xProp]) {
|
|
281
|
-
point.x =
|
|
277
|
+
point.x = Math.trunc(Number(obj[xProp]));
|
|
282
278
|
}
|
|
283
279
|
if (obj[yProp]) {
|
|
284
|
-
point.y =
|
|
280
|
+
point.y = Math.trunc(Number(obj[yProp]));
|
|
285
281
|
}
|
|
286
282
|
return point;
|
|
287
283
|
};
|
|
@@ -293,7 +289,7 @@ export const parse = (obj: any, xProp: string = 'x', yProp: string = 'y') => {
|
|
|
293
289
|
* @returns {Point} A new point with the same coordinates as the input.
|
|
294
290
|
*/
|
|
295
291
|
export const clone = (input: Point, output: Point | null = null) => {
|
|
296
|
-
const result = output
|
|
292
|
+
const result = output ?? new Point();
|
|
297
293
|
result.setTo(input.x, input.y);
|
|
298
294
|
return result;
|
|
299
295
|
};
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { expect } from 'vitest';
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { Polygon } from '../polygon.js';
|
|
3
3
|
import { clone } from './polygon.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
describe('polygon utils', () => {
|
|
6
|
+
it('should clone a polygon', () => {
|
|
7
|
+
const polygon = new Polygon([0, 0, 1, 0, 1, 1]);
|
|
8
|
+
const points = clone(polygon).toNumberArray();
|
|
9
|
+
expect(points[0]).toBe(0);
|
|
10
|
+
expect(points[1]).toBe(0);
|
|
11
|
+
expect(points[2]).toBe(1);
|
|
12
|
+
expect(points[3]).toBe(0);
|
|
13
|
+
expect(points[4]).toBe(1);
|
|
14
|
+
expect(points[5]).toBe(1);
|
|
15
|
+
});
|
|
14
16
|
});
|
|
@@ -7,7 +7,7 @@ import { Polygon } from '../polygon.js';
|
|
|
7
7
|
* @returns {Polygon} The cloned polygon.
|
|
8
8
|
*/
|
|
9
9
|
export const clone = (input: Polygon, output: Polygon | null = null) => {
|
|
10
|
-
const result = output
|
|
11
|
-
result.setTo(input._points
|
|
10
|
+
const result = output ?? new Polygon();
|
|
11
|
+
result.setTo([...input._points]);
|
|
12
12
|
return result;
|
|
13
13
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { expect } from 'vitest';
|
|
1
|
+
import { describe, expect, it } from 'vitest';
|
|
2
2
|
import { Rectangle } from '../rectangle.js';
|
|
3
3
|
import { clone } from './rectangle.js';
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
describe('rectangle utils', () => {
|
|
6
|
+
it('should clone a rectangle', () => {
|
|
7
|
+
const rectangle1 = new Rectangle(0, 0, 10, 10);
|
|
8
|
+
const rectangle2 = clone(rectangle1);
|
|
9
|
+
expect(rectangle1.x).toBe(rectangle2.x);
|
|
10
|
+
expect(rectangle1.y).toBe(rectangle2.y);
|
|
11
|
+
expect(rectangle1.width).toBe(rectangle2.width);
|
|
12
|
+
expect(rectangle1.height).toBe(rectangle2.height);
|
|
13
|
+
});
|
|
12
14
|
});
|