@vpmedia/phaser 1.106.0 → 1.108.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 +225 -226
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +2 -2
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts +2 -2
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +2 -2
- 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 +6 -6
- package/dist/phaser/core/cache.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 +2 -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/frame_util.d.ts.map +1 -1
- package/dist/phaser/core/game.d.ts +1 -1
- package/dist/phaser/core/game.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +3 -3
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts +8 -8
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +8 -8
- package/dist/phaser/core/input_mouse.d.ts.map +1 -1
- package/dist/phaser/core/input_mspointer.d.ts +6 -6
- package/dist/phaser/core/input_mspointer.d.ts.map +1 -1
- package/dist/phaser/core/input_pointer.d.ts +3 -3
- package/dist/phaser/core/input_pointer.d.ts.map +1 -1
- package/dist/phaser/core/input_touch.d.ts +7 -7
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +6 -6
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +4 -4
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts +5 -5
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene.d.ts +3 -3
- package/dist/phaser/core/scene.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts +7 -7
- package/dist/phaser/core/signal.d.ts.map +1 -1
- package/dist/phaser/core/signal_binding.d.ts +1 -1
- package/dist/phaser/core/signal_binding.d.ts.map +1 -1
- package/dist/phaser/core/sound.d.ts +3 -3
- package/dist/phaser/core/sound.d.ts.map +1 -1
- package/dist/phaser/core/sound_manager.d.ts +1 -1
- package/dist/phaser/core/sound_manager.d.ts.map +1 -1
- package/dist/phaser/core/sound_sprite.d.ts.map +1 -1
- package/dist/phaser/core/stage.d.ts.map +1 -1
- package/dist/phaser/core/time.d.ts.map +1 -1
- package/dist/phaser/core/timer.d.ts +5 -5
- 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 +1 -1
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +1 -1
- 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 +1 -1
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/core/world.d.ts.map +1 -1
- package/dist/phaser/display/bitmap_text.d.ts +3 -3
- package/dist/phaser/display/bitmap_text.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +12 -11
- 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 +3 -3
- package/dist/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts.map +1 -1
- package/dist/phaser/display/canvas/pool.d.ts.map +1 -1
- package/dist/phaser/display/canvas/renderer.d.ts +2 -2
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts +1 -1
- package/dist/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/dist/phaser/display/canvas/util.d.ts +1 -1
- package/dist/phaser/display/canvas/util.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +12 -21
- package/dist/phaser/display/display_object.d.ts.map +1 -1
- package/dist/phaser/display/graphics.d.ts +1 -1
- 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 +3 -3
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +8 -8
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +5 -5
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +8 -7
- 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.map +1 -1
- package/dist/phaser/display/webgl/earcut.d.ts +5 -5
- 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 +3 -2
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +4 -3
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts +2 -2
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts +2 -1
- package/dist/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +2 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- 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 +8 -4
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts +1 -1
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/ellipse.d.ts +1 -1
- package/dist/phaser/geom/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +3 -3
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/matrix.d.ts +3 -3
- 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 +1 -1
- package/dist/phaser/geom/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts +2 -2
- 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 +3 -3
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts +1 -1
- package/dist/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/dist/phaser/geom/util/line.d.ts +3 -3
- package/dist/phaser/geom/util/line.d.ts.map +1 -1
- package/dist/phaser/geom/util/matrix.d.ts +1 -1
- package/dist/phaser/geom/util/matrix.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts +15 -15
- package/dist/phaser/geom/util/point.d.ts.map +1 -1
- package/dist/phaser/geom/util/polygon.d.ts +1 -1
- package/dist/phaser/geom/util/polygon.d.ts.map +1 -1
- package/dist/phaser/geom/util/rectangle.d.ts +5 -5
- package/dist/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts +1 -1
- package/dist/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/dist/phaser/util/math.d.ts.map +1 -1
- package/package.json +13 -13
- package/src/phaser/core/animation.ts +6 -6
- package/src/phaser/core/animation_manager.ts +2 -2
- package/src/phaser/core/cache.ts +9 -8
- package/src/phaser/core/device_util.ts +4 -2
- package/src/phaser/core/dom.ts +2 -2
- package/src/phaser/core/factory.ts +3 -5
- package/src/phaser/core/game.ts +21 -34
- package/src/phaser/core/input.ts +2 -2
- package/src/phaser/core/input_handler.ts +6 -5
- package/src/phaser/core/input_mouse.ts +8 -84
- package/src/phaser/core/input_mspointer.ts +12 -8
- package/src/phaser/core/input_touch.ts +7 -7
- package/src/phaser/core/loader.ts +35 -31
- package/src/phaser/core/loader_parser.ts +12 -4
- package/src/phaser/core/scale_manager.ts +5 -5
- package/src/phaser/core/scene.ts +3 -3
- package/src/phaser/core/signal.ts +9 -9
- package/src/phaser/core/signal_binding.ts +1 -1
- package/src/phaser/core/sound.ts +12 -21
- package/src/phaser/core/sound_manager.ts +3 -3
- package/src/phaser/core/stage.ts +6 -6
- package/src/phaser/core/timer.ts +4 -4
- package/src/phaser/core/tween.ts +7 -5
- package/src/phaser/core/tween_data.ts +2 -2
- package/src/phaser/core/tween_manager.ts +2 -2
- package/src/phaser/display/bitmap_text.ts +6 -6
- package/src/phaser/display/button.ts +33 -26
- package/src/phaser/display/canvas/renderer.ts +2 -2
- package/src/phaser/display/canvas/util.ts +12 -12
- package/src/phaser/display/display_object.ts +17 -31
- package/src/phaser/display/graphics.ts +9 -9
- package/src/phaser/display/group.ts +8 -8
- package/src/phaser/display/image.ts +21 -21
- package/src/phaser/display/sprite_util.ts +1 -1
- package/src/phaser/display/text.ts +9 -9
- package/src/phaser/display/webgl/earcut.ts +12 -4
- package/src/phaser/display/webgl/fast_sprite_batch.ts +4 -2
- package/src/phaser/display/webgl/graphics.ts +3 -2
- package/src/phaser/display/webgl/render_texture.ts +2 -2
- package/src/phaser/display/webgl/shader/normal.ts +1 -1
- package/src/phaser/display/webgl/shader_manager.ts +2 -1
- package/src/phaser/display/webgl/sprite_batch.ts +2 -1
- package/src/phaser/display/webgl/util.ts +9 -0
- package/src/phaser/geom/circle.ts +1 -1
- package/src/phaser/geom/ellipse.ts +1 -1
- package/src/phaser/geom/line.ts +2 -2
- package/src/phaser/geom/matrix.ts +3 -3
- package/src/phaser/geom/polygon.ts +1 -1
- package/src/phaser/geom/rectangle.ts +2 -2
- package/src/phaser/geom/util/circle.ts +8 -3
- package/src/phaser/geom/util/line.ts +9 -2
- package/src/phaser/geom/util/matrix.ts +1 -1
- package/src/phaser/geom/util/point.ts +15 -15
- package/src/phaser/geom/util/polygon.ts +1 -1
- package/src/phaser/geom/util/rectangle.ts +5 -5
- package/src/phaser/geom/util/rounded_rectangle.ts +1 -1
|
@@ -7,7 +7,7 @@ import { Point } from '../point.js';
|
|
|
7
7
|
* @param {Point} output - The point to store the result in (optional).
|
|
8
8
|
* @returns {Point} A new point containing the sum of the two points.
|
|
9
9
|
*/
|
|
10
|
-
export const add = (a: Point, b: Point, output: Point = null) => {
|
|
10
|
+
export const add = (a: Point, b: Point, output: Point | null = null) => {
|
|
11
11
|
const result = output || new Point();
|
|
12
12
|
result.x = a.x + b.x;
|
|
13
13
|
result.y = a.y + b.y;
|
|
@@ -21,7 +21,7 @@ export const add = (a: Point, b: Point, output: Point = null) => {
|
|
|
21
21
|
* @param {Point} output - The point to store the result in (optional).
|
|
22
22
|
* @returns {Point} A new point containing the difference of the two points.
|
|
23
23
|
*/
|
|
24
|
-
export const subtract = (a: Point, b: Point, output: Point = null) => {
|
|
24
|
+
export const subtract = (a: Point, b: Point, output: Point | null = null) => {
|
|
25
25
|
const result = output || new Point();
|
|
26
26
|
result.x = a.x - b.x;
|
|
27
27
|
result.y = a.y - b.y;
|
|
@@ -35,7 +35,7 @@ export const subtract = (a: Point, b: Point, output: Point = null) => {
|
|
|
35
35
|
* @param {Point} output - The point to store the result in (optional).
|
|
36
36
|
* @returns {Point} A new point containing the product of the two points.
|
|
37
37
|
*/
|
|
38
|
-
export const multiply = (a: Point, b: Point, output: Point = null) => {
|
|
38
|
+
export const multiply = (a: Point, b: Point, output: Point | null = null) => {
|
|
39
39
|
const result = output || new Point();
|
|
40
40
|
result.x = a.x * b.x;
|
|
41
41
|
result.y = a.y * b.y;
|
|
@@ -49,7 +49,7 @@ export const multiply = (a: Point, b: Point, output: Point = null) => {
|
|
|
49
49
|
* @param {Point} output - The point to store the result in (optional).
|
|
50
50
|
* @returns {Point} A new point containing the quotient of the two points.
|
|
51
51
|
*/
|
|
52
|
-
export const divide = (a: Point, b: Point, output: Point = null) => {
|
|
52
|
+
export const divide = (a: Point, b: Point, output: Point | null = null) => {
|
|
53
53
|
const result = output || new Point();
|
|
54
54
|
result.x = a.x / b.x;
|
|
55
55
|
result.y = a.y / b.y;
|
|
@@ -82,7 +82,7 @@ export const angle = (a: Point, b: Point) => {
|
|
|
82
82
|
* @param {Point} output - The point to store the result in (optional).
|
|
83
83
|
* @returns {Point} A new point with negated coordinates.
|
|
84
84
|
*/
|
|
85
|
-
export const negative = (a: Point, output: Point = null) => {
|
|
85
|
+
export const negative = (a: Point, output: Point | null = null) => {
|
|
86
86
|
const result = output || new Point();
|
|
87
87
|
return result.setTo(-a.x, -a.y);
|
|
88
88
|
};
|
|
@@ -95,7 +95,7 @@ export const negative = (a: Point, output: Point = null) => {
|
|
|
95
95
|
* @param {Point} output - The point to store the result in (optional).
|
|
96
96
|
* @returns {Point} A new point with the result of the operation.
|
|
97
97
|
*/
|
|
98
|
-
export const multiplyAdd = (a: Point, b: Point, s: number, output: Point = null) => {
|
|
98
|
+
export const multiplyAdd = (a: Point, b: Point, s: number, output: Point | null = null) => {
|
|
99
99
|
const result = output || new Point();
|
|
100
100
|
return result.setTo(a.x + b.x * s, a.y + b.y * s);
|
|
101
101
|
};
|
|
@@ -108,7 +108,7 @@ export const multiplyAdd = (a: Point, b: Point, s: number, output: Point = null)
|
|
|
108
108
|
* @param {Point} output - The point to store the result in (optional).
|
|
109
109
|
* @returns {Point} A new point interpolated between the two points.
|
|
110
110
|
*/
|
|
111
|
-
export const interpolate = (a: Point, b: Point, f: number, output: Point = null) => {
|
|
111
|
+
export const interpolate = (a: Point, b: Point, f: number, output: Point | null = null) => {
|
|
112
112
|
const result = output || new Point();
|
|
113
113
|
return result.setTo(a.x + (b.x - a.x) * f, a.y + (b.y - a.y) * f);
|
|
114
114
|
};
|
|
@@ -119,7 +119,7 @@ export const interpolate = (a: Point, b: Point, f: number, output: Point = null)
|
|
|
119
119
|
* @param {Point} output - The point to store the result in (optional).
|
|
120
120
|
* @returns {Point} A new point that is perpendicular to the input point.
|
|
121
121
|
*/
|
|
122
|
-
export const perp = (a: Point, output: Point = null) => {
|
|
122
|
+
export const perp = (a: Point, output: Point | null = null) => {
|
|
123
123
|
const result = output || new Point();
|
|
124
124
|
return result.setTo(-a.y, a.x);
|
|
125
125
|
};
|
|
@@ -130,7 +130,7 @@ export const perp = (a: Point, output: Point = null) => {
|
|
|
130
130
|
* @param {Point} output - The point to store the result in (optional).
|
|
131
131
|
* @returns {Point} A new point that is perpendicular to the input point (rotated clockwise).
|
|
132
132
|
*/
|
|
133
|
-
export const rperp = (a: Point, output: Point = null) => {
|
|
133
|
+
export const rperp = (a: Point, output: Point | null = null) => {
|
|
134
134
|
const result = output || new Point();
|
|
135
135
|
return result.setTo(a.y, -a.x);
|
|
136
136
|
};
|
|
@@ -156,7 +156,7 @@ export const distance = (a: Point, b: Point, round: boolean = false) => {
|
|
|
156
156
|
* @param {Point} output - The point to store the result in (optional).
|
|
157
157
|
* @returns {Point} A new point with the projected result.
|
|
158
158
|
*/
|
|
159
|
-
export const project = (a: Point, b: Point, output: Point = null) => {
|
|
159
|
+
export const project = (a: Point, b: Point, output: Point | null = null) => {
|
|
160
160
|
const result = output || new Point();
|
|
161
161
|
const amt = a.dot(b) / b.getMagnitudeSq();
|
|
162
162
|
if (amt !== 0) {
|
|
@@ -172,7 +172,7 @@ export const project = (a: Point, b: Point, output: Point = null) => {
|
|
|
172
172
|
* @param {Point} output - The point to store the result in (optional).
|
|
173
173
|
* @returns {Point} A new point with the projected result.
|
|
174
174
|
*/
|
|
175
|
-
export const projectUnit = (a: Point, b: Point, output: Point = null) => {
|
|
175
|
+
export const projectUnit = (a: Point, b: Point, output: Point | null = null) => {
|
|
176
176
|
const result = output || new Point();
|
|
177
177
|
const amt = a.dot(b);
|
|
178
178
|
if (amt !== 0) {
|
|
@@ -187,7 +187,7 @@ export const projectUnit = (a: Point, b: Point, output: Point = null) => {
|
|
|
187
187
|
* @param {Point} output - The point to store the result in (optional).
|
|
188
188
|
* @returns {Point} A new point with the same x coordinate but negated y coordinate.
|
|
189
189
|
*/
|
|
190
|
-
export const normalRightHand = (a: Point, output: Point = null) => {
|
|
190
|
+
export const normalRightHand = (a: Point, output: Point | null = null) => {
|
|
191
191
|
const result = output || new Point();
|
|
192
192
|
return result.setTo(a.y * -1, a.x);
|
|
193
193
|
};
|
|
@@ -198,7 +198,7 @@ export const normalRightHand = (a: Point, output: Point = null) => {
|
|
|
198
198
|
* @param {Point} output - The point to store the result in (optional).
|
|
199
199
|
* @returns {Point} A new normalized point.
|
|
200
200
|
*/
|
|
201
|
-
export const normalize = (a: Point, output: Point = null) => {
|
|
201
|
+
export const normalize = (a: Point, output: Point | null = null) => {
|
|
202
202
|
const result = output || new Point();
|
|
203
203
|
const m = a.getMagnitude();
|
|
204
204
|
if (m !== 0) {
|
|
@@ -251,7 +251,7 @@ export const rotate = (
|
|
|
251
251
|
* @returns {Point} A new point representing the centroid of the input points.
|
|
252
252
|
* @throws {Error} If the points array is empty.
|
|
253
253
|
*/
|
|
254
|
-
export const centroid = (points: Point[], output: Point = null) => {
|
|
254
|
+
export const centroid = (points: Point[], output: Point | null = null) => {
|
|
255
255
|
const result = output || new Point();
|
|
256
256
|
const pointsLen = points.length;
|
|
257
257
|
if (pointsLen < 1) {
|
|
@@ -292,7 +292,7 @@ export const parse = (obj: any, xProp: string = 'x', yProp: string = 'y') => {
|
|
|
292
292
|
* @param {Point} output - The point to store the result in (optional).
|
|
293
293
|
* @returns {Point} A new point with the same coordinates as the input.
|
|
294
294
|
*/
|
|
295
|
-
export const clone = (input: Point, output: Point = null) => {
|
|
295
|
+
export const clone = (input: Point, output: Point | null = null) => {
|
|
296
296
|
const result = output || new Point();
|
|
297
297
|
result.setTo(input.x, input.y);
|
|
298
298
|
return result;
|
|
@@ -6,7 +6,7 @@ import { Polygon } from '../polygon.js';
|
|
|
6
6
|
* @param {Polygon} output - Optional polygon to store the result in.
|
|
7
7
|
* @returns {Polygon} The cloned polygon.
|
|
8
8
|
*/
|
|
9
|
-
export const clone = (input: Polygon, output: Polygon = null) => {
|
|
9
|
+
export const clone = (input: Polygon, output: Polygon | null = null) => {
|
|
10
10
|
const result = output || new Polygon();
|
|
11
11
|
result.setTo(input._points.slice());
|
|
12
12
|
return result;
|
|
@@ -32,7 +32,7 @@ export const inflatePoint = (a: Rectangle, point: any) => {
|
|
|
32
32
|
* @param {Point} output - Optional point to store the result in.
|
|
33
33
|
* @returns {Point} The size of the rectangle as a point (width, height).
|
|
34
34
|
*/
|
|
35
|
-
export const size = (a: Rectangle, output: Point = null) => {
|
|
35
|
+
export const size = (a: Rectangle, output: Point | null = null) => {
|
|
36
36
|
const result = output || new Point();
|
|
37
37
|
result.setTo(a.width, a.height);
|
|
38
38
|
return result;
|
|
@@ -44,7 +44,7 @@ export const size = (a: Rectangle, output: Point = null) => {
|
|
|
44
44
|
* @param {Rectangle} output - Optional rectangle to store the result in.
|
|
45
45
|
* @returns {Rectangle} The cloned rectangle.
|
|
46
46
|
*/
|
|
47
|
-
export const clone = (input: Rectangle, output: Rectangle = null) => {
|
|
47
|
+
export const clone = (input: Rectangle, output: Rectangle | null = null) => {
|
|
48
48
|
const result = output || new Rectangle();
|
|
49
49
|
result.setTo(input.x, input.y, input.width, input.height);
|
|
50
50
|
return result;
|
|
@@ -141,7 +141,7 @@ export const intersects = (a: Rectangle, b: Rectangle) => {
|
|
|
141
141
|
* @param {Rectangle} output - Optional rectangle to store the result in.
|
|
142
142
|
* @returns {Rectangle} The intersection of the rectangles, or an empty rectangle if they don't intersect.
|
|
143
143
|
*/
|
|
144
|
-
export const intersection = (a: Rectangle, b: Rectangle, output: Rectangle = null) => {
|
|
144
|
+
export const intersection = (a: Rectangle, b: Rectangle, output: Rectangle | null = null) => {
|
|
145
145
|
const result = output || new Rectangle();
|
|
146
146
|
if (intersects(a, b)) {
|
|
147
147
|
result.x = Math.max(a.x, b.x);
|
|
@@ -185,7 +185,7 @@ export const intersectsRaw = (
|
|
|
185
185
|
* @param {Rectangle} output - Optional rectangle to store the result in.
|
|
186
186
|
* @returns {Rectangle} The union of the rectangles.
|
|
187
187
|
*/
|
|
188
|
-
export const union = (a: Rectangle, b: Rectangle, output: Rectangle = null) => {
|
|
188
|
+
export const union = (a: Rectangle, b: Rectangle, output: Rectangle | null = null) => {
|
|
189
189
|
const result = output || new Rectangle();
|
|
190
190
|
return result.setTo(
|
|
191
191
|
Math.min(a.x, b.x),
|
|
@@ -201,7 +201,7 @@ export const union = (a: Rectangle, b: Rectangle, output: Rectangle = null) => {
|
|
|
201
201
|
* @param {Rectangle} output - Optional rectangle to store the result in.
|
|
202
202
|
* @returns {Rectangle} The AABB of the points.
|
|
203
203
|
*/
|
|
204
|
-
export const aabb = (points: Point[], output: Rectangle = null) => {
|
|
204
|
+
export const aabb = (points: Point[], output: Rectangle | null = null) => {
|
|
205
205
|
const result = output || new Rectangle();
|
|
206
206
|
let xMax = Number.NEGATIVE_INFINITY;
|
|
207
207
|
let xMin = Number.POSITIVE_INFINITY;
|
|
@@ -6,7 +6,7 @@ import { RoundedRectangle } from '../rounded_rectangle.js';
|
|
|
6
6
|
* @param {RoundedRectangle} output - Optional rounded rectangle to store the result in.
|
|
7
7
|
* @returns {RoundedRectangle} The cloned rounded rectangle.
|
|
8
8
|
*/
|
|
9
|
-
export const clone = (input: RoundedRectangle, output: RoundedRectangle = null) => {
|
|
9
|
+
export const clone = (input: RoundedRectangle, output: RoundedRectangle | null = null) => {
|
|
10
10
|
const result = output || new RoundedRectangle();
|
|
11
11
|
result.x = input.x;
|
|
12
12
|
result.y = input.y;
|