wgge 2.0.30 → 2.0.31
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.
|
@@ -32,9 +32,9 @@ export default class ActivatedTreeNode {
|
|
|
32
32
|
autoRegisterEvents = null;
|
|
33
33
|
|
|
34
34
|
/**
|
|
35
|
-
* @type
|
|
35
|
+
* @type number
|
|
36
36
|
*/
|
|
37
|
-
|
|
37
|
+
childrenRemoved = 0;
|
|
38
38
|
|
|
39
39
|
constructor() {
|
|
40
40
|
this.isActivated = false;
|
|
@@ -65,13 +65,13 @@ export default class ActivatedTreeNode {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
hasChildren() {
|
|
68
|
-
return this.children.length >
|
|
68
|
+
return this.children.length > this.childrenRemoved;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
removeChild(node) {
|
|
72
72
|
const index = this.children.indexOf(node);
|
|
73
73
|
if (index >= 0) {
|
|
74
|
-
this.
|
|
74
|
+
this.childrenRemoved++;
|
|
75
75
|
node.deactivate();
|
|
76
76
|
node.isRemoved = true;
|
|
77
77
|
node.parent = null;
|
|
@@ -89,20 +89,21 @@ export default class ActivatedTreeNode {
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
resetChildren() {
|
|
92
|
-
this.children.
|
|
92
|
+
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
93
|
+
this.children[i].deactivate();
|
|
94
|
+
}
|
|
93
95
|
this.children = [];
|
|
94
|
-
this.
|
|
96
|
+
this.childrenRemoved = 0;
|
|
95
97
|
}
|
|
96
98
|
|
|
97
99
|
updateRemovedChildren() {
|
|
98
|
-
if (this.
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
this.children.length = w;
|
|
104
|
-
this.childWasRemoved = false
|
|
100
|
+
if (this.childrenRemoved === 0) return;
|
|
101
|
+
let w = 0;
|
|
102
|
+
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
103
|
+
if (!this.children[i].isRemoved) this.children[w++] = this.children[i];
|
|
105
104
|
}
|
|
105
|
+
this.children.length = w;
|
|
106
|
+
this.childrenRemoved = 0;
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
activate() {
|
|
@@ -44,7 +44,8 @@ export default class ControllerBase extends ActivatedTreeNode {
|
|
|
44
44
|
this.updateInternal(delta);
|
|
45
45
|
|
|
46
46
|
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
47
|
-
this.children[i]
|
|
47
|
+
const child = this.children[i];
|
|
48
|
+
if (!child.isRemoved) child.update(delta);
|
|
48
49
|
}
|
|
49
50
|
|
|
50
51
|
this.updateRemovedChildren();
|
|
@@ -20,7 +20,6 @@ export default class RendererBase extends ActivatedTreeNode {
|
|
|
20
20
|
super();
|
|
21
21
|
this.game = game;
|
|
22
22
|
this.model = model;
|
|
23
|
-
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
render() {
|
|
@@ -34,7 +33,8 @@ export default class RendererBase extends ActivatedTreeNode {
|
|
|
34
33
|
this.renderInternal();
|
|
35
34
|
|
|
36
35
|
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
37
|
-
this.children[i]
|
|
36
|
+
const child = this.children[i];
|
|
37
|
+
if (!child.isRemoved) child.render();
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
this.updateRemovedChildren();
|