@vpmedia/phaser 1.15.0 → 1.17.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 +114 -6
- package/src/phaser/core/animation_manager.js +102 -10
- package/src/phaser/core/animation_parser.js +6 -19
- package/src/phaser/core/array_set.js +59 -5
- package/src/phaser/core/cache.js +307 -6
- package/src/phaser/core/const.js +107 -4
- package/src/phaser/core/device.js +3 -6
- package/src/phaser/core/device_util.js +3 -16
- 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 -12
- package/src/phaser/core/game.js +35 -7
- package/src/phaser/core/input.js +133 -17
- package/src/phaser/core/input_handler.js +243 -43
- package/src/phaser/core/input_mouse.js +70 -5
- package/src/phaser/core/input_mspointer.js +40 -9
- package/src/phaser/core/input_pointer.js +88 -17
- package/src/phaser/core/input_touch.js +42 -5
- package/src/phaser/core/loader.js +303 -101
- package/src/phaser/core/loader_parser.js +2 -10
- 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 -8
- package/src/phaser/core/tween_manager.js +47 -5
- package/src/phaser/core/world.js +9 -6
- package/src/phaser/display/bitmap_text.js +91 -10
- package/src/phaser/display/button.js +63 -12
- package/src/phaser/display/canvas/buffer.js +16 -6
- package/src/phaser/display/canvas/graphics.js +1 -13
- package/src/phaser/display/canvas/masker.js +0 -6
- package/src/phaser/display/canvas/pool.js +0 -7
- package/src/phaser/display/canvas/renderer.js +28 -8
- package/src/phaser/display/canvas/tinter.js +4 -43
- package/src/phaser/display/canvas/util.js +0 -6
- package/src/phaser/display/display_object.js +192 -20
- package/src/phaser/display/graphics.js +161 -26
- package/src/phaser/display/graphics_data.js +14 -6
- package/src/phaser/display/graphics_data_util.js +2 -8
- package/src/phaser/display/group.js +82 -9
- package/src/phaser/display/image.js +87 -9
- package/src/phaser/display/sprite_batch.js +3 -8
- package/src/phaser/display/sprite_util.js +3 -23
- package/src/phaser/display/text.js +331 -31
- 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 -23
- 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 -28
- package/src/phaser/display/webgl/graphics_data.js +10 -7
- package/src/phaser/display/webgl/mask_manager.js +0 -6
- 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 -6
- package/src/phaser/display/webgl/util.js +0 -7
- package/src/phaser/geom/circle.js +123 -18
- package/src/phaser/geom/ellipse.js +39 -18
- package/src/phaser/geom/line.js +148 -16
- package/src/phaser/geom/matrix.js +73 -6
- package/src/phaser/geom/point.js +152 -6
- package/src/phaser/geom/polygon.js +42 -14
- package/src/phaser/geom/rectangle.js +233 -6
- package/src/phaser/geom/rounded_rectangle.js +10 -6
- package/src/phaser/geom/util/circle.js +3 -9
- package/src/phaser/geom/util/ellipse.js +0 -7
- package/src/phaser/geom/util/line.js +5 -14
- package/src/phaser/geom/util/matrix.js +1 -7
- package/src/phaser/geom/util/point.js +0 -6
- package/src/phaser/geom/util/polygon.js +1 -7
- package/src/phaser/geom/util/rectangle.js +1 -7
- package/src/phaser/geom/util/rounded_rectangle.js +1 -7
- package/src/phaser/util/math.js +3 -21
- package/types/index.d.ts +2 -1
- package/types/index.d.ts.map +1 -1
- package/types/phaser/core/animation.d.ts +126 -13
- package/types/phaser/core/animation.d.ts.map +1 -1
- package/types/phaser/core/animation_manager.d.ts +121 -19
- package/types/phaser/core/animation_manager.d.ts.map +1 -1
- package/types/phaser/core/animation_parser.d.ts +6 -5
- package/types/phaser/core/animation_parser.d.ts.map +1 -1
- package/types/phaser/core/array_set.d.ts +67 -13
- package/types/phaser/core/array_set.d.ts.map +1 -1
- package/types/phaser/core/cache.d.ts +365 -69
- 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 +0 -5
- package/types/phaser/core/device.d.ts.map +1 -1
- package/types/phaser/core/device_util.d.ts +1 -1
- package/types/phaser/core/device_util.d.ts.map +1 -1
- package/types/phaser/core/dom.d.ts +119 -0
- package/types/phaser/core/dom.d.ts.map +1 -1
- package/types/phaser/core/event_manager.d.ts +127 -0
- package/types/phaser/core/event_manager.d.ts.map +1 -1
- package/types/phaser/core/factory.d.ts +75 -8
- package/types/phaser/core/factory.d.ts.map +1 -1
- package/types/phaser/core/frame.d.ts +64 -21
- 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 -8
- package/types/phaser/core/frame_util.d.ts.map +1 -1
- package/types/phaser/core/game.d.ts +40 -6
- package/types/phaser/core/game.d.ts.map +1 -1
- package/types/phaser/core/input.d.ts +143 -15
- 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 +62 -14
- package/types/phaser/core/input_mouse.d.ts.map +1 -1
- package/types/phaser/core/input_mspointer.d.ts +51 -17
- package/types/phaser/core/input_mspointer.d.ts.map +1 -1
- package/types/phaser/core/input_pointer.d.ts +99 -14
- package/types/phaser/core/input_pointer.d.ts.map +1 -1
- package/types/phaser/core/input_touch.d.ts +53 -16
- package/types/phaser/core/input_touch.d.ts.map +1 -1
- package/types/phaser/core/loader.d.ts +299 -28
- package/types/phaser/core/loader.d.ts.map +1 -1
- package/types/phaser/core/loader_parser.d.ts.map +1 -1
- package/types/phaser/core/raf.d.ts +19 -9
- package/types/phaser/core/raf.d.ts.map +1 -1
- package/types/phaser/core/scale_manager.d.ts +208 -13
- 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 +93 -9
- package/types/phaser/core/signal.d.ts.map +1 -1
- package/types/phaser/core/signal_binding.d.ts +34 -5
- 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 +97 -11
- 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 +108 -7
- package/types/phaser/core/timer.d.ts.map +1 -1
- package/types/phaser/core/timer_event.d.ts +13 -7
- package/types/phaser/core/timer_event.d.ts.map +1 -1
- package/types/phaser/core/tween.d.ts +124 -4
- package/types/phaser/core/tween.d.ts.map +1 -1
- package/types/phaser/core/tween_data.d.ts +41 -2
- package/types/phaser/core/tween_data.d.ts.map +1 -1
- package/types/phaser/core/tween_easing.d.ts +0 -5
- 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 +84 -7
- package/types/phaser/display/bitmap_text.d.ts.map +1 -1
- package/types/phaser/display/button.d.ts +65 -8
- package/types/phaser/display/button.d.ts.map +1 -1
- package/types/phaser/display/canvas/buffer.d.ts +20 -4
- package/types/phaser/display/canvas/buffer.d.ts.map +1 -1
- package/types/phaser/display/canvas/graphics.d.ts.map +1 -1
- package/types/phaser/display/canvas/masker.d.ts.map +1 -1
- package/types/phaser/display/canvas/pool.d.ts +0 -6
- package/types/phaser/display/canvas/pool.d.ts.map +1 -1
- package/types/phaser/display/canvas/renderer.d.ts +29 -2
- package/types/phaser/display/canvas/renderer.d.ts.map +1 -1
- package/types/phaser/display/canvas/tinter.d.ts.map +1 -1
- package/types/phaser/display/canvas/util.d.ts.map +1 -1
- package/types/phaser/display/display_object.d.ts +195 -8
- package/types/phaser/display/display_object.d.ts.map +1 -1
- package/types/phaser/display/graphics.d.ts +132 -6
- 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 -2
- package/types/phaser/display/graphics_data_util.d.ts.map +1 -1
- package/types/phaser/display/group.d.ts +80 -10
- package/types/phaser/display/group.d.ts.map +1 -1
- package/types/phaser/display/image.d.ts +72 -6
- package/types/phaser/display/image.d.ts.map +1 -1
- package/types/phaser/display/sprite_batch.d.ts +4 -3
- package/types/phaser/display/sprite_batch.d.ts.map +1 -1
- package/types/phaser/display/sprite_util.d.ts.map +1 -1
- package/types/phaser/display/text.d.ts +366 -46
- 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.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 +22 -6
- 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.map +1 -1
- package/types/phaser/display/webgl/graphics_data.d.ts +10 -6
- package/types/phaser/display/webgl/graphics_data.d.ts.map +1 -1
- package/types/phaser/display/webgl/mask_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/render_texture.d.ts +30 -3
- package/types/phaser/display/webgl/render_texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/renderer.d.ts +41 -4
- package/types/phaser/display/webgl/renderer.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/complex.d.ts +10 -0
- package/types/phaser/display/webgl/shader/complex.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/fast.d.ts +10 -0
- package/types/phaser/display/webgl/shader/fast.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/normal.d.ts +20 -0
- package/types/phaser/display/webgl/shader/normal.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/primitive.d.ts +10 -0
- package/types/phaser/display/webgl/shader/primitive.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader/strip.d.ts +10 -0
- package/types/phaser/display/webgl/shader/strip.d.ts.map +1 -1
- package/types/phaser/display/webgl/shader_manager.d.ts +15 -0
- package/types/phaser/display/webgl/shader_manager.d.ts.map +1 -1
- package/types/phaser/display/webgl/sprite_batch.d.ts +37 -0
- 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 +21 -0
- package/types/phaser/display/webgl/texture.d.ts.map +1 -1
- package/types/phaser/display/webgl/texture_util.d.ts.map +1 -1
- package/types/phaser/display/webgl/util.d.ts +0 -6
- package/types/phaser/display/webgl/util.d.ts.map +1 -1
- package/types/phaser/geom/circle.d.ts +131 -9
- package/types/phaser/geom/circle.d.ts.map +1 -1
- package/types/phaser/geom/ellipse.d.ts +43 -5
- package/types/phaser/geom/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/line.d.ts +159 -13
- package/types/phaser/geom/line.d.ts.map +1 -1
- package/types/phaser/geom/matrix.d.ts +85 -11
- package/types/phaser/geom/matrix.d.ts.map +1 -1
- package/types/phaser/geom/point.d.ts +170 -18
- 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 -20
- package/types/phaser/geom/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/rounded_rectangle.d.ts +11 -1
- package/types/phaser/geom/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/circle.d.ts +3 -3
- package/types/phaser/geom/util/circle.d.ts.map +1 -1
- package/types/phaser/geom/util/ellipse.d.ts +0 -6
- package/types/phaser/geom/util/ellipse.d.ts.map +1 -1
- package/types/phaser/geom/util/line.d.ts +5 -5
- package/types/phaser/geom/util/line.d.ts.map +1 -1
- package/types/phaser/geom/util/matrix.d.ts.map +1 -1
- package/types/phaser/geom/util/point.d.ts.map +1 -1
- package/types/phaser/geom/util/polygon.d.ts.map +1 -1
- package/types/phaser/geom/util/rectangle.d.ts.map +1 -1
- package/types/phaser/geom/util/rounded_rectangle.d.ts.map +1 -1
- package/types/phaser/util/math.d.ts +0 -5
- package/types/phaser/util/math.d.ts.map +1 -1
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @module display/display_object
|
|
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 '../geom/point';
|
|
8
|
-
import { Rectangle } from
|
|
9
|
-
import { Matrix } from
|
|
2
|
+
import { Rectangle } from '../geom/rectangle';
|
|
3
|
+
import { Matrix } from '../geom/matrix';
|
|
10
4
|
import { getIdentityMatrix } from '../geom/util/matrix';
|
|
11
5
|
import { PI_2 } from '../util/math';
|
|
12
6
|
import { renderCanvas, renderWebGL } from './sprite_util';
|
|
@@ -42,6 +36,9 @@ export class DisplayObject {
|
|
|
42
36
|
this.ignoreChildInput = false;
|
|
43
37
|
}
|
|
44
38
|
|
|
39
|
+
/**
|
|
40
|
+
* TBD.
|
|
41
|
+
*/
|
|
45
42
|
destroy() {
|
|
46
43
|
if (this.children) {
|
|
47
44
|
let i = this.children.length;
|
|
@@ -73,10 +70,19 @@ export class DisplayObject {
|
|
|
73
70
|
this.destroyCachedSprite();
|
|
74
71
|
}
|
|
75
72
|
|
|
73
|
+
/**
|
|
74
|
+
* TBD.
|
|
75
|
+
* @param child - TBD.
|
|
76
|
+
*/
|
|
76
77
|
addChild(child) {
|
|
77
78
|
return this.addChildAt(child, this.children.length);
|
|
78
79
|
}
|
|
79
80
|
|
|
81
|
+
/**
|
|
82
|
+
* TBD.
|
|
83
|
+
* @param child - TBD.
|
|
84
|
+
* @param {number} index - TBD.
|
|
85
|
+
*/
|
|
80
86
|
addChildAt(child, index) {
|
|
81
87
|
if (index >= 0 && index <= this.children.length) {
|
|
82
88
|
if (child.parent) {
|
|
@@ -86,15 +92,14 @@ export class DisplayObject {
|
|
|
86
92
|
this.children.splice(index, 0, child);
|
|
87
93
|
return child;
|
|
88
94
|
}
|
|
89
|
-
throw new Error(
|
|
90
|
-
child +
|
|
91
|
-
'addChildAt: The index ' +
|
|
92
|
-
index +
|
|
93
|
-
' supplied is out of bounds ' +
|
|
94
|
-
this.children.length
|
|
95
|
-
);
|
|
95
|
+
throw new Error(child + 'addChildAt: The index ' + index + ' supplied is out of bounds ' + this.children.length);
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/**
|
|
99
|
+
* TBD.
|
|
100
|
+
* @param child - TBD.
|
|
101
|
+
* @param child2 - TBD.
|
|
102
|
+
*/
|
|
98
103
|
swapChildren(child, child2) {
|
|
99
104
|
if (child === child2) {
|
|
100
105
|
return;
|
|
@@ -102,14 +107,16 @@ export class DisplayObject {
|
|
|
102
107
|
const index1 = this.getChildIndex(child);
|
|
103
108
|
const index2 = this.getChildIndex(child2);
|
|
104
109
|
if (index1 < 0 || index2 < 0) {
|
|
105
|
-
throw new Error(
|
|
106
|
-
'swapChildren: Both the supplied DisplayObjects must be a child of the caller.'
|
|
107
|
-
);
|
|
110
|
+
throw new Error('swapChildren: Both the supplied DisplayObjects must be a child of the caller.');
|
|
108
111
|
}
|
|
109
112
|
this.children[index1] = child2;
|
|
110
113
|
this.children[index2] = child;
|
|
111
114
|
}
|
|
112
115
|
|
|
116
|
+
/**
|
|
117
|
+
* TBD.
|
|
118
|
+
* @param child - TBD.
|
|
119
|
+
*/
|
|
113
120
|
getChildIndex(child) {
|
|
114
121
|
const index = this.children.indexOf(child);
|
|
115
122
|
if (index === -1) {
|
|
@@ -118,6 +125,11 @@ export class DisplayObject {
|
|
|
118
125
|
return index;
|
|
119
126
|
}
|
|
120
127
|
|
|
128
|
+
/**
|
|
129
|
+
* TBD.
|
|
130
|
+
* @param child - TBD.
|
|
131
|
+
* @param {number} index - TBD.
|
|
132
|
+
*/
|
|
121
133
|
setChildIndex(child, index) {
|
|
122
134
|
if (index < 0 || index >= this.children.length) {
|
|
123
135
|
throw new Error('The supplied index is out of bounds');
|
|
@@ -127,6 +139,10 @@ export class DisplayObject {
|
|
|
127
139
|
this.children.splice(index, 0, child); // add at new position
|
|
128
140
|
}
|
|
129
141
|
|
|
142
|
+
/**
|
|
143
|
+
* TBD.
|
|
144
|
+
* @param {number} index - TBD.
|
|
145
|
+
*/
|
|
130
146
|
getChildAt(index) {
|
|
131
147
|
if (index < 0 || index >= this.children.length) {
|
|
132
148
|
throw new Error(
|
|
@@ -138,6 +154,10 @@ export class DisplayObject {
|
|
|
138
154
|
return this.children[index];
|
|
139
155
|
}
|
|
140
156
|
|
|
157
|
+
/**
|
|
158
|
+
* TBD.
|
|
159
|
+
* @param child - TBD.
|
|
160
|
+
*/
|
|
141
161
|
removeChild(child) {
|
|
142
162
|
const index = this.children.indexOf(child);
|
|
143
163
|
if (index === -1) {
|
|
@@ -146,6 +166,10 @@ export class DisplayObject {
|
|
|
146
166
|
return this.removeChildAt(index);
|
|
147
167
|
}
|
|
148
168
|
|
|
169
|
+
/**
|
|
170
|
+
* TBD.
|
|
171
|
+
* @param {number} index - TBD.
|
|
172
|
+
*/
|
|
149
173
|
removeChildAt(index) {
|
|
150
174
|
const child = this.getChildAt(index);
|
|
151
175
|
if (child) {
|
|
@@ -155,6 +179,11 @@ export class DisplayObject {
|
|
|
155
179
|
return child;
|
|
156
180
|
}
|
|
157
181
|
|
|
182
|
+
/**
|
|
183
|
+
* TBD.
|
|
184
|
+
* @param {number} beginIndex - TBD.
|
|
185
|
+
* @param {number} endIndex - TBD.
|
|
186
|
+
*/
|
|
158
187
|
removeChildren(beginIndex, endIndex) {
|
|
159
188
|
if (beginIndex === undefined) {
|
|
160
189
|
beginIndex = 0;
|
|
@@ -177,6 +206,10 @@ export class DisplayObject {
|
|
|
177
206
|
throw new Error('removeChildren: Range Error, numeric values are outside the acceptable range');
|
|
178
207
|
}
|
|
179
208
|
|
|
209
|
+
/**
|
|
210
|
+
* TBD.
|
|
211
|
+
* @param parent - TBD.
|
|
212
|
+
*/
|
|
180
213
|
updateTransform(parent) {
|
|
181
214
|
if (!parent && !this.parent) {
|
|
182
215
|
return this;
|
|
@@ -260,9 +293,12 @@ export class DisplayObject {
|
|
|
260
293
|
return this;
|
|
261
294
|
}
|
|
262
295
|
|
|
296
|
+
/**
|
|
297
|
+
* TBD.
|
|
298
|
+
* @param targetCoordinateSpace - TBD.
|
|
299
|
+
*/
|
|
263
300
|
getBounds(targetCoordinateSpace) {
|
|
264
|
-
const isTargetCoordinateSpaceDisplayObject =
|
|
265
|
-
targetCoordinateSpace && targetCoordinateSpace.contains !== undefined;
|
|
301
|
+
const isTargetCoordinateSpaceDisplayObject = targetCoordinateSpace && targetCoordinateSpace.contains !== undefined;
|
|
266
302
|
let isTargetCoordinateSpaceThisOrParent = true;
|
|
267
303
|
if (!isTargetCoordinateSpaceDisplayObject) {
|
|
268
304
|
targetCoordinateSpace = this;
|
|
@@ -358,10 +394,19 @@ export class DisplayObject {
|
|
|
358
394
|
return bounds;
|
|
359
395
|
}
|
|
360
396
|
|
|
397
|
+
/**
|
|
398
|
+
* TBD.
|
|
399
|
+
* @returns {Rectangle} TBD.
|
|
400
|
+
*/
|
|
361
401
|
getLocalBounds() {
|
|
362
402
|
return this.getBounds(this);
|
|
363
403
|
}
|
|
364
404
|
|
|
405
|
+
/**
|
|
406
|
+
* TBD.
|
|
407
|
+
* @param child - TBD.
|
|
408
|
+
* @returns {boolean} TBD.
|
|
409
|
+
*/
|
|
365
410
|
contains(child) {
|
|
366
411
|
if (!child) {
|
|
367
412
|
return false;
|
|
@@ -372,6 +417,10 @@ export class DisplayObject {
|
|
|
372
417
|
return this.contains(child.parent);
|
|
373
418
|
}
|
|
374
419
|
|
|
420
|
+
/**
|
|
421
|
+
* TBD.
|
|
422
|
+
* @param renderSession - TBD.
|
|
423
|
+
*/
|
|
375
424
|
renderWebGL(renderSession) {
|
|
376
425
|
if (!this.visible || this.alpha <= 0) {
|
|
377
426
|
return;
|
|
@@ -402,6 +451,10 @@ export class DisplayObject {
|
|
|
402
451
|
}
|
|
403
452
|
}
|
|
404
453
|
|
|
454
|
+
/**
|
|
455
|
+
* TBD.
|
|
456
|
+
* @param renderSession - TBD.
|
|
457
|
+
*/
|
|
405
458
|
renderCanvas(renderSession) {
|
|
406
459
|
if (!this.visible || this.alpha <= 0) {
|
|
407
460
|
return;
|
|
@@ -417,28 +470,49 @@ export class DisplayObject {
|
|
|
417
470
|
}
|
|
418
471
|
}
|
|
419
472
|
|
|
473
|
+
/**
|
|
474
|
+
* TBD.
|
|
475
|
+
*/
|
|
420
476
|
preUpdate() {
|
|
421
477
|
// override
|
|
422
478
|
}
|
|
423
479
|
|
|
480
|
+
/**
|
|
481
|
+
* TBD.
|
|
482
|
+
*/
|
|
424
483
|
update() {
|
|
425
484
|
// override
|
|
426
485
|
}
|
|
427
486
|
|
|
487
|
+
/**
|
|
488
|
+
* TBD.
|
|
489
|
+
*/
|
|
428
490
|
postUpdate() {
|
|
429
491
|
// override
|
|
430
492
|
}
|
|
431
493
|
|
|
494
|
+
/**
|
|
495
|
+
* TBD.
|
|
496
|
+
*/
|
|
432
497
|
generateTexture() {
|
|
433
498
|
// TODO
|
|
434
499
|
console.warn('display_object.generateTexture() is not implemented');
|
|
435
500
|
}
|
|
436
501
|
|
|
502
|
+
/**
|
|
503
|
+
* TBD.
|
|
504
|
+
* @param position - TBD.
|
|
505
|
+
*/
|
|
437
506
|
toGlobal(position) {
|
|
438
507
|
this.updateTransform();
|
|
439
508
|
return this.worldTransform.apply(position);
|
|
440
509
|
}
|
|
441
510
|
|
|
511
|
+
/**
|
|
512
|
+
* TBD.
|
|
513
|
+
* @param position - TBD.
|
|
514
|
+
* @param from - TBD.
|
|
515
|
+
*/
|
|
442
516
|
toLocal(position, from) {
|
|
443
517
|
if (from) {
|
|
444
518
|
position = from.toGlobal(position);
|
|
@@ -447,6 +521,10 @@ export class DisplayObject {
|
|
|
447
521
|
return this.worldTransform.applyInverse(position);
|
|
448
522
|
}
|
|
449
523
|
|
|
524
|
+
/**
|
|
525
|
+
* TBD.
|
|
526
|
+
* @param renderSession - TBD.
|
|
527
|
+
*/
|
|
450
528
|
renderCachedSprite(renderSession) {
|
|
451
529
|
if (!this._cachedSprite) {
|
|
452
530
|
return;
|
|
@@ -459,10 +537,16 @@ export class DisplayObject {
|
|
|
459
537
|
}
|
|
460
538
|
}
|
|
461
539
|
|
|
540
|
+
/**
|
|
541
|
+
* TBD.
|
|
542
|
+
*/
|
|
462
543
|
generateCachedSprite() {
|
|
463
544
|
// TODO
|
|
464
545
|
}
|
|
465
546
|
|
|
547
|
+
/**
|
|
548
|
+
* TBD.
|
|
549
|
+
*/
|
|
466
550
|
destroyCachedSprite() {
|
|
467
551
|
if (!this._cachedSprite) {
|
|
468
552
|
return;
|
|
@@ -473,10 +557,17 @@ export class DisplayObject {
|
|
|
473
557
|
|
|
474
558
|
// GETTER SETTER
|
|
475
559
|
|
|
560
|
+
/**
|
|
561
|
+
* TBD.
|
|
562
|
+
* @returns {number} TBD.
|
|
563
|
+
*/
|
|
476
564
|
get width() {
|
|
477
565
|
return this.getLocalBounds().width * this.scale.x;
|
|
478
566
|
}
|
|
479
567
|
|
|
568
|
+
/**
|
|
569
|
+
* TBD.
|
|
570
|
+
*/
|
|
480
571
|
set width(value) {
|
|
481
572
|
const width = this.getLocalBounds().width;
|
|
482
573
|
if (width !== 0) {
|
|
@@ -487,10 +578,17 @@ export class DisplayObject {
|
|
|
487
578
|
this._width = value;
|
|
488
579
|
}
|
|
489
580
|
|
|
581
|
+
/**
|
|
582
|
+
* TBD.
|
|
583
|
+
* @returns {number} TBD.
|
|
584
|
+
*/
|
|
490
585
|
get height() {
|
|
491
586
|
return this.getLocalBounds().height * this.scale.y;
|
|
492
587
|
}
|
|
493
588
|
|
|
589
|
+
/**
|
|
590
|
+
* TBD.
|
|
591
|
+
*/
|
|
494
592
|
set height(value) {
|
|
495
593
|
const height = this.getLocalBounds().height;
|
|
496
594
|
if (height !== 0) {
|
|
@@ -501,22 +599,40 @@ export class DisplayObject {
|
|
|
501
599
|
this._height = value;
|
|
502
600
|
}
|
|
503
601
|
|
|
602
|
+
/**
|
|
603
|
+
* TBD.
|
|
604
|
+
* @returns {number} TBD.
|
|
605
|
+
*/
|
|
504
606
|
get x() {
|
|
505
607
|
return this.position.x;
|
|
506
608
|
}
|
|
507
609
|
|
|
610
|
+
/**
|
|
611
|
+
* TBD.
|
|
612
|
+
*/
|
|
508
613
|
set x(value) {
|
|
509
614
|
this.position.x = value;
|
|
510
615
|
}
|
|
511
616
|
|
|
617
|
+
/**
|
|
618
|
+
* TBD.
|
|
619
|
+
* @returns {number} TBD.
|
|
620
|
+
*/
|
|
512
621
|
get y() {
|
|
513
622
|
return this.position.y;
|
|
514
623
|
}
|
|
515
624
|
|
|
625
|
+
/**
|
|
626
|
+
* TBD.
|
|
627
|
+
*/
|
|
516
628
|
set y(value) {
|
|
517
629
|
this.position.y = value;
|
|
518
630
|
}
|
|
519
631
|
|
|
632
|
+
/**
|
|
633
|
+
* TBD.
|
|
634
|
+
* @returns {boolean} TBD.
|
|
635
|
+
*/
|
|
520
636
|
get worldVisible() {
|
|
521
637
|
if (!this.visible) {
|
|
522
638
|
return false;
|
|
@@ -536,10 +652,16 @@ export class DisplayObject {
|
|
|
536
652
|
|
|
537
653
|
// MASK
|
|
538
654
|
|
|
655
|
+
/**
|
|
656
|
+
* TBD.
|
|
657
|
+
*/
|
|
539
658
|
get mask() {
|
|
540
659
|
return this._mask;
|
|
541
660
|
}
|
|
542
661
|
|
|
662
|
+
/**
|
|
663
|
+
* TBD.
|
|
664
|
+
*/
|
|
543
665
|
set mask(value) {
|
|
544
666
|
if (this._mask) {
|
|
545
667
|
this._mask.isMask = false;
|
|
@@ -552,58 +674,108 @@ export class DisplayObject {
|
|
|
552
674
|
|
|
553
675
|
// BOUNDS
|
|
554
676
|
|
|
677
|
+
/**
|
|
678
|
+
* TBD.
|
|
679
|
+
* @returns {number} TBD.
|
|
680
|
+
*/
|
|
555
681
|
get offsetX() {
|
|
556
682
|
return this.anchor.x * this.width;
|
|
557
683
|
}
|
|
558
684
|
|
|
685
|
+
/**
|
|
686
|
+
* TBD.
|
|
687
|
+
* @returns {number} TBD.
|
|
688
|
+
*/
|
|
559
689
|
get offsetY() {
|
|
560
690
|
return this.anchor.y * this.height;
|
|
561
691
|
}
|
|
562
692
|
|
|
693
|
+
/**
|
|
694
|
+
* TBD.
|
|
695
|
+
* @returns {number} TBD.
|
|
696
|
+
*/
|
|
563
697
|
get centerX() {
|
|
564
698
|
return this.x - this.offsetX + this.width * 0.5;
|
|
565
699
|
}
|
|
566
700
|
|
|
701
|
+
/**
|
|
702
|
+
* TBD.
|
|
703
|
+
*/
|
|
567
704
|
set centerX(value) {
|
|
568
705
|
this.x = value + this.offsetX - this.width * 0.5;
|
|
569
706
|
}
|
|
570
707
|
|
|
708
|
+
/**
|
|
709
|
+
* TBD.
|
|
710
|
+
* @returns {number} TBD.
|
|
711
|
+
*/
|
|
571
712
|
get centerY() {
|
|
572
713
|
return this.y - this.offsetY + this.height * 0.5;
|
|
573
714
|
}
|
|
574
715
|
|
|
716
|
+
/**
|
|
717
|
+
* TBD.
|
|
718
|
+
*/
|
|
575
719
|
set centerY(value) {
|
|
576
720
|
this.y = value + this.offsetY - this.height * 0.5;
|
|
577
721
|
}
|
|
578
722
|
|
|
723
|
+
/**
|
|
724
|
+
* TBD.
|
|
725
|
+
* @returns {number} TBD.
|
|
726
|
+
*/
|
|
579
727
|
get left() {
|
|
580
728
|
return this.x - this.offsetX;
|
|
581
729
|
}
|
|
582
730
|
|
|
731
|
+
/**
|
|
732
|
+
* TBD.
|
|
733
|
+
*/
|
|
583
734
|
set left(value) {
|
|
584
735
|
this.x = value + this.offsetX;
|
|
585
736
|
}
|
|
586
737
|
|
|
738
|
+
/**
|
|
739
|
+
* TBD.
|
|
740
|
+
* @returns {number} TBD.
|
|
741
|
+
*/
|
|
587
742
|
get right() {
|
|
588
743
|
return this.x + this.width - this.offsetX;
|
|
589
744
|
}
|
|
590
745
|
|
|
746
|
+
/**
|
|
747
|
+
* TBD.
|
|
748
|
+
*/
|
|
591
749
|
set right(value) {
|
|
592
750
|
this.x = value - this.width + this.offsetX;
|
|
593
751
|
}
|
|
594
752
|
|
|
753
|
+
/**
|
|
754
|
+
* TBD.
|
|
755
|
+
* @returns {number} TBD.
|
|
756
|
+
*/
|
|
595
757
|
get top() {
|
|
596
758
|
return this.y - this.offsetY;
|
|
597
759
|
}
|
|
598
760
|
|
|
761
|
+
/**
|
|
762
|
+
* TBD.
|
|
763
|
+
*/
|
|
599
764
|
set top(value) {
|
|
600
765
|
this.y = value + this.offsetY;
|
|
601
766
|
}
|
|
602
767
|
|
|
768
|
+
/**
|
|
769
|
+
* TBD.
|
|
770
|
+
* @returns {number} TBD.
|
|
771
|
+
*/
|
|
603
772
|
get bottom() {
|
|
604
773
|
return this.y + this.height - this.offsetY;
|
|
605
774
|
}
|
|
606
775
|
|
|
776
|
+
/**
|
|
777
|
+
* TBD.
|
|
778
|
+
*/
|
|
607
779
|
set bottom(value) {
|
|
608
780
|
this.y = value - this.height + this.offsetY;
|
|
609
781
|
}
|