@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.
- package/dist/index.js +339 -323
- package/dist/index.js.map +1 -1
- package/dist/phaser/core/animation.d.ts +3 -3
- package/dist/phaser/core/animation.d.ts.map +1 -1
- package/dist/phaser/core/animation_manager.d.ts.map +1 -1
- package/dist/phaser/core/animation_parser.d.ts +27 -2
- package/dist/phaser/core/animation_parser.d.ts.map +1 -1
- package/dist/phaser/core/array_set.d.ts +11 -11
- package/dist/phaser/core/array_set.d.ts.map +1 -1
- package/dist/phaser/core/cache.d.ts.map +1 -1
- package/dist/phaser/core/callback.d.ts.map +1 -1
- package/dist/phaser/core/dom.d.ts +125 -19
- package/dist/phaser/core/dom.d.ts.map +1 -1
- package/dist/phaser/core/factory.d.ts +3 -2
- package/dist/phaser/core/factory.d.ts.map +1 -1
- package/dist/phaser/core/input.d.ts +3 -2
- package/dist/phaser/core/input.d.ts.map +1 -1
- package/dist/phaser/core/input_handler.d.ts.map +1 -1
- package/dist/phaser/core/input_mouse.d.ts +5 -1
- package/dist/phaser/core/input_mouse.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 +8 -8
- package/dist/phaser/core/input_touch.d.ts.map +1 -1
- package/dist/phaser/core/loader.d.ts +11 -2
- package/dist/phaser/core/loader.d.ts.map +1 -1
- package/dist/phaser/core/loader_parser.d.ts +14 -1
- package/dist/phaser/core/loader_parser.d.ts.map +1 -1
- package/dist/phaser/core/raf.d.ts +1 -1
- package/dist/phaser/core/raf.d.ts.map +1 -1
- package/dist/phaser/core/scale_manager.d.ts.map +1 -1
- package/dist/phaser/core/scene_manager.d.ts.map +1 -1
- package/dist/phaser/core/signal.d.ts.map +1 -1
- 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/stage.d.ts +16 -6
- 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 +1 -1
- package/dist/phaser/core/timer.d.ts.map +1 -1
- package/dist/phaser/core/tween.d.ts +13 -5
- package/dist/phaser/core/tween.d.ts.map +1 -1
- package/dist/phaser/core/tween_data.d.ts +9 -7
- package/dist/phaser/core/tween_data.d.ts.map +1 -1
- package/dist/phaser/core/tween_manager.d.ts.map +1 -1
- package/dist/phaser/display/button.d.ts +6 -5
- package/dist/phaser/display/button.d.ts.map +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts +1 -1
- package/dist/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/dist/phaser/display/canvas/masker.d.ts +1 -1
- package/dist/phaser/display/canvas/masker.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 +9 -8
- package/dist/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/dist/phaser/display/display_object.d.ts +3 -1
- 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/group.d.ts +1 -1
- package/dist/phaser/display/group.d.ts.map +1 -1
- package/dist/phaser/display/image.d.ts +6 -5
- package/dist/phaser/display/image.d.ts.map +1 -1
- package/dist/phaser/display/sprite_util.d.ts +3 -2
- package/dist/phaser/display/sprite_util.d.ts.map +1 -1
- package/dist/phaser/display/text.d.ts +2 -16
- package/dist/phaser/display/text.d.ts.map +1 -1
- package/dist/phaser/display/webgl/abstract_filter.d.ts +14 -8
- package/dist/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/dist/phaser/display/webgl/blend_manager.d.ts +2 -3
- package/dist/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts +11 -5
- package/dist/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_manager.d.ts +6 -4
- package/dist/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/filter_texture.d.ts +4 -4
- package/dist/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/graphics.d.ts +2 -2
- package/dist/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/dist/phaser/display/webgl/mask_manager.d.ts +3 -2
- package/dist/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/render_texture.d.ts +11 -8
- package/dist/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/dist/phaser/display/webgl/renderer.d.ts +8 -4
- package/dist/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/dist/phaser/display/webgl/shader/normal.d.ts +28 -3
- package/dist/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/dist/phaser/display/webgl/sprite_batch.d.ts +6 -5
- package/dist/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/dist/phaser/display/webgl/stencil_manager.d.ts +3 -3
- package/dist/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/dist/phaser/display/webgl/texture_util.d.ts +2 -2
- package/dist/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/dist/phaser/display/webgl/util.d.ts +1 -1
- package/dist/phaser/display/webgl/util.d.ts.map +1 -1
- package/dist/phaser/geom/circle.d.ts.map +1 -1
- package/dist/phaser/geom/line.d.ts +10 -1
- package/dist/phaser/geom/line.d.ts.map +1 -1
- package/dist/phaser/geom/rectangle.d.ts.map +1 -1
- package/dist/phaser/geom/util/circle.d.ts +2 -1
- package/dist/phaser/geom/util/circle.d.ts.map +1 -1
- package/dist/phaser/geom/util/point.d.ts +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 +1 -1
- package/src/phaser/core/animation.ts +4 -4
- package/src/phaser/core/animation_manager.ts +10 -10
- package/src/phaser/core/animation_parser.ts +30 -24
- package/src/phaser/core/array_set.ts +27 -27
- package/src/phaser/core/cache.test.ts +33 -33
- package/src/phaser/core/cache.ts +3 -3
- package/src/phaser/core/callback.ts +1 -0
- package/src/phaser/core/callback_context.test.ts +8 -8
- package/src/phaser/core/dom.ts +15 -5
- package/src/phaser/core/factory.ts +9 -2
- package/src/phaser/core/frame_data.test.ts +23 -23
- package/src/phaser/core/input.ts +9 -8
- package/src/phaser/core/input_handler.test.ts +18 -18
- package/src/phaser/core/input_handler.ts +1 -1
- package/src/phaser/core/input_mouse.ts +9 -8
- package/src/phaser/core/input_pointer.test.ts +26 -26
- package/src/phaser/core/input_pointer.ts +3 -3
- package/src/phaser/core/input_touch.ts +8 -8
- package/src/phaser/core/loader.test.ts +26 -26
- package/src/phaser/core/loader.ts +25 -25
- package/src/phaser/core/loader_parser.test.ts +16 -16
- package/src/phaser/core/loader_parser.ts +16 -6
- package/src/phaser/core/raf.ts +1 -1
- package/src/phaser/core/registry.test.ts +6 -6
- package/src/phaser/core/scale_manager.ts +2 -2
- package/src/phaser/core/scene_manager.test.ts +30 -30
- package/src/phaser/core/scene_manager.ts +1 -1
- package/src/phaser/core/signal.test.ts +8 -8
- package/src/phaser/core/signal.ts +1 -1
- package/src/phaser/core/signal_dispatch.test.ts +30 -30
- package/src/phaser/core/sound.ts +20 -8
- package/src/phaser/core/sound_manager.ts +6 -6
- package/src/phaser/core/stage.ts +19 -9
- package/src/phaser/core/time.ts +1 -1
- package/src/phaser/core/timer.test.ts +47 -47
- package/src/phaser/core/timer.ts +1 -1
- package/src/phaser/core/tween.ts +28 -25
- package/src/phaser/core/tween_data.test.ts +119 -0
- package/src/phaser/core/tween_data.ts +54 -39
- package/src/phaser/core/tween_easing.test.ts +5 -5
- package/src/phaser/core/tween_manager.ts +2 -2
- package/src/phaser/display/bitmap_text.test.ts +30 -30
- package/src/phaser/display/button.ts +8 -6
- package/src/phaser/display/canvas/buffer.ts +2 -2
- package/src/phaser/display/canvas/masker.ts +1 -1
- package/src/phaser/display/canvas/pool.test.ts +20 -20
- package/src/phaser/display/canvas/pool.ts +3 -3
- package/src/phaser/display/canvas/renderer.ts +12 -11
- package/src/phaser/display/canvas/util.test.ts +25 -25
- package/src/phaser/display/display_object.ts +3 -1
- package/src/phaser/display/graphics.test.ts +70 -20
- package/src/phaser/display/graphics.ts +38 -32
- package/src/phaser/display/group.ts +4 -4
- package/src/phaser/display/image.ts +28 -25
- package/src/phaser/display/sprite_util.ts +3 -2
- package/src/phaser/display/text.test.ts +28 -25
- package/src/phaser/display/text.ts +21 -18
- package/src/phaser/display/webgl/abstract_filter.ts +20 -10
- package/src/phaser/display/webgl/blend_manager.ts +4 -5
- package/src/phaser/display/webgl/earcut.test.ts +20 -20
- package/src/phaser/display/webgl/fast_sprite_batch.ts +21 -16
- package/src/phaser/display/webgl/filter_manager.ts +7 -4
- package/src/phaser/display/webgl/filter_texture.ts +5 -5
- package/src/phaser/display/webgl/graphics.ts +2 -2
- package/src/phaser/display/webgl/mask_manager.ts +9 -14
- package/src/phaser/display/webgl/render_texture.ts +15 -14
- package/src/phaser/display/webgl/renderer.ts +7 -6
- package/src/phaser/display/webgl/shader/normal.ts +41 -31
- package/src/phaser/display/webgl/shader/shader.test.ts +24 -24
- package/src/phaser/display/webgl/shader_manager.test.ts +18 -18
- package/src/phaser/display/webgl/sprite_batch.ts +8 -8
- package/src/phaser/display/webgl/stencil_manager.ts +4 -4
- package/src/phaser/display/webgl/texture_util.ts +2 -2
- package/src/phaser/display/webgl/util.ts +1 -1
- package/src/phaser/geom/circle.test.ts +38 -38
- package/src/phaser/geom/circle.ts +7 -7
- package/src/phaser/geom/ellipse.test.ts +12 -12
- package/src/phaser/geom/line.test.ts +15 -15
- package/src/phaser/geom/line.ts +5 -2
- package/src/phaser/geom/matrix.test.ts +31 -31
- package/src/phaser/geom/point.test.ts +31 -31
- package/src/phaser/geom/polygon.test.ts +27 -27
- package/src/phaser/geom/rectangle.test.ts +87 -87
- package/src/phaser/geom/rectangle.ts +11 -11
- package/src/phaser/geom/rounded_rectangle.test.ts +9 -9
- package/src/phaser/geom/util/circle.test.ts +5 -5
- package/src/phaser/geom/util/circle.ts +2 -1
- package/src/phaser/geom/util/ellipse.test.ts +2 -2
- package/src/phaser/geom/util/line.test.ts +2 -2
- package/src/phaser/geom/util/matrix.test.ts +4 -4
- package/src/phaser/geom/util/point.test.ts +2 -2
- package/src/phaser/geom/util/point.ts +1 -1
- package/src/phaser/geom/util/polygon.test.ts +2 -2
- package/src/phaser/geom/util/rectangle.test.ts +2 -2
- package/src/phaser/geom/util/rectangle.ts +1 -1
- package/src/phaser/geom/util/rounded_rectangle.test.ts +2 -2
- package/src/phaser/util/math.test.ts +41 -41
- package/src/phaser/util/math.ts +5 -2
|
@@ -23,29 +23,29 @@ const createStubGl = (options: StubOptions = {}) => {
|
|
|
23
23
|
createShader: vi.fn(() => ({})),
|
|
24
24
|
shaderSource: vi.fn(),
|
|
25
25
|
compileShader: vi.fn(),
|
|
26
|
-
getShaderParameter: vi.fn(() => true),
|
|
27
|
-
getShaderInfoLog: vi.fn(() => ''),
|
|
28
|
-
createProgram: vi.fn(() => program),
|
|
26
|
+
getShaderParameter: vi.fn((): boolean => true),
|
|
27
|
+
getShaderInfoLog: vi.fn((): string => ''),
|
|
28
|
+
createProgram: vi.fn((): object | null => program),
|
|
29
29
|
attachShader: vi.fn(),
|
|
30
30
|
linkProgram: vi.fn(),
|
|
31
|
-
getProgramParameter: vi.fn(() => linkStatus),
|
|
32
|
-
getProgramInfoLog: vi.fn(() => 'link failed'),
|
|
31
|
+
getProgramParameter: vi.fn((): boolean => linkStatus),
|
|
32
|
+
getProgramInfoLog: vi.fn((): string => 'link failed'),
|
|
33
33
|
useProgram,
|
|
34
34
|
deleteProgram,
|
|
35
|
-
getUniformLocation: vi.fn((_program: unknown, name: string) => {
|
|
35
|
+
getUniformLocation: vi.fn((_program: unknown, name: string): object | undefined => {
|
|
36
36
|
if (!uniformLocations.has(name)) {
|
|
37
37
|
uniformLocations.set(name, { name });
|
|
38
38
|
}
|
|
39
39
|
return uniformLocations.get(name);
|
|
40
40
|
}),
|
|
41
|
-
getAttribLocation: vi.fn((_program: unknown, name: string) => attribLocations[name] ?? 0),
|
|
41
|
+
getAttribLocation: vi.fn((_program: unknown, name: string): number => attribLocations[name] ?? 0),
|
|
42
42
|
} as unknown as WebGLRenderingContext;
|
|
43
43
|
return { gl, deleteProgram, useProgram };
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
describe('WebGL shaders', () => {
|
|
47
|
-
describe('PrimitiveShader', () => {
|
|
48
|
-
it('resolves its uniforms and attributes on construction', () => {
|
|
46
|
+
describe('WebGL shaders', (): void => {
|
|
47
|
+
describe('PrimitiveShader', (): void => {
|
|
48
|
+
it('resolves its uniforms and attributes on construction', (): void => {
|
|
49
49
|
const { gl } = createStubGl({ attribLocations: { aVertexPosition: 0, aColor: 1 } });
|
|
50
50
|
const shader = new PrimitiveShader(gl);
|
|
51
51
|
expect(shader.program).not.toBeNull();
|
|
@@ -53,7 +53,7 @@ describe('WebGL shaders', () => {
|
|
|
53
53
|
expect(shader.attributes).toStrictEqual([0, 1]);
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
it('releases the program on destroy', () => {
|
|
56
|
+
it('releases the program on destroy', (): void => {
|
|
57
57
|
const { gl, deleteProgram } = createStubGl();
|
|
58
58
|
const shader = new PrimitiveShader(gl);
|
|
59
59
|
shader.destroy();
|
|
@@ -62,24 +62,24 @@ describe('WebGL shaders', () => {
|
|
|
62
62
|
expect(shader.gl).toBeNull();
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
it('leaves the program null when compilation fails', () => {
|
|
65
|
+
it('leaves the program null when compilation fails', (): void => {
|
|
66
66
|
const { gl, useProgram } = createStubGl({ program: null });
|
|
67
67
|
const shader = new PrimitiveShader(gl);
|
|
68
68
|
expect(shader.program).toBeNull();
|
|
69
69
|
expect(useProgram).not.toHaveBeenCalled();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
|
-
it('destroys cleanly after a failed compile', () => {
|
|
72
|
+
it('destroys cleanly after a failed compile', (): void => {
|
|
73
73
|
const { gl } = createStubGl({ program: null });
|
|
74
74
|
const shader = new PrimitiveShader(gl);
|
|
75
|
-
expect(() => {
|
|
75
|
+
expect((): void => {
|
|
76
76
|
shader.destroy();
|
|
77
77
|
}).not.toThrow();
|
|
78
78
|
});
|
|
79
79
|
});
|
|
80
80
|
|
|
81
|
-
describe('StripShader', () => {
|
|
82
|
-
it('resolves its uniforms and attributes on construction', () => {
|
|
81
|
+
describe('StripShader', (): void => {
|
|
82
|
+
it('resolves its uniforms and attributes on construction', (): void => {
|
|
83
83
|
const { gl } = createStubGl({
|
|
84
84
|
attribLocations: { aVertexPosition: 0, aTextureCoord: 1, aColor: 2 },
|
|
85
85
|
});
|
|
@@ -89,7 +89,7 @@ describe('WebGL shaders', () => {
|
|
|
89
89
|
expect(shader.translationMatrix).toBeDefined();
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
it('clears its attributes on destroy', () => {
|
|
92
|
+
it('clears its attributes on destroy', (): void => {
|
|
93
93
|
const { gl } = createStubGl();
|
|
94
94
|
const shader = new StripShader(gl);
|
|
95
95
|
shader.destroy();
|
|
@@ -97,8 +97,8 @@ describe('WebGL shaders', () => {
|
|
|
97
97
|
});
|
|
98
98
|
});
|
|
99
99
|
|
|
100
|
-
describe('ComplexPrimitiveShader', () => {
|
|
101
|
-
it('resolves the uniforms it declares', () => {
|
|
100
|
+
describe('ComplexPrimitiveShader', (): void => {
|
|
101
|
+
it('resolves the uniforms it declares', (): void => {
|
|
102
102
|
const { gl } = createStubGl();
|
|
103
103
|
const shader = new ComplexPrimitiveShader(gl);
|
|
104
104
|
expect(shader.tintColor).toBeDefined();
|
|
@@ -106,7 +106,7 @@ describe('WebGL shaders', () => {
|
|
|
106
106
|
expect(shader.flipY).toBeDefined();
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
it('leaves colorAttribute unresolved, as the shader never reads aColor', () => {
|
|
109
|
+
it('leaves colorAttribute unresolved, as the shader never reads aColor', (): void => {
|
|
110
110
|
const { gl } = createStubGl();
|
|
111
111
|
const shader = new ComplexPrimitiveShader(gl);
|
|
112
112
|
expect(shader.colorAttribute).toBeUndefined();
|
|
@@ -114,8 +114,8 @@ describe('WebGL shaders', () => {
|
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
describe('FastShader', () => {
|
|
118
|
-
it('resolves the full attribute set in batch order', () => {
|
|
117
|
+
describe('FastShader', (): void => {
|
|
118
|
+
it('resolves the full attribute set in batch order', (): void => {
|
|
119
119
|
const { gl } = createStubGl({
|
|
120
120
|
attribLocations: {
|
|
121
121
|
aVertexPosition: 0,
|
|
@@ -130,13 +130,13 @@ describe('WebGL shaders', () => {
|
|
|
130
130
|
expect(shader.attributes).toStrictEqual([0, 1, 2, 3, 4, 5]);
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
it('falls back to slot 2 when the driver reports aColor as -1', () => {
|
|
133
|
+
it('falls back to slot 2 when the driver reports aColor as -1', (): void => {
|
|
134
134
|
const { gl } = createStubGl({ attribLocations: { aColor: -1 } });
|
|
135
135
|
const shader = new FastShader(gl);
|
|
136
136
|
expect(shader.colorAttribute).toBe(2);
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
it('releases the program and buffers on destroy', () => {
|
|
139
|
+
it('releases the program and buffers on destroy', (): void => {
|
|
140
140
|
const { gl, deleteProgram } = createStubGl();
|
|
141
141
|
const shader = new FastShader(gl);
|
|
142
142
|
shader.destroy();
|
|
@@ -21,17 +21,17 @@ const createManager = (): { manager: WebGLShaderManager; gl: GlMocks } => {
|
|
|
21
21
|
const shaderStub = (uid: string, attributes: number[]): NormalShader =>
|
|
22
22
|
({ _UID: uid, program: {}, attributes }) as unknown as NormalShader;
|
|
23
23
|
|
|
24
|
-
describe('WebGLShaderManager', () => {
|
|
25
|
-
describe('constructor', () => {
|
|
26
|
-
it('starts with ten disabled attribute slots', () => {
|
|
24
|
+
describe('WebGLShaderManager', (): void => {
|
|
25
|
+
describe('constructor', (): void => {
|
|
26
|
+
it('starts with ten disabled attribute slots', (): void => {
|
|
27
27
|
const manager = new WebGLShaderManager();
|
|
28
28
|
expect(manager.attribState).toHaveLength(10);
|
|
29
|
-
expect(manager.attribState.every((enabled) => enabled === false)).toBe(true);
|
|
29
|
+
expect(manager.attribState.every((enabled): boolean => enabled === false)).toBe(true);
|
|
30
30
|
});
|
|
31
31
|
});
|
|
32
32
|
|
|
33
|
-
describe('setAttribs', () => {
|
|
34
|
-
it('enables exactly the requested attribute slots', () => {
|
|
33
|
+
describe('setAttribs', (): void => {
|
|
34
|
+
it('enables exactly the requested attribute slots', (): void => {
|
|
35
35
|
const { manager, gl } = createManager();
|
|
36
36
|
manager.setAttribs([0, 2]);
|
|
37
37
|
expect(gl.enableVertexAttribArray).toHaveBeenCalledTimes(2);
|
|
@@ -39,7 +39,7 @@ describe('WebGLShaderManager', () => {
|
|
|
39
39
|
expect(gl.enableVertexAttribArray).toHaveBeenCalledWith(2);
|
|
40
40
|
});
|
|
41
41
|
|
|
42
|
-
it('only touches slots whose state actually changed', () => {
|
|
42
|
+
it('only touches slots whose state actually changed', (): void => {
|
|
43
43
|
const { manager, gl } = createManager();
|
|
44
44
|
manager.setAttribs([0, 1]);
|
|
45
45
|
vi.clearAllMocks();
|
|
@@ -48,7 +48,7 @@ describe('WebGLShaderManager', () => {
|
|
|
48
48
|
expect(gl.disableVertexAttribArray).not.toHaveBeenCalled();
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
it('disables slots dropped between calls', () => {
|
|
51
|
+
it('disables slots dropped between calls', (): void => {
|
|
52
52
|
const { manager, gl } = createManager();
|
|
53
53
|
manager.setAttribs([0, 1, 2]);
|
|
54
54
|
vi.clearAllMocks();
|
|
@@ -58,13 +58,13 @@ describe('WebGLShaderManager', () => {
|
|
|
58
58
|
expect(gl.enableVertexAttribArray).not.toHaveBeenCalled();
|
|
59
59
|
});
|
|
60
60
|
|
|
61
|
-
it('mirrors the sparse temp state, leaving untouched slots unset', () => {
|
|
61
|
+
it('mirrors the sparse temp state, leaving untouched slots unset', (): void => {
|
|
62
62
|
const { manager } = createManager();
|
|
63
63
|
manager.setAttribs([1, 3]);
|
|
64
64
|
expect(manager.attribState.slice(0, 4)).toStrictEqual([undefined, true, undefined, true]);
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
it('disables the previously enabled slots when given no attributes', () => {
|
|
67
|
+
it('disables the previously enabled slots when given no attributes', (): void => {
|
|
68
68
|
const { manager, gl } = createManager();
|
|
69
69
|
manager.setAttribs([0, 1]);
|
|
70
70
|
vi.clearAllMocks();
|
|
@@ -76,8 +76,8 @@ describe('WebGLShaderManager', () => {
|
|
|
76
76
|
});
|
|
77
77
|
});
|
|
78
78
|
|
|
79
|
-
describe('setShader', () => {
|
|
80
|
-
it('binds a new shader and reports that it switched', () => {
|
|
79
|
+
describe('setShader', (): void => {
|
|
80
|
+
it('binds a new shader and reports that it switched', (): void => {
|
|
81
81
|
const { manager, gl } = createManager();
|
|
82
82
|
const shader = shaderStub('a', [0, 1]);
|
|
83
83
|
expect(manager.setShader(shader)).toBe(true);
|
|
@@ -85,7 +85,7 @@ describe('WebGLShaderManager', () => {
|
|
|
85
85
|
expect(gl.useProgram).toHaveBeenCalledWith(shader.program);
|
|
86
86
|
});
|
|
87
87
|
|
|
88
|
-
it('skips rebinding the shader already in use', () => {
|
|
88
|
+
it('skips rebinding the shader already in use', (): void => {
|
|
89
89
|
const { manager, gl } = createManager();
|
|
90
90
|
const shader = shaderStub('a', [0, 1]);
|
|
91
91
|
manager.setShader(shader);
|
|
@@ -94,7 +94,7 @@ describe('WebGLShaderManager', () => {
|
|
|
94
94
|
expect(gl.useProgram).not.toHaveBeenCalled();
|
|
95
95
|
});
|
|
96
96
|
|
|
97
|
-
it('rebinds when a different shader is supplied', () => {
|
|
97
|
+
it('rebinds when a different shader is supplied', (): void => {
|
|
98
98
|
const { manager } = createManager();
|
|
99
99
|
manager.setShader(shaderStub('a', [0]));
|
|
100
100
|
const next = shaderStub('b', [0, 1]);
|
|
@@ -103,8 +103,8 @@ describe('WebGLShaderManager', () => {
|
|
|
103
103
|
});
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
-
describe('destroy', () => {
|
|
107
|
-
it('clears attribute state and forgets the current shader', () => {
|
|
106
|
+
describe('destroy', (): void => {
|
|
107
|
+
it('clears attribute state and forgets the current shader', (): void => {
|
|
108
108
|
const { manager } = createManager();
|
|
109
109
|
manager.setShader(shaderStub('a', [0]));
|
|
110
110
|
manager.destroy();
|
|
@@ -114,9 +114,9 @@ describe('WebGLShaderManager', () => {
|
|
|
114
114
|
expect(manager._currentId).toBeNull();
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
it('tolerates shaders that were never created', () => {
|
|
117
|
+
it('tolerates shaders that were never created', (): void => {
|
|
118
118
|
const { manager } = createManager();
|
|
119
|
-
expect(() => {
|
|
119
|
+
expect((): void => {
|
|
120
120
|
manager.destroy();
|
|
121
121
|
}).not.toThrow();
|
|
122
122
|
});
|
|
@@ -16,13 +16,13 @@ export class WebGLSpriteBatch {
|
|
|
16
16
|
public lastIndexCount: number;
|
|
17
17
|
public drawing: boolean;
|
|
18
18
|
public currentBatchSize: number;
|
|
19
|
-
public currentBaseTexture:
|
|
19
|
+
public currentBaseTexture: BaseTexture | null;
|
|
20
20
|
public dirty: boolean;
|
|
21
|
-
public textures:
|
|
21
|
+
public textures: BaseTexture[];
|
|
22
22
|
public blendModes: number[];
|
|
23
23
|
public shaders: NormalShader[];
|
|
24
|
-
public sprites:
|
|
25
|
-
public defaultShader:
|
|
24
|
+
public sprites: Image[];
|
|
25
|
+
public defaultShader: AbstractFilter;
|
|
26
26
|
public gl!: IdentifiedWebGLRenderingContext;
|
|
27
27
|
public vertexBuffer!: WebGLBuffer | null;
|
|
28
28
|
public indexBuffer!: WebGLBuffer | null;
|
|
@@ -234,7 +234,7 @@ export class WebGLSpriteBatch {
|
|
|
234
234
|
// bind the buffers
|
|
235
235
|
gl.bindBuffer(gl.ARRAY_BUFFER, this.vertexBuffer);
|
|
236
236
|
gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, this.indexBuffer);
|
|
237
|
-
shader = this.defaultShader.shaders[gl.id]
|
|
237
|
+
shader = this.defaultShader.shaders[gl.id]!;
|
|
238
238
|
// this is the same for each shader?
|
|
239
239
|
const stride = this.vertSize * 4;
|
|
240
240
|
gl.vertexAttribPointer(shader.aVertexPosition, 2, gl.FLOAT, false, stride, 0);
|
|
@@ -261,7 +261,7 @@ export class WebGLSpriteBatch {
|
|
|
261
261
|
let shaderSwap = false;
|
|
262
262
|
let sprite;
|
|
263
263
|
for (let i = 0, j = this.currentBatchSize; i < j; i += 1) {
|
|
264
|
-
sprite = this.sprites[i]
|
|
264
|
+
sprite = this.sprites[i]!;
|
|
265
265
|
nextTexture = sprite.tilingTexture ? sprite.tilingTexture.baseTexture : sprite.texture.baseTexture;
|
|
266
266
|
nextBlendMode = sprite.blendMode;
|
|
267
267
|
nextShader = sprite.shader ?? this.defaultShader;
|
|
@@ -317,8 +317,8 @@ export class WebGLSpriteBatch {
|
|
|
317
317
|
* @param {number} size - The size of the batch.
|
|
318
318
|
* @param {number} startIndex - The start index in the batch.
|
|
319
319
|
*/
|
|
320
|
-
public renderBatch(texture: BaseTexture, size: number, startIndex: number): void {
|
|
321
|
-
if (size === 0) {
|
|
320
|
+
public renderBatch(texture: BaseTexture | null, size: number, startIndex: number): void {
|
|
321
|
+
if (size === 0 || !texture) {
|
|
322
322
|
return;
|
|
323
323
|
}
|
|
324
324
|
const { gl } = this;
|
|
@@ -5,9 +5,9 @@ import type { RenderSession } from '../render_session.js';
|
|
|
5
5
|
|
|
6
6
|
export class WebGLStencilManager {
|
|
7
7
|
public gl!: WebGLRenderingContext;
|
|
8
|
-
public stencilStack!:
|
|
9
|
-
public reverse!:
|
|
10
|
-
public count!:
|
|
8
|
+
public stencilStack!: GraphicsData[];
|
|
9
|
+
public reverse!: boolean;
|
|
10
|
+
public count!: number;
|
|
11
11
|
/**
|
|
12
12
|
* Initializes the stencil manager.
|
|
13
13
|
*/
|
|
@@ -29,7 +29,7 @@ export class WebGLStencilManager {
|
|
|
29
29
|
* Sets up the stencil buffer for rendering.
|
|
30
30
|
*/
|
|
31
31
|
public destroy(): void {
|
|
32
|
-
this.stencilStack =
|
|
32
|
+
this.stencilStack = [];
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
/**
|
|
@@ -7,7 +7,7 @@ import { Texture } from './texture.js';
|
|
|
7
7
|
* @param {number} [scaleMode] - The scale mode to use for the texture.
|
|
8
8
|
* @returns {BaseTexture} The newly created BaseTexture instance.
|
|
9
9
|
*/
|
|
10
|
-
export const baseTextureFromCanvas = (canvas: HTMLCanvasElement, scaleMode
|
|
10
|
+
export const baseTextureFromCanvas = (canvas: HTMLCanvasElement, scaleMode?: number): BaseTexture => {
|
|
11
11
|
if (canvas.width === 0) {
|
|
12
12
|
canvas.width = 1;
|
|
13
13
|
}
|
|
@@ -23,5 +23,5 @@ export const baseTextureFromCanvas = (canvas: HTMLCanvasElement, scaleMode: numb
|
|
|
23
23
|
* @param {number} [scaleMode] - The scale mode to use for the texture.
|
|
24
24
|
* @returns {Texture} The newly created Texture instance.
|
|
25
25
|
*/
|
|
26
|
-
export const textureFromCanvas = (canvas: HTMLCanvasElement, scaleMode?:
|
|
26
|
+
export const textureFromCanvas = (canvas: HTMLCanvasElement, scaleMode?: number): Texture =>
|
|
27
27
|
new Texture(baseTextureFromCanvas(canvas, scaleMode));
|
|
@@ -73,7 +73,7 @@ export const initDefaultShaders = (): void => {};
|
|
|
73
73
|
export const compileShader = (
|
|
74
74
|
gl: WebGLRenderingContext,
|
|
75
75
|
shaderSrc: string[] | string,
|
|
76
|
-
shaderType:
|
|
76
|
+
shaderType: GLenum
|
|
77
77
|
): WebGLShader | null => {
|
|
78
78
|
const src = Array.isArray(shaderSrc) ? shaderSrc.join('\n') : shaderSrc;
|
|
79
79
|
const shader = gl.createShader(shaderType);
|
|
@@ -2,16 +2,16 @@ import { expect, describe, it } from 'vitest';
|
|
|
2
2
|
import { Circle } from './circle.js';
|
|
3
3
|
import { Point } from './point.js';
|
|
4
4
|
|
|
5
|
-
describe('Circle', () => {
|
|
6
|
-
describe('constructor', () => {
|
|
7
|
-
it('should initialize properties correctly when no arguments are provided', () => {
|
|
5
|
+
describe('Circle', (): void => {
|
|
6
|
+
describe('constructor', (): void => {
|
|
7
|
+
it('should initialize properties correctly when no arguments are provided', (): void => {
|
|
8
8
|
const circle = new Circle();
|
|
9
9
|
expect(circle.x).toBe(0);
|
|
10
10
|
expect(circle.y).toBe(0);
|
|
11
11
|
expect(circle.diameter).toBe(0);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
it('should initialize properties correctly when x, y, and diameter are provided', () => {
|
|
14
|
+
it('should initialize properties correctly when x, y, and diameter are provided', (): void => {
|
|
15
15
|
const circle = new Circle(10, 20, 30);
|
|
16
16
|
expect(circle.x).toBe(10);
|
|
17
17
|
expect(circle.y).toBe(20);
|
|
@@ -19,21 +19,21 @@ describe('Circle', () => {
|
|
|
19
19
|
});
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
describe('circumference', () => {
|
|
23
|
-
it('should calculate the circumference correctly when diameter is provided', () => {
|
|
22
|
+
describe('circumference', (): void => {
|
|
23
|
+
it('should calculate the circumference correctly when diameter is provided', (): void => {
|
|
24
24
|
const circle = new Circle(0, 0, 1);
|
|
25
25
|
expect(circle.circumference()).toBeCloseTo(Math.PI);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
|
-
it('should return Infinity when diameter is 0', () => {
|
|
28
|
+
it('should return Infinity when diameter is 0', (): void => {
|
|
29
29
|
const circle = new Circle();
|
|
30
30
|
circle.diameter = 0;
|
|
31
31
|
expect(circle.circumference()).toBe(0);
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
describe('random', () => {
|
|
36
|
-
it('should generate a random point within the circle correctly', () => {
|
|
35
|
+
describe('random', (): void => {
|
|
36
|
+
it('should generate a random point within the circle correctly', (): void => {
|
|
37
37
|
const circle = new Circle();
|
|
38
38
|
const output = new Point();
|
|
39
39
|
circle.random(output);
|
|
@@ -42,7 +42,7 @@ describe('Circle', () => {
|
|
|
42
42
|
expect(Math.hypot(output.x, output.y)).toBe(0);
|
|
43
43
|
});
|
|
44
44
|
|
|
45
|
-
it('should generate a random point within the circle correctly when output is not provided', () => {
|
|
45
|
+
it('should generate a random point within the circle correctly when output is not provided', (): void => {
|
|
46
46
|
const circle = new Circle();
|
|
47
47
|
const output = new Point();
|
|
48
48
|
circle.random(output);
|
|
@@ -52,8 +52,8 @@ describe('Circle', () => {
|
|
|
52
52
|
});
|
|
53
53
|
});
|
|
54
54
|
|
|
55
|
-
describe('getBounds', () => {
|
|
56
|
-
it('should calculate the bounds correctly when diameter is provided', () => {
|
|
55
|
+
describe('getBounds', (): void => {
|
|
56
|
+
it('should calculate the bounds correctly when diameter is provided', (): void => {
|
|
57
57
|
const circle = new Circle(0, 0, 1);
|
|
58
58
|
const bounds = circle.getBounds();
|
|
59
59
|
expect(bounds.x).toBe(-0.5);
|
|
@@ -62,7 +62,7 @@ describe('Circle', () => {
|
|
|
62
62
|
expect(bounds.height).toBe(1);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
it('should return empty rectangle when diameter is 0', () => {
|
|
65
|
+
it('should return empty rectangle when diameter is 0', (): void => {
|
|
66
66
|
const circle = new Circle();
|
|
67
67
|
circle.diameter = 0;
|
|
68
68
|
const bounds = circle.getBounds();
|
|
@@ -73,8 +73,8 @@ describe('Circle', () => {
|
|
|
73
73
|
});
|
|
74
74
|
});
|
|
75
75
|
|
|
76
|
-
describe('setTo', () => {
|
|
77
|
-
it('should set properties correctly when x, y, and diameter are provided', () => {
|
|
76
|
+
describe('setTo', (): void => {
|
|
77
|
+
it('should set properties correctly when x, y, and diameter are provided', (): void => {
|
|
78
78
|
const circle = new Circle();
|
|
79
79
|
circle.setTo(10, 20, 30);
|
|
80
80
|
expect(circle.x).toBe(10);
|
|
@@ -82,15 +82,15 @@ describe('Circle', () => {
|
|
|
82
82
|
expect(circle.diameter).toBe(30);
|
|
83
83
|
});
|
|
84
84
|
|
|
85
|
-
it('should set radius property correctly when diameter is changed', () => {
|
|
85
|
+
it('should set radius property correctly when diameter is changed', (): void => {
|
|
86
86
|
const circle = new Circle();
|
|
87
87
|
circle.diameter = 1;
|
|
88
88
|
expect(circle.radius).toBe(0.5);
|
|
89
89
|
});
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
describe('copyFrom', () => {
|
|
93
|
-
it('should copy properties correctly from another Circle instance', () => {
|
|
92
|
+
describe('copyFrom', (): void => {
|
|
93
|
+
it('should copy properties correctly from another Circle instance', (): void => {
|
|
94
94
|
const source = new Circle(10, 20, 30);
|
|
95
95
|
const dest = new Circle();
|
|
96
96
|
dest.copyFrom(source);
|
|
@@ -100,8 +100,8 @@ describe('Circle', () => {
|
|
|
100
100
|
});
|
|
101
101
|
});
|
|
102
102
|
|
|
103
|
-
describe('copyTo', () => {
|
|
104
|
-
it('should copy properties correctly to another Circle instance', () => {
|
|
103
|
+
describe('copyTo', (): void => {
|
|
104
|
+
it('should copy properties correctly to another Circle instance', (): void => {
|
|
105
105
|
const source = new Circle(10, 20, 30);
|
|
106
106
|
const dest = new Circle();
|
|
107
107
|
source.copyTo(dest);
|
|
@@ -111,22 +111,22 @@ describe('Circle', () => {
|
|
|
111
111
|
});
|
|
112
112
|
});
|
|
113
113
|
|
|
114
|
-
describe('distance', () => {
|
|
115
|
-
it('should calculate the distance correctly between two points within a circle', () => {
|
|
114
|
+
describe('distance', (): void => {
|
|
115
|
+
it('should calculate the distance correctly between two points within a circle', (): void => {
|
|
116
116
|
const circle = new Circle();
|
|
117
117
|
const point = new Point(1, 1);
|
|
118
118
|
expect(circle.distance(point)).toBeCloseTo(Math.hypot(point.x, point.y));
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
it('should return Infinity when diameter is 0', () => {
|
|
121
|
+
it('should return Infinity when diameter is 0', (): void => {
|
|
122
122
|
const circle = new Circle();
|
|
123
123
|
circle.diameter = 0;
|
|
124
124
|
expect(circle.distance(new Point(1, 1))).toBeCloseTo(Math.SQRT2);
|
|
125
125
|
});
|
|
126
126
|
});
|
|
127
127
|
|
|
128
|
-
describe('clone', () => {
|
|
129
|
-
it('should create a deep copy of the Circle instance correctly', () => {
|
|
128
|
+
describe('clone', (): void => {
|
|
129
|
+
it('should create a deep copy of the Circle instance correctly', (): void => {
|
|
130
130
|
const source = new Circle(10, 20, 30);
|
|
131
131
|
const clone = source.clone();
|
|
132
132
|
expect(clone.x).toBe(source.x);
|
|
@@ -135,35 +135,35 @@ describe('Circle', () => {
|
|
|
135
135
|
});
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
-
describe('contains', () => {
|
|
139
|
-
it('should determine if a point is within the circle correctly', () => {
|
|
138
|
+
describe('contains', (): void => {
|
|
139
|
+
it('should determine if a point is within the circle correctly', (): void => {
|
|
140
140
|
const circle = new Circle();
|
|
141
141
|
const point = new Point(1, 1);
|
|
142
142
|
expect(circle.contains(point.x, point.y)).toBe(false);
|
|
143
143
|
});
|
|
144
144
|
|
|
145
|
-
it('should return false when diameter is 0', () => {
|
|
145
|
+
it('should return false when diameter is 0', (): void => {
|
|
146
146
|
const circle = new Circle();
|
|
147
147
|
circle.diameter = 0;
|
|
148
148
|
expect(circle.contains(1, 1)).toBe(false);
|
|
149
149
|
});
|
|
150
150
|
});
|
|
151
151
|
|
|
152
|
-
describe('circumferencePoint', () => {
|
|
153
|
-
it('should generate a point on the circumference correctly', () => {
|
|
152
|
+
describe('circumferencePoint', (): void => {
|
|
153
|
+
it('should generate a point on the circumference correctly', (): void => {
|
|
154
154
|
const circle = new Circle();
|
|
155
155
|
expect(circle.circumferencePoint(Math.PI / 2).x).toBeCloseTo(0.5 * circle.radius);
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
it('should return null when diameter is 0', () => {
|
|
158
|
+
it('should return null when diameter is 0', (): void => {
|
|
159
159
|
const circle = new Circle();
|
|
160
160
|
circle.diameter = 0;
|
|
161
161
|
expect(circle.circumferencePoint(Math.PI / 2).type).toBe(25);
|
|
162
162
|
});
|
|
163
163
|
});
|
|
164
164
|
|
|
165
|
-
describe('offset', () => {
|
|
166
|
-
it('should offset the circle correctly by a point', () => {
|
|
165
|
+
describe('offset', (): void => {
|
|
166
|
+
it('should offset the circle correctly by a point', (): void => {
|
|
167
167
|
const circle = new Circle();
|
|
168
168
|
const point = new Point(1, 1);
|
|
169
169
|
circle.offset(point.x, point.y);
|
|
@@ -171,7 +171,7 @@ describe('Circle', () => {
|
|
|
171
171
|
expect(circle.y).toBeGreaterThan(0);
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
it('should return the Circle instance itself', () => {
|
|
174
|
+
it('should return the Circle instance itself', (): void => {
|
|
175
175
|
const circle = new Circle();
|
|
176
176
|
const point = new Point(1, 1);
|
|
177
177
|
circle.offset(point.x, point.y);
|
|
@@ -179,8 +179,8 @@ describe('Circle', () => {
|
|
|
179
179
|
});
|
|
180
180
|
});
|
|
181
181
|
|
|
182
|
-
describe('offsetPoint', () => {
|
|
183
|
-
it('should offset the circle correctly by a point', () => {
|
|
182
|
+
describe('offsetPoint', (): void => {
|
|
183
|
+
it('should offset the circle correctly by a point', (): void => {
|
|
184
184
|
const circle = new Circle();
|
|
185
185
|
const point = new Point(1, 1);
|
|
186
186
|
circle.offsetPoint(point);
|
|
@@ -189,8 +189,8 @@ describe('Circle', () => {
|
|
|
189
189
|
});
|
|
190
190
|
});
|
|
191
191
|
|
|
192
|
-
describe('toString', () => {
|
|
193
|
-
it('should generate the correct string representation of the Circle instance', () => {
|
|
192
|
+
describe('toString', (): void => {
|
|
193
|
+
it('should generate the correct string representation of the Circle instance', (): void => {
|
|
194
194
|
const circle = new Circle();
|
|
195
195
|
expect(circle.toString()).toBe('[{Circle (x=0 y=0 diameter=0 radius=0)}]');
|
|
196
196
|
});
|
|
@@ -182,7 +182,7 @@ export class Circle {
|
|
|
182
182
|
/**
|
|
183
183
|
* Sets the diameter of this circle.
|
|
184
184
|
*/
|
|
185
|
-
public set diameter(value) {
|
|
185
|
+
public set diameter(value: number) {
|
|
186
186
|
if (value > 0) {
|
|
187
187
|
this._diameter = value;
|
|
188
188
|
this._radius = value * 0.5;
|
|
@@ -200,7 +200,7 @@ export class Circle {
|
|
|
200
200
|
/**
|
|
201
201
|
* Sets the radius of this circle.
|
|
202
202
|
*/
|
|
203
|
-
public set radius(value) {
|
|
203
|
+
public set radius(value: number) {
|
|
204
204
|
if (value > 0) {
|
|
205
205
|
this._radius = value;
|
|
206
206
|
this._diameter = value * 2;
|
|
@@ -218,7 +218,7 @@ export class Circle {
|
|
|
218
218
|
/**
|
|
219
219
|
* Sets the left coordinate of this circle.
|
|
220
220
|
*/
|
|
221
|
-
public set left(value) {
|
|
221
|
+
public set left(value: number) {
|
|
222
222
|
if (value > this.x) {
|
|
223
223
|
this._radius = 0;
|
|
224
224
|
this._diameter = 0;
|
|
@@ -238,7 +238,7 @@ export class Circle {
|
|
|
238
238
|
/**
|
|
239
239
|
* Sets the right coordinate of this circle.
|
|
240
240
|
*/
|
|
241
|
-
public set right(value) {
|
|
241
|
+
public set right(value: number) {
|
|
242
242
|
if (value < this.x) {
|
|
243
243
|
this._radius = 0;
|
|
244
244
|
this._diameter = 0;
|
|
@@ -258,7 +258,7 @@ export class Circle {
|
|
|
258
258
|
/**
|
|
259
259
|
* Sets the top coordinate of this circle.
|
|
260
260
|
*/
|
|
261
|
-
public set top(value) {
|
|
261
|
+
public set top(value: number) {
|
|
262
262
|
if (value > this.y) {
|
|
263
263
|
this._radius = 0;
|
|
264
264
|
this._diameter = 0;
|
|
@@ -278,7 +278,7 @@ export class Circle {
|
|
|
278
278
|
/**
|
|
279
279
|
* Sets the bottom coordinate of this circle.
|
|
280
280
|
*/
|
|
281
|
-
public set bottom(value) {
|
|
281
|
+
public set bottom(value: number) {
|
|
282
282
|
if (value < this.y) {
|
|
283
283
|
this._radius = 0;
|
|
284
284
|
this._diameter = 0;
|
|
@@ -309,7 +309,7 @@ export class Circle {
|
|
|
309
309
|
/**
|
|
310
310
|
* Sets whether this circle is empty (zero diameter).
|
|
311
311
|
*/
|
|
312
|
-
public set empty(value) {
|
|
312
|
+
public set empty(value: boolean) {
|
|
313
313
|
if (value) {
|
|
314
314
|
this.setTo(0, 0, 0);
|
|
315
315
|
}
|