wgge 2.0.28 → 2.0.30
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.
|
@@ -17,6 +17,11 @@ export default class ActivatedTreeNode {
|
|
|
17
17
|
*/
|
|
18
18
|
isActivated;
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* @type boolean
|
|
22
|
+
*/
|
|
23
|
+
isRemoved= false;
|
|
24
|
+
|
|
20
25
|
/**
|
|
21
26
|
*
|
|
22
27
|
* @type array
|
|
@@ -26,6 +31,11 @@ export default class ActivatedTreeNode {
|
|
|
26
31
|
*/
|
|
27
32
|
autoRegisterEvents = null;
|
|
28
33
|
|
|
34
|
+
/**
|
|
35
|
+
* @type boolean
|
|
36
|
+
*/
|
|
37
|
+
childWasRemoved = false;
|
|
38
|
+
|
|
29
39
|
constructor() {
|
|
30
40
|
this.isActivated = false;
|
|
31
41
|
this.parent = null;
|
|
@@ -61,18 +71,13 @@ export default class ActivatedTreeNode {
|
|
|
61
71
|
removeChild(node) {
|
|
62
72
|
const index = this.children.indexOf(node);
|
|
63
73
|
if (index >= 0) {
|
|
64
|
-
this.
|
|
74
|
+
this.childWasRemoved = true;
|
|
65
75
|
node.deactivate();
|
|
76
|
+
node.isRemoved = true;
|
|
66
77
|
node.parent = null;
|
|
67
78
|
return node;
|
|
68
79
|
}
|
|
69
|
-
|
|
70
|
-
const child = this.children[i];
|
|
71
|
-
const result = child.removeChild(node);
|
|
72
|
-
if (result) {
|
|
73
|
-
return result;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
80
|
+
return undefined;
|
|
76
81
|
}
|
|
77
82
|
|
|
78
83
|
removeMyself() {
|
|
@@ -86,13 +91,17 @@ export default class ActivatedTreeNode {
|
|
|
86
91
|
resetChildren() {
|
|
87
92
|
this.children.forEach((child) => child.deactivate());
|
|
88
93
|
this.children = [];
|
|
94
|
+
this.childWasRemoved = false;
|
|
89
95
|
}
|
|
90
96
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
updateRemovedChildren() {
|
|
98
|
+
if (this.childWasRemoved) {
|
|
99
|
+
let w = 0;
|
|
100
|
+
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
101
|
+
if (!this.children[i].isRemoved) this.children[w++] = this.children[i];
|
|
102
|
+
}
|
|
103
|
+
this.children.length = w;
|
|
104
|
+
this.childWasRemoved = false
|
|
96
105
|
}
|
|
97
106
|
}
|
|
98
107
|
|
|
@@ -35,22 +35,19 @@ export default class ControllerBase extends ActivatedTreeNode {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
if (this.updateActions.length > 0) {
|
|
38
|
-
this.updateActions.
|
|
38
|
+
for (let i = 0, max = this.updateActions.length; i < max; i++) {
|
|
39
|
+
this.updateActions[i](delta);
|
|
40
|
+
}
|
|
39
41
|
this.updateActions = [];
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
this.updateInternal(delta);
|
|
43
45
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
47
|
-
this.updateActions.push(() => this.children[i].update(delta));
|
|
48
|
-
}
|
|
49
|
-
for (let i = 0, max = this.updateActions.length; i < max; i++) {
|
|
50
|
-
this.updateActions[i]();
|
|
51
|
-
}
|
|
52
|
-
this.updateActions = [];
|
|
46
|
+
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
47
|
+
this.children[i].update(delta);
|
|
53
48
|
}
|
|
49
|
+
|
|
50
|
+
this.updateRemovedChildren();
|
|
54
51
|
}
|
|
55
52
|
|
|
56
53
|
updateInternal(delta) {
|
|
@@ -33,7 +33,11 @@ export default class RendererBase extends ActivatedTreeNode {
|
|
|
33
33
|
|
|
34
34
|
this.renderInternal();
|
|
35
35
|
|
|
36
|
-
this.children.
|
|
36
|
+
for (let i = 0, max = this.children.length; i < max; i++) {
|
|
37
|
+
this.children[i].render();
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
this.updateRemovedChildren();
|
|
37
41
|
|
|
38
42
|
if (this.isRoot()) {
|
|
39
43
|
this.model.clean();
|