squishjs 0.7.5 → 0.7.51
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/package.json +1 -1
- package/src/BaseNode.js +3 -3
- package/src/ViewableGame.js +9 -12
package/package.json
CHANGED
package/src/BaseNode.js
CHANGED
|
@@ -68,10 +68,10 @@ class BaseNode {
|
|
|
68
68
|
}
|
|
69
69
|
|
|
70
70
|
findChild(id) {
|
|
71
|
-
return this
|
|
71
|
+
return this.findChildHelper(id, this);
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
findChildHelper(nodeId, node, found = null) {
|
|
75
75
|
if (node.node.id === nodeId) {
|
|
76
76
|
found = node;
|
|
77
77
|
}
|
|
@@ -80,7 +80,7 @@ class BaseNode {
|
|
|
80
80
|
if (found) {
|
|
81
81
|
return found
|
|
82
82
|
}
|
|
83
|
-
found = this
|
|
83
|
+
found = this.findChildHelper(nodeId, node.node.children[i], found);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
return found;
|
package/src/ViewableGame.js
CHANGED
|
@@ -12,15 +12,12 @@ const makePlane = (s) => {
|
|
|
12
12
|
};
|
|
13
13
|
|
|
14
14
|
class ViewableGame extends Game {
|
|
15
|
-
#plane;
|
|
16
|
-
#fakeRoot;
|
|
17
|
-
#planeSize;
|
|
18
15
|
constructor(planeSize) {
|
|
19
16
|
super();
|
|
20
|
-
this
|
|
21
|
-
this
|
|
17
|
+
this.planeSize = planeSize;
|
|
18
|
+
this.plane = makePlane(this.planeSize);
|
|
22
19
|
|
|
23
|
-
this
|
|
20
|
+
this.fakeRoot = new GameNode.Shape({
|
|
24
21
|
shapeType: Shapes.POLYGON,
|
|
25
22
|
coordinates2d: ShapeUtils.rectangle(0, 0, 0, 0),
|
|
26
23
|
fill: Colors.COLORS.BLACK,
|
|
@@ -28,14 +25,14 @@ class ViewableGame extends Game {
|
|
|
28
25
|
|
|
29
26
|
this.layers = [
|
|
30
27
|
{
|
|
31
|
-
root: this
|
|
28
|
+
root: this.fakeRoot
|
|
32
29
|
}
|
|
33
30
|
];
|
|
34
31
|
}
|
|
35
32
|
|
|
36
33
|
updatePlaneSize(s) {
|
|
37
|
-
this
|
|
38
|
-
this
|
|
34
|
+
this.planeSize = s;
|
|
35
|
+
this.plane.node.coordinates2d = ShapeUtils.rectangle(0, 0, s, s);
|
|
39
36
|
}
|
|
40
37
|
|
|
41
38
|
getLayers() {
|
|
@@ -43,15 +40,15 @@ class ViewableGame extends Game {
|
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
getPlane() {
|
|
46
|
-
return this
|
|
43
|
+
return this.plane;
|
|
47
44
|
}
|
|
48
45
|
|
|
49
46
|
getPlaneSize() {
|
|
50
|
-
return this
|
|
47
|
+
return this.planeSize;
|
|
51
48
|
}
|
|
52
49
|
|
|
53
50
|
getViewRoot() {
|
|
54
|
-
return this
|
|
51
|
+
return this.fakeRoot;
|
|
55
52
|
}
|
|
56
53
|
|
|
57
54
|
}
|