@vpmedia/phaser 1.14.0 → 1.16.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/README.md +3 -3
- package/package.json +6 -5
- package/src/index.js +15 -18
- package/src/phaser/core/animation.js +102 -6
- package/src/phaser/core/animation_manager.js +88 -10
- package/src/phaser/core/animation_parser.js +5 -20
- package/src/phaser/core/array_set.js +51 -5
- package/src/phaser/core/cache.js +291 -6
- package/src/phaser/core/const.js +107 -4
- package/src/phaser/core/device.js +5 -6
- package/src/phaser/core/device_util.js +3 -25
- package/src/phaser/core/dom.js +127 -29
- package/src/phaser/core/event_manager.js +128 -6
- package/src/phaser/core/factory.js +69 -34
- package/src/phaser/core/frame.js +43 -6
- package/src/phaser/core/frame_data.js +55 -5
- package/src/phaser/core/frame_util.js +7 -14
- package/src/phaser/core/game.js +35 -7
- package/src/phaser/core/input.js +116 -17
- package/src/phaser/core/input_handler.js +242 -42
- package/src/phaser/core/input_mouse.js +68 -7
- package/src/phaser/core/input_mspointer.js +40 -9
- package/src/phaser/core/input_pointer.js +79 -17
- package/src/phaser/core/input_touch.js +42 -5
- package/src/phaser/core/loader.js +274 -101
- package/src/phaser/core/loader_parser.js +2 -14
- package/src/phaser/core/raf.js +16 -5
- package/src/phaser/core/scale_manager.js +204 -39
- package/src/phaser/core/scene.js +24 -5
- package/src/phaser/core/scene_manager.js +81 -11
- package/src/phaser/core/signal.js +88 -11
- package/src/phaser/core/signal_binding.js +35 -15
- package/src/phaser/core/sound.js +99 -10
- package/src/phaser/core/sound_manager.js +89 -13
- package/src/phaser/core/sound_sprite.js +20 -5
- package/src/phaser/core/stage.js +43 -7
- package/src/phaser/core/time.js +67 -5
- package/src/phaser/core/timer.js +107 -30
- package/src/phaser/core/timer_event.js +11 -6
- package/src/phaser/core/tween.js +124 -30
- package/src/phaser/core/tween_data.js +42 -18
- package/src/phaser/core/tween_easing.js +1 -39
- package/src/phaser/core/tween_manager.js +47 -5
- package/src/phaser/core/world.js +9 -6
- package/src/phaser/display/bitmap_text.js +92 -11
- package/src/phaser/display/button.js +64 -13
- package/src/phaser/display/canvas/buffer.js +16 -6
- package/src/phaser/display/canvas/graphics.js +1 -16
- package/src/phaser/display/canvas/masker.js +0 -8
- package/src/phaser/display/canvas/pool.js +0 -14
- package/src/phaser/display/canvas/renderer.js +28 -8
- package/src/phaser/display/canvas/tinter.js +4 -48
- package/src/phaser/display/canvas/util.js +0 -15
- package/src/phaser/display/display_object.js +192 -20
- package/src/phaser/display/graphics.js +162 -27
- package/src/phaser/display/graphics_data.js +14 -6
- package/src/phaser/display/graphics_data_util.js +2 -9
- package/src/phaser/display/group.js +75 -10
- package/src/phaser/display/image.js +86 -10
- package/src/phaser/display/sprite_batch.js +3 -9
- package/src/phaser/display/sprite_util.js +3 -28
- package/src/phaser/display/text.js +332 -32
- package/src/phaser/display/webgl/abstract_filter.js +8 -7
- package/src/phaser/display/webgl/base_texture.js +20 -12
- package/src/phaser/display/webgl/blend_manager.js +14 -7
- package/src/phaser/display/webgl/earcut.js +4 -50
- package/src/phaser/display/webgl/earcut_node.js +6 -7
- package/src/phaser/display/webgl/fast_sprite_batch.js +34 -11
- package/src/phaser/display/webgl/filter_manager.js +25 -7
- package/src/phaser/display/webgl/filter_texture.js +21 -22
- package/src/phaser/display/webgl/graphics.js +5 -40
- package/src/phaser/display/webgl/graphics_data.js +10 -7
- package/src/phaser/display/webgl/mask_manager.js +0 -8
- package/src/phaser/display/webgl/render_texture.js +33 -21
- package/src/phaser/display/webgl/renderer.js +38 -11
- package/src/phaser/display/webgl/shader/complex.js +10 -6
- package/src/phaser/display/webgl/shader/fast.js +10 -6
- package/src/phaser/display/webgl/shader/normal.js +23 -32
- package/src/phaser/display/webgl/shader/primitive.js +10 -6
- package/src/phaser/display/webgl/shader/strip.js +10 -6
- package/src/phaser/display/webgl/shader_manager.js +18 -6
- package/src/phaser/display/webgl/sprite_batch.js +41 -8
- package/src/phaser/display/webgl/stencil_manager.js +28 -6
- package/src/phaser/display/webgl/texture.js +28 -15
- package/src/phaser/display/webgl/texture_util.js +0 -8
- package/src/phaser/display/webgl/util.js +0 -11
- package/src/phaser/geom/circle.js +123 -19
- package/src/phaser/geom/ellipse.js +39 -19
- package/src/phaser/geom/line.js +148 -17
- package/src/phaser/geom/matrix.js +73 -7
- package/src/phaser/geom/point.js +152 -7
- package/src/phaser/geom/polygon.js +42 -14
- package/src/phaser/geom/rectangle.js +233 -7
- package/src/phaser/geom/rounded_rectangle.js +10 -7
- package/src/phaser/geom/util/circle.js +3 -16
- package/src/phaser/geom/util/ellipse.js +0 -8
- package/src/phaser/geom/util/line.js +5 -19
- package/src/phaser/geom/util/matrix.js +1 -10
- package/src/phaser/geom/util/point.js +0 -26
- package/src/phaser/geom/util/polygon.js +1 -8
- package/src/phaser/geom/util/rectangle.js +1 -23
- package/src/phaser/geom/util/rounded_rectangle.js +1 -8
- package/src/phaser/util/math.js +3 -43
- package/{types → typedefs}/global.d.ts +1 -1
- package/types/index.d.ts +2 -1
- package/types/index.d.ts.map +1 -1
- package/types/phaser/core/animation.d.ts +106 -5
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +88 -1
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +5 -6
- package/types/phaser/core/animation_parser.d.ts.map +1 -1
- package/types/phaser/core/array_set.d.ts +53 -7
- package/types/phaser/core/array_set.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +348 -58
- package/types/phaser/core/cache.d.ts.map +1 -1
- package/types/phaser/core/const.d.ts +143 -40
- package/types/phaser/core/const.d.ts.map +1 -1
- package/types/phaser/core/device.d.ts +2 -5
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/device_util.d.ts +1 -10
- package/types/phaser/core/device_util.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +122 -3
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +142 -15
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +74 -7
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame.d.ts +68 -26
- package/types/phaser/core/frame.d.ts.map +1 -1
- package/types/phaser/core/frame_data.d.ts +61 -9
- package/types/phaser/core/frame_data.d.ts.map +1 -1
- package/types/phaser/core/frame_util.d.ts +10 -10
- package/types/phaser/core/frame_util.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +54 -20
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +132 -21
- package/types/phaser/core/input.d.ts.map +1 -1
- package/types/phaser/core/input_handler.d.ts +258 -25
- package/types/phaser/core/input_handler.d.ts.map +1 -1
- package/types/phaser/core/input_mouse.d.ts +59 -12
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +49 -15
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +80 -4
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +52 -15
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +268 -23
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/loader_parser.d.ts +0 -4
- package/types/phaser/core/loader_parser.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +17 -7
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +210 -15
- package/types/phaser/core/scale_manager.d.ts.map +1 -1
- package/types/phaser/core/scene.d.ts +21 -5
- package/types/phaser/core/scene.d.ts.map +1 -1
- package/types/phaser/core/scene_manager.d.ts +90 -10
- package/types/phaser/core/scene_manager.d.ts.map +1 -1
- package/types/phaser/core/signal.d.ts +95 -11
- package/types/phaser/core/signal.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +35 -6
- package/types/phaser/core/signal_binding.d.ts.map +1 -1
- package/types/phaser/core/sound.d.ts +111 -14
- package/types/phaser/core/sound.d.ts.map +1 -1
- package/types/phaser/core/sound_manager.d.ts +94 -8
- package/types/phaser/core/sound_manager.d.ts.map +1 -1
- package/types/phaser/core/sound_sprite.d.ts +22 -8
- package/types/phaser/core/sound_sprite.d.ts.map +1 -1
- package/types/phaser/core/stage.d.ts +32 -3
- package/types/phaser/core/stage.d.ts.map +1 -1
- package/types/phaser/core/time.d.ts +73 -6
- package/types/phaser/core/time.d.ts.map +1 -1
- package/types/phaser/core/timer.d.ts +103 -2
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +11 -5
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +123 -3
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +42 -3
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_easing.d.ts +0 -36
- package/types/phaser/core/tween_easing.d.ts.map +1 -1
- package/types/phaser/core/tween_manager.d.ts +49 -2
- package/types/phaser/core/tween_manager.d.ts.map +1 -1
- package/types/phaser/core/world.d.ts +9 -1
- package/types/phaser/core/world.d.ts.map +1 -1
- package/types/phaser/display/bitmap_text.d.ts +89 -12
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +68 -11
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +21 -5
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/types/phaser/display/canvas/graphics.d.ts +0 -3
- package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/types/phaser/display/canvas/masker.d.ts +0 -2
- package/types/phaser/display/canvas/masker.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +0 -13
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +30 -3
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/canvas/tinter.d.ts +0 -5
- package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts +0 -9
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +196 -9
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +142 -16
- package/types/phaser/display/graphics.d.ts.map +1 -1
- package/types/phaser/display/graphics_data.d.ts +15 -1
- package/types/phaser/display/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/graphics_data_util.d.ts +3 -3
- package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/types/phaser/display/group.d.ts +68 -6
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +77 -15
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_batch.d.ts +4 -4
- package/types/phaser/display/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts +0 -5
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +373 -53
- package/types/phaser/display/text.d.ts.map +1 -1
- package/types/phaser/display/webgl/abstract_filter.d.ts +8 -6
- package/types/phaser/display/webgl/abstract_filter.d.ts.map +1 -1
- package/types/phaser/display/webgl/base_texture.d.ts +20 -1
- package/types/phaser/display/webgl/base_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/blend_manager.d.ts +11 -6
- package/types/phaser/display/webgl/blend_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut.d.ts +0 -27
- package/types/phaser/display/webgl/earcut.d.ts.map +1 -1
- package/types/phaser/display/webgl/earcut_node.d.ts +9 -9
- package/types/phaser/display/webgl/earcut_node.d.ts.map +1 -1
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts +33 -6
- package/types/phaser/display/webgl/fast_sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_manager.d.ts +23 -7
- package/types/phaser/display/webgl/filter_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/filter_texture.d.ts +21 -3
- package/types/phaser/display/webgl/filter_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics.d.ts +0 -12
- package/types/phaser/display/webgl/graphics.d.ts.map +1 -1
- package/types/phaser/display/webgl/graphics_data.d.ts +12 -8
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/webgl/mask_manager.d.ts +0 -2
- package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +31 -4
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +42 -5
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/complex.d.ts +12 -2
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/fast.d.ts +12 -2
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +21 -1
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/primitive.d.ts +12 -2
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/strip.d.ts +12 -2
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +20 -5
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +38 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/webgl/stencil_manager.d.ts +25 -0
- package/types/phaser/display/webgl/stencil_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture.d.ts +22 -1
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture_util.d.ts +0 -2
- package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/types/phaser/display/webgl/util.d.ts +0 -10
- package/types/phaser/display/webgl/util.d.ts.map +1 -1
- package/types/phaser/geom/circle.d.ts +130 -10
- package/types/phaser/geom/circle.d.ts.map +1 -1
- package/types/phaser/geom/ellipse.d.ts +42 -6
- package/types/phaser/geom/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/line.d.ts +159 -14
- package/types/phaser/geom/line.d.ts.map +1 -1
- package/types/phaser/geom/matrix.d.ts +84 -12
- package/types/phaser/geom/matrix.d.ts.map +1 -1
- package/types/phaser/geom/point.d.ts +170 -19
- package/types/phaser/geom/point.d.ts.map +1 -1
- package/types/phaser/geom/polygon.d.ts +45 -5
- package/types/phaser/geom/polygon.d.ts.map +1 -1
- package/types/phaser/geom/rectangle.d.ts +253 -21
- package/types/phaser/geom/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/rounded_rectangle.d.ts +11 -2
- package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/circle.d.ts +3 -10
- package/types/phaser/geom/util/circle.d.ts.map +1 -1
- package/types/phaser/geom/util/ellipse.d.ts +0 -7
- package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/util/line.d.ts +5 -10
- package/types/phaser/geom/util/line.d.ts.map +1 -1
- package/types/phaser/geom/util/matrix.d.ts +0 -3
- package/types/phaser/geom/util/matrix.d.ts.map +1 -1
- package/types/phaser/geom/util/point.d.ts +0 -20
- package/types/phaser/geom/util/point.d.ts.map +1 -1
- package/types/phaser/geom/util/polygon.d.ts +0 -1
- package/types/phaser/geom/util/polygon.d.ts.map +1 -1
- package/types/phaser/geom/util/rectangle.d.ts +0 -16
- package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/rounded_rectangle.d.ts +0 -1
- package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/util/math.d.ts +0 -27
- package/types/phaser/util/math.d.ts.map +1 -1
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
6
|
-
*/
|
|
7
1
|
import { PrimitiveShader } from './shader/primitive';
|
|
8
2
|
import { ComplexPrimitiveShader } from './shader/complex';
|
|
9
3
|
import { NormalShader } from './shader/normal';
|
|
@@ -11,6 +5,9 @@ import { FastShader } from './shader/fast';
|
|
|
11
5
|
import { StripShader } from './shader/strip';
|
|
12
6
|
|
|
13
7
|
export class WebGLShaderManager {
|
|
8
|
+
/**
|
|
9
|
+
* TBD.
|
|
10
|
+
*/
|
|
14
11
|
constructor() {
|
|
15
12
|
this.gl = null;
|
|
16
13
|
this.primitiveShader = null;
|
|
@@ -27,6 +24,10 @@ export class WebGLShaderManager {
|
|
|
27
24
|
this.stack = [];
|
|
28
25
|
}
|
|
29
26
|
|
|
27
|
+
/**
|
|
28
|
+
* TBD.
|
|
29
|
+
* @param gl - TBD.
|
|
30
|
+
*/
|
|
30
31
|
setContext(gl) {
|
|
31
32
|
this.gl = gl;
|
|
32
33
|
this.primitiveShader = new PrimitiveShader(gl);
|
|
@@ -37,6 +38,10 @@ export class WebGLShaderManager {
|
|
|
37
38
|
this.setShader(this.defaultShader);
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
/**
|
|
42
|
+
* TBD.
|
|
43
|
+
* @param attribs
|
|
44
|
+
*/
|
|
40
45
|
setAttribs(attribs) {
|
|
41
46
|
// reset temp state
|
|
42
47
|
let i;
|
|
@@ -61,6 +66,10 @@ export class WebGLShaderManager {
|
|
|
61
66
|
}
|
|
62
67
|
}
|
|
63
68
|
|
|
69
|
+
/**
|
|
70
|
+
* TBD.
|
|
71
|
+
* @param shader
|
|
72
|
+
*/
|
|
64
73
|
setShader(shader) {
|
|
65
74
|
if (this._currentId === shader._UID) {
|
|
66
75
|
return false;
|
|
@@ -72,6 +81,9 @@ export class WebGLShaderManager {
|
|
|
72
81
|
return true;
|
|
73
82
|
}
|
|
74
83
|
|
|
84
|
+
/**
|
|
85
|
+
* TBD.
|
|
86
|
+
*/
|
|
75
87
|
destroy() {
|
|
76
88
|
this.attribState = null;
|
|
77
89
|
this.tempAttribState = null;
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
6
|
-
*/
|
|
7
1
|
import { AbstractFilter } from './abstract_filter';
|
|
8
2
|
import { NormalShader } from './shader/normal';
|
|
9
3
|
|
|
10
4
|
export class WebGLSpriteBatch {
|
|
5
|
+
/**
|
|
6
|
+
* TBD.
|
|
7
|
+
*/
|
|
11
8
|
constructor() {
|
|
12
9
|
this.vertSize = 5;
|
|
13
10
|
this.size = 2000; // Math.pow(2, 16) / this.vertSize;
|
|
@@ -47,6 +44,10 @@ export class WebGLSpriteBatch {
|
|
|
47
44
|
]);
|
|
48
45
|
}
|
|
49
46
|
|
|
47
|
+
/**
|
|
48
|
+
* TBD.
|
|
49
|
+
* @param gl - TBD.
|
|
50
|
+
*/
|
|
50
51
|
setContext(gl) {
|
|
51
52
|
this.gl = gl;
|
|
52
53
|
// create a couple of buffers
|
|
@@ -66,16 +67,28 @@ export class WebGLSpriteBatch {
|
|
|
66
67
|
this.defaultShader.shaders[gl.id] = shader;
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
/**
|
|
71
|
+
* TBD.
|
|
72
|
+
* @param renderSession - TBD.
|
|
73
|
+
*/
|
|
69
74
|
begin(renderSession) {
|
|
70
75
|
this.renderSession = renderSession;
|
|
71
76
|
this.shader = this.renderSession.shaderManager.defaultShader;
|
|
72
77
|
this.start();
|
|
73
78
|
}
|
|
74
79
|
|
|
80
|
+
/**
|
|
81
|
+
* TBD.
|
|
82
|
+
*/
|
|
75
83
|
end() {
|
|
76
84
|
this.flush();
|
|
77
85
|
}
|
|
78
86
|
|
|
87
|
+
/**
|
|
88
|
+
* TBD.
|
|
89
|
+
* @param sprite
|
|
90
|
+
* @param matrix - TBD.
|
|
91
|
+
*/
|
|
79
92
|
render(sprite, matrix) {
|
|
80
93
|
const texture = sprite.texture;
|
|
81
94
|
// They provided an alternative rendering matrix, so use it
|
|
@@ -164,8 +177,7 @@ export class WebGLSpriteBatch {
|
|
|
164
177
|
positions[i + 18] = uvs.y3;
|
|
165
178
|
// color and alpha
|
|
166
179
|
const tint = sprite.tint;
|
|
167
|
-
colors[i + 4] =
|
|
168
|
-
(tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16) + ((sprite.worldAlpha * 255) << 24);
|
|
180
|
+
colors[i + 4] = (tint >> 16) + (tint & 0xff00) + ((tint & 0xff) << 16) + ((sprite.worldAlpha * 255) << 24);
|
|
169
181
|
colors[i + 9] = colors[i + 4];
|
|
170
182
|
colors[i + 14] = colors[i + 4];
|
|
171
183
|
colors[i + 19] = colors[i + 4];
|
|
@@ -174,10 +186,16 @@ export class WebGLSpriteBatch {
|
|
|
174
186
|
this.currentBatchSize += 1;
|
|
175
187
|
}
|
|
176
188
|
|
|
189
|
+
/**
|
|
190
|
+
* TBD.
|
|
191
|
+
*/
|
|
177
192
|
renderTilingSprite() {
|
|
178
193
|
// TODO
|
|
179
194
|
}
|
|
180
195
|
|
|
196
|
+
/**
|
|
197
|
+
* TBD.
|
|
198
|
+
*/
|
|
181
199
|
flush() {
|
|
182
200
|
// If the batch is length 0 then return as there is nothing to draw
|
|
183
201
|
if (this.currentBatchSize === 0) {
|
|
@@ -274,6 +292,12 @@ export class WebGLSpriteBatch {
|
|
|
274
292
|
this.currentBatchSize = 0;
|
|
275
293
|
}
|
|
276
294
|
|
|
295
|
+
/**
|
|
296
|
+
* TBD.
|
|
297
|
+
* @param texture
|
|
298
|
+
* @param size
|
|
299
|
+
* @param startIndex
|
|
300
|
+
*/
|
|
277
301
|
renderBatch(texture, size, startIndex) {
|
|
278
302
|
if (size === 0) {
|
|
279
303
|
return;
|
|
@@ -295,15 +319,24 @@ export class WebGLSpriteBatch {
|
|
|
295
319
|
this.renderSession.drawCount += 1;
|
|
296
320
|
}
|
|
297
321
|
|
|
322
|
+
/**
|
|
323
|
+
* TBD.
|
|
324
|
+
*/
|
|
298
325
|
stop() {
|
|
299
326
|
this.flush();
|
|
300
327
|
this.dirty = true;
|
|
301
328
|
}
|
|
302
329
|
|
|
330
|
+
/**
|
|
331
|
+
* TBD.
|
|
332
|
+
*/
|
|
303
333
|
start() {
|
|
304
334
|
this.dirty = true;
|
|
305
335
|
}
|
|
306
336
|
|
|
337
|
+
/**
|
|
338
|
+
* TBD.
|
|
339
|
+
*/
|
|
307
340
|
destroy() {
|
|
308
341
|
this.vertices = null;
|
|
309
342
|
this.positions = null;
|
|
@@ -1,27 +1,37 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
6
|
-
*/
|
|
7
1
|
import { hex2rgb } from '../../util/math';
|
|
8
2
|
|
|
9
3
|
export class WebGLStencilManager {
|
|
4
|
+
/**
|
|
5
|
+
* TBD.
|
|
6
|
+
*/
|
|
10
7
|
constructor() {
|
|
11
8
|
this.stencilStack = [];
|
|
12
9
|
this.reverse = true;
|
|
13
10
|
this.count = 0;
|
|
14
11
|
}
|
|
15
12
|
|
|
13
|
+
/**
|
|
14
|
+
* TBD.
|
|
15
|
+
* @param gl - TBD.
|
|
16
|
+
*/
|
|
16
17
|
setContext(gl) {
|
|
17
18
|
this.gl = gl;
|
|
18
19
|
}
|
|
19
20
|
|
|
21
|
+
/**
|
|
22
|
+
* TBD.
|
|
23
|
+
*/
|
|
20
24
|
destroy() {
|
|
21
25
|
this.stencilStack = null;
|
|
22
26
|
this.gl = null;
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
/**
|
|
30
|
+
* TBD.
|
|
31
|
+
* @param graphics - TBD.
|
|
32
|
+
* @param webGLData
|
|
33
|
+
* @param renderSession - TBD.
|
|
34
|
+
*/
|
|
25
35
|
pushStencil(graphics, webGLData, renderSession) {
|
|
26
36
|
const gl = renderSession.gl;
|
|
27
37
|
this.bindGraphics(graphics, webGLData, renderSession);
|
|
@@ -74,6 +84,12 @@ export class WebGLStencilManager {
|
|
|
74
84
|
this.count += 1;
|
|
75
85
|
}
|
|
76
86
|
|
|
87
|
+
/**
|
|
88
|
+
* TBD.
|
|
89
|
+
* @param graphics - TBD.
|
|
90
|
+
* @param webGLData
|
|
91
|
+
* @param renderSession - TBD.
|
|
92
|
+
*/
|
|
77
93
|
bindGraphics(graphics, webGLData, renderSession) {
|
|
78
94
|
// if(this._currentGraphics === graphics)return;
|
|
79
95
|
// this._currentGraphics = graphics;
|
|
@@ -115,6 +131,12 @@ export class WebGLStencilManager {
|
|
|
115
131
|
}
|
|
116
132
|
}
|
|
117
133
|
|
|
134
|
+
/**
|
|
135
|
+
* TBD.
|
|
136
|
+
* @param graphics - TBD.
|
|
137
|
+
* @param webGLData
|
|
138
|
+
* @param renderSession - TBD.
|
|
139
|
+
*/
|
|
118
140
|
popStencil(graphics, webGLData, renderSession) {
|
|
119
141
|
const gl = renderSession.gl;
|
|
120
142
|
this.stencilStack.pop();
|
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
* @module display/webgl/texture
|
|
3
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
4
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
5
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
6
|
-
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
7
|
-
*/
|
|
8
|
-
import { Rectangle } from '../../geom/rectangle';
|
|
1
|
+
import { Rectangle } from '../../geom/rectangle';
|
|
9
2
|
|
|
10
3
|
export class TextureUvs {
|
|
4
|
+
/**
|
|
5
|
+
* TBD.
|
|
6
|
+
*/
|
|
11
7
|
constructor() {
|
|
12
8
|
this.x0 = 0;
|
|
13
9
|
this.y0 = 0;
|
|
@@ -21,6 +17,13 @@ export class TextureUvs {
|
|
|
21
17
|
}
|
|
22
18
|
|
|
23
19
|
export class Texture {
|
|
20
|
+
/**
|
|
21
|
+
* TBD.
|
|
22
|
+
* @param baseTexture - TBD.
|
|
23
|
+
* @param frame - TBD.
|
|
24
|
+
* @param crop - TBD.
|
|
25
|
+
* @param trim - TBD.
|
|
26
|
+
*/
|
|
24
27
|
constructor(baseTexture, frame, crop, trim) {
|
|
25
28
|
this.noFrame = false;
|
|
26
29
|
if (!frame) {
|
|
@@ -49,6 +52,9 @@ export class Texture {
|
|
|
49
52
|
}
|
|
50
53
|
}
|
|
51
54
|
|
|
55
|
+
/**
|
|
56
|
+
* TBD.
|
|
57
|
+
*/
|
|
52
58
|
onBaseTextureLoaded() {
|
|
53
59
|
if (this.noFrame) {
|
|
54
60
|
this.frame = new Rectangle(0, 0, this.baseTexture.width, this.baseTexture.height);
|
|
@@ -56,6 +62,10 @@ export class Texture {
|
|
|
56
62
|
this.setFrame(this.frame);
|
|
57
63
|
}
|
|
58
64
|
|
|
65
|
+
/**
|
|
66
|
+
* TBD.
|
|
67
|
+
* @param destroyBase - TBD.
|
|
68
|
+
*/
|
|
59
69
|
destroy(destroyBase = false) {
|
|
60
70
|
if (destroyBase) {
|
|
61
71
|
this.baseTexture.destroy();
|
|
@@ -63,6 +73,10 @@ export class Texture {
|
|
|
63
73
|
this.valid = false;
|
|
64
74
|
}
|
|
65
75
|
|
|
76
|
+
/**
|
|
77
|
+
* TBD.
|
|
78
|
+
* @param frame - TBD.
|
|
79
|
+
*/
|
|
66
80
|
setFrame(frame) {
|
|
67
81
|
this.noFrame = false;
|
|
68
82
|
this.frame = frame;
|
|
@@ -74,23 +88,19 @@ export class Texture {
|
|
|
74
88
|
this.crop.height = frame.height;
|
|
75
89
|
if (
|
|
76
90
|
!this.trim &&
|
|
77
|
-
(frame.x + frame.width > this.baseTexture.width ||
|
|
78
|
-
frame.y + frame.height > this.baseTexture.height)
|
|
91
|
+
(frame.x + frame.width > this.baseTexture.width || frame.y + frame.height > this.baseTexture.height)
|
|
79
92
|
) {
|
|
80
93
|
// If `true` then `PIXI.Texture.setFrame` will no longer throw an error if the texture dimensions are incorrect.
|
|
81
94
|
// Instead `Texture.valid` will be set to `false` (#1556)
|
|
82
95
|
// TODO: make this configurable
|
|
83
96
|
const isTextureSilentFail = true;
|
|
84
97
|
if (!isTextureSilentFail) {
|
|
85
|
-
throw new Error(
|
|
86
|
-
'Texture Error: frame does not fit inside the base Texture dimensions ' + this
|
|
87
|
-
);
|
|
98
|
+
throw new Error('Texture Error: frame does not fit inside the base Texture dimensions ' + this);
|
|
88
99
|
}
|
|
89
100
|
this.valid = false;
|
|
90
101
|
return;
|
|
91
102
|
}
|
|
92
|
-
this.valid =
|
|
93
|
-
frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded;
|
|
103
|
+
this.valid = frame && frame.width && frame.height && this.baseTexture.source && this.baseTexture.hasLoaded;
|
|
94
104
|
if (this.trim) {
|
|
95
105
|
this.width = this.trim.width;
|
|
96
106
|
this.height = this.trim.height;
|
|
@@ -102,6 +112,9 @@ export class Texture {
|
|
|
102
112
|
}
|
|
103
113
|
}
|
|
104
114
|
|
|
115
|
+
/**
|
|
116
|
+
* TBD.
|
|
117
|
+
*/
|
|
105
118
|
_updateUvs() {
|
|
106
119
|
if (!this._uvs) {
|
|
107
120
|
this._uvs = new TextureUvs();
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
6
|
-
*/
|
|
7
1
|
import { BaseTexture } from './base_texture';
|
|
8
2
|
import { Texture } from './texture';
|
|
9
3
|
|
|
10
4
|
/**
|
|
11
5
|
* TBD.
|
|
12
|
-
*
|
|
13
6
|
* @param {HTMLCanvasElement} canvas - TBD.
|
|
14
7
|
* @param {number} scaleMode - TBD.
|
|
15
8
|
* @returns {object} TBD.
|
|
@@ -26,7 +19,6 @@ export function baseTextureFromCanvas(canvas, scaleMode) {
|
|
|
26
19
|
|
|
27
20
|
/**
|
|
28
21
|
* TBD.
|
|
29
|
-
*
|
|
30
22
|
* @param {HTMLCanvasElement} canvas - TBD.
|
|
31
23
|
* @param {number} scaleMode - TBD.
|
|
32
24
|
* @returns {object} TBD.
|
|
@@ -1,10 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
3
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
4
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
5
|
-
* @author Mat Groves http://matgroves.com/ @Doormat23
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
1
|
/**
|
|
9
2
|
* TBD.
|
|
10
3
|
*/
|
|
@@ -12,7 +5,6 @@ export function initDefaultShaders() {}
|
|
|
12
5
|
|
|
13
6
|
/**
|
|
14
7
|
* TBD.
|
|
15
|
-
*
|
|
16
8
|
* @param {object} gl - TBD.
|
|
17
9
|
* @param {string[]|string} shaderSrc - TBD.
|
|
18
10
|
* @param {object} shaderType - TBD.
|
|
@@ -37,7 +29,6 @@ export function compileShader(gl, shaderSrc, shaderType) {
|
|
|
37
29
|
|
|
38
30
|
/**
|
|
39
31
|
* TBD.
|
|
40
|
-
*
|
|
41
32
|
* @param {object} gl - TBD.
|
|
42
33
|
* @param {string[]|string} shaderSrc - TBD.
|
|
43
34
|
* @returns {object} TBD.
|
|
@@ -48,7 +39,6 @@ export function compileVertexShader(gl, shaderSrc) {
|
|
|
48
39
|
|
|
49
40
|
/**
|
|
50
41
|
* TBD.
|
|
51
|
-
*
|
|
52
42
|
* @param {object} gl - TBD.
|
|
53
43
|
* @param {string[]|string} shaderSrc - TBD.
|
|
54
44
|
* @returns {object} TBD.
|
|
@@ -59,7 +49,6 @@ export function compileFragmentShader(gl, shaderSrc) {
|
|
|
59
49
|
|
|
60
50
|
/**
|
|
61
51
|
* TBD.
|
|
62
|
-
*
|
|
63
52
|
* @param {object} gl - TBD.
|
|
64
53
|
* @param {string[]|string} vertexSrc - TBD.
|
|
65
54
|
* @param {string[]|string} fragmentSrc - TBD.
|
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module geom/circle
|
|
3
|
-
* @copyright Copyright (c) 2018-present Richard Davey, Photon Storm Ltd., Andras Csizmadia <andras@vpmedia.hu> (www.vpmedia.hu)
|
|
4
|
-
* @author Andras Csizmadia <andras@vpmedia.hu>
|
|
5
|
-
* @author Richard Davey <rich@photonstorm.com>
|
|
6
|
-
*/
|
|
7
1
|
import { Point } from './point';
|
|
8
|
-
import { Rectangle } from
|
|
2
|
+
import { Rectangle } from './rectangle';
|
|
9
3
|
import { distance } from '../util/math';
|
|
10
4
|
import { clone, contains, circumferencePoint } from './util/circle';
|
|
11
5
|
import { GEOM_CIRCLE } from '../core/const';
|
|
@@ -13,7 +7,6 @@ import { GEOM_CIRCLE } from '../core/const';
|
|
|
13
7
|
export class Circle {
|
|
14
8
|
/**
|
|
15
9
|
* TBD.
|
|
16
|
-
*
|
|
17
10
|
* @param {number} x - TBD.
|
|
18
11
|
* @param {number} y - TBD.
|
|
19
12
|
* @param {number} diameter - TBD.
|
|
@@ -29,10 +22,19 @@ export class Circle {
|
|
|
29
22
|
this.type = GEOM_CIRCLE;
|
|
30
23
|
}
|
|
31
24
|
|
|
25
|
+
/**
|
|
26
|
+
* TBD.
|
|
27
|
+
* @returns {number} TBD.
|
|
28
|
+
*/
|
|
32
29
|
circumference() {
|
|
33
30
|
return 2 * (Math.PI * this._radius);
|
|
34
31
|
}
|
|
35
32
|
|
|
33
|
+
/**
|
|
34
|
+
* TBD.
|
|
35
|
+
* @param {Point} output - TBD.
|
|
36
|
+
* @returns {Point} TBD.
|
|
37
|
+
*/
|
|
36
38
|
random(output = null) {
|
|
37
39
|
const result = output || new Point();
|
|
38
40
|
const t = 2 * Math.PI * Math.random();
|
|
@@ -45,10 +47,21 @@ export class Circle {
|
|
|
45
47
|
return result;
|
|
46
48
|
}
|
|
47
49
|
|
|
50
|
+
/**
|
|
51
|
+
* TBD.
|
|
52
|
+
* @returns {Rectangle} TBD.
|
|
53
|
+
*/
|
|
48
54
|
getBounds() {
|
|
49
55
|
return new Rectangle(this.x - this.radius, this.y - this.radius, this.diameter, this.diameter);
|
|
50
56
|
}
|
|
51
57
|
|
|
58
|
+
/**
|
|
59
|
+
* TBD.
|
|
60
|
+
* @param {number} x - TBD.
|
|
61
|
+
* @param {number} y - TBD.
|
|
62
|
+
* @param {number} diameter - TBD.
|
|
63
|
+
* @returns {Circle} TBD.
|
|
64
|
+
*/
|
|
52
65
|
setTo(x, y, diameter) {
|
|
53
66
|
this.x = x;
|
|
54
67
|
this.y = y;
|
|
@@ -57,10 +70,20 @@ export class Circle {
|
|
|
57
70
|
return this;
|
|
58
71
|
}
|
|
59
72
|
|
|
73
|
+
/**
|
|
74
|
+
* TBD.
|
|
75
|
+
* @param {Circle} source - TBD.
|
|
76
|
+
* @returns {Circle} TBD.
|
|
77
|
+
*/
|
|
60
78
|
copyFrom(source) {
|
|
61
79
|
return this.setTo(source.x, source.y, source.diameter);
|
|
62
80
|
}
|
|
63
81
|
|
|
82
|
+
/**
|
|
83
|
+
* TBD.
|
|
84
|
+
* @param {Circle} dest - TBD.
|
|
85
|
+
* @returns {Circle} TBD.
|
|
86
|
+
*/
|
|
64
87
|
copyTo(dest) {
|
|
65
88
|
dest.x = this.x;
|
|
66
89
|
dest.y = this.y;
|
|
@@ -68,51 +91,86 @@ export class Circle {
|
|
|
68
91
|
return dest;
|
|
69
92
|
}
|
|
70
93
|
|
|
94
|
+
/**
|
|
95
|
+
* TBD.
|
|
96
|
+
* @param {Circle} dest - TBD.
|
|
97
|
+
* @param {boolean} round - TBD.
|
|
98
|
+
* @returns {number} TBD.
|
|
99
|
+
*/
|
|
71
100
|
distance(dest, round = false) {
|
|
72
101
|
const d = distance(this.x, this.y, dest.x, dest.y);
|
|
73
102
|
return round ? Math.round(d) : d;
|
|
74
103
|
}
|
|
75
104
|
|
|
105
|
+
/**
|
|
106
|
+
* TBD.
|
|
107
|
+
* @returns {Circle} TBD.
|
|
108
|
+
*/
|
|
76
109
|
clone() {
|
|
77
110
|
return clone(this);
|
|
78
111
|
}
|
|
79
112
|
|
|
113
|
+
/**
|
|
114
|
+
* TBD.
|
|
115
|
+
* @param {number} x - TBD.
|
|
116
|
+
* @param {number} y - TBD.
|
|
117
|
+
* @returns {boolean} TBD.
|
|
118
|
+
*/
|
|
80
119
|
contains(x, y) {
|
|
81
120
|
return contains(this, x, y);
|
|
82
121
|
}
|
|
83
122
|
|
|
123
|
+
/**
|
|
124
|
+
* TBD.
|
|
125
|
+
* @param {number} angle - TBD.
|
|
126
|
+
* @param {boolean} asDegrees - TBD.
|
|
127
|
+
* @param {Point} out - TBD.
|
|
128
|
+
* @returns {Point} TBD.
|
|
129
|
+
*/
|
|
84
130
|
circumferencePoint(angle, asDegrees, out) {
|
|
85
131
|
return circumferencePoint(this, angle, asDegrees, out);
|
|
86
132
|
}
|
|
87
133
|
|
|
134
|
+
/**
|
|
135
|
+
* TBD.
|
|
136
|
+
* @param {number} dx - TBD.
|
|
137
|
+
* @param {number} dy - TBD.
|
|
138
|
+
* @returns {Circle} TBD.
|
|
139
|
+
*/
|
|
88
140
|
offset(dx, dy) {
|
|
89
141
|
this.x += dx;
|
|
90
142
|
this.y += dy;
|
|
91
143
|
return this;
|
|
92
144
|
}
|
|
93
145
|
|
|
146
|
+
/**
|
|
147
|
+
* TBD.
|
|
148
|
+
* @param {Point} point - TBD.
|
|
149
|
+
* @returns {Circle} TBD.
|
|
150
|
+
*/
|
|
94
151
|
offsetPoint(point) {
|
|
95
152
|
return this.offset(point.x, point.y);
|
|
96
153
|
}
|
|
97
154
|
|
|
155
|
+
/**
|
|
156
|
+
* TBD.
|
|
157
|
+
* @returns {string} TBD.
|
|
158
|
+
*/
|
|
98
159
|
toString() {
|
|
99
|
-
return (
|
|
100
|
-
'[{Circle (x=' +
|
|
101
|
-
this.x +
|
|
102
|
-
' y=' +
|
|
103
|
-
this.y +
|
|
104
|
-
' diameter=' +
|
|
105
|
-
this.diameter +
|
|
106
|
-
' radius=' +
|
|
107
|
-
this.radius +
|
|
108
|
-
')}]'
|
|
109
|
-
);
|
|
160
|
+
return '[{Circle (x=' + this.x + ' y=' + this.y + ' diameter=' + this.diameter + ' radius=' + this.radius + ')}]';
|
|
110
161
|
}
|
|
111
162
|
|
|
163
|
+
/**
|
|
164
|
+
* TBD.
|
|
165
|
+
* @returns {number} TBD.
|
|
166
|
+
*/
|
|
112
167
|
get diameter() {
|
|
113
168
|
return this._diameter;
|
|
114
169
|
}
|
|
115
170
|
|
|
171
|
+
/**
|
|
172
|
+
* TBD.
|
|
173
|
+
*/
|
|
116
174
|
set diameter(value) {
|
|
117
175
|
if (value > 0) {
|
|
118
176
|
this._diameter = value;
|
|
@@ -120,10 +178,17 @@ export class Circle {
|
|
|
120
178
|
}
|
|
121
179
|
}
|
|
122
180
|
|
|
181
|
+
/**
|
|
182
|
+
* TBD.
|
|
183
|
+
* @returns {number} TBD.
|
|
184
|
+
*/
|
|
123
185
|
get radius() {
|
|
124
186
|
return this._radius;
|
|
125
187
|
}
|
|
126
188
|
|
|
189
|
+
/**
|
|
190
|
+
* TBD.
|
|
191
|
+
*/
|
|
127
192
|
set radius(value) {
|
|
128
193
|
if (value > 0) {
|
|
129
194
|
this._radius = value;
|
|
@@ -131,10 +196,17 @@ export class Circle {
|
|
|
131
196
|
}
|
|
132
197
|
}
|
|
133
198
|
|
|
199
|
+
/**
|
|
200
|
+
* TBD.
|
|
201
|
+
* @returns {number} TBD.
|
|
202
|
+
*/
|
|
134
203
|
get left() {
|
|
135
204
|
return this.x - this._radius;
|
|
136
205
|
}
|
|
137
206
|
|
|
207
|
+
/**
|
|
208
|
+
* TBD.
|
|
209
|
+
*/
|
|
138
210
|
set left(value) {
|
|
139
211
|
if (value > this.x) {
|
|
140
212
|
this._radius = 0;
|
|
@@ -144,10 +216,17 @@ export class Circle {
|
|
|
144
216
|
}
|
|
145
217
|
}
|
|
146
218
|
|
|
219
|
+
/**
|
|
220
|
+
* TBD.
|
|
221
|
+
* @returns {number} TBD.
|
|
222
|
+
*/
|
|
147
223
|
get right() {
|
|
148
224
|
return this.x + this._radius;
|
|
149
225
|
}
|
|
150
226
|
|
|
227
|
+
/**
|
|
228
|
+
* TBD.
|
|
229
|
+
*/
|
|
151
230
|
set right(value) {
|
|
152
231
|
if (value < this.x) {
|
|
153
232
|
this._radius = 0;
|
|
@@ -157,10 +236,17 @@ export class Circle {
|
|
|
157
236
|
}
|
|
158
237
|
}
|
|
159
238
|
|
|
239
|
+
/**
|
|
240
|
+
* TBD.
|
|
241
|
+
* @returns {number} TBD.
|
|
242
|
+
*/
|
|
160
243
|
get top() {
|
|
161
244
|
return this.y - this._radius;
|
|
162
245
|
}
|
|
163
246
|
|
|
247
|
+
/**
|
|
248
|
+
* TBD.
|
|
249
|
+
*/
|
|
164
250
|
set top(value) {
|
|
165
251
|
if (value > this.y) {
|
|
166
252
|
this._radius = 0;
|
|
@@ -170,10 +256,17 @@ export class Circle {
|
|
|
170
256
|
}
|
|
171
257
|
}
|
|
172
258
|
|
|
259
|
+
/**
|
|
260
|
+
* TBD.
|
|
261
|
+
* @returns {number} TBD.
|
|
262
|
+
*/
|
|
173
263
|
get bottom() {
|
|
174
264
|
return this.y + this._radius;
|
|
175
265
|
}
|
|
176
266
|
|
|
267
|
+
/**
|
|
268
|
+
* TBD.
|
|
269
|
+
*/
|
|
177
270
|
set bottom(value) {
|
|
178
271
|
if (value < this.y) {
|
|
179
272
|
this._radius = 0;
|
|
@@ -183,6 +276,10 @@ export class Circle {
|
|
|
183
276
|
}
|
|
184
277
|
}
|
|
185
278
|
|
|
279
|
+
/**
|
|
280
|
+
* TBD.
|
|
281
|
+
* @returns {number} TBD.
|
|
282
|
+
*/
|
|
186
283
|
get area() {
|
|
187
284
|
if (this._radius > 0) {
|
|
188
285
|
return Math.PI * this._radius * this._radius;
|
|
@@ -190,10 +287,17 @@ export class Circle {
|
|
|
190
287
|
return 0;
|
|
191
288
|
}
|
|
192
289
|
|
|
290
|
+
/**
|
|
291
|
+
* TBD.
|
|
292
|
+
* @returns {boolean} TBD.
|
|
293
|
+
*/
|
|
193
294
|
get empty() {
|
|
194
295
|
return this._diameter === 0;
|
|
195
296
|
}
|
|
196
297
|
|
|
298
|
+
/**
|
|
299
|
+
* TBD.
|
|
300
|
+
*/
|
|
197
301
|
set empty(value) {
|
|
198
302
|
if (value === true) {
|
|
199
303
|
this.setTo(0, 0, 0);
|