squishjs 0.7.1 → 0.7.2

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/Squisher.js +8 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "squishjs",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "description": "squish & unsquish stuff",
5
5
  "scripts": {
6
6
  "test": "node testRunner.js"
package/src/Squisher.js CHANGED
@@ -14,6 +14,8 @@ class Squisher {
14
14
  this.customBottomLayer = customBottomLayer;
15
15
  this.customTopLayer = customTopLayer;
16
16
 
17
+ this.playerFrames = {};
18
+
17
19
  this.listeners = new Set();
18
20
  this.scale = scale || {x: 1, y: 1};
19
21
  this.state = this.squish(this.game.getLayers());
@@ -53,6 +55,7 @@ class Squisher {
53
55
  let toSquish = [];
54
56
 
55
57
  const playerMap = {};
58
+
56
59
  Object.keys(this.game.players).forEach(playerId => {
57
60
  playerMap[Number(playerId)] = [];
58
61
  });
@@ -83,12 +86,15 @@ class Squisher {
83
86
  toSquish.push(squishedLayer);
84
87
  }
85
88
 
86
- // todo: remove/move this side effect
87
- this.playerStates = playerMap;
89
+ this.playerFrames = playerMap;
88
90
 
89
91
  return toSquish.flat();
90
92
  }
91
93
 
94
+ getPlayerFrame(playerId) {
95
+ return this.playerFrames[playerId];
96
+ }
97
+
92
98
  squishHelper(node, squishedNodes, scale = {x: 1, y: 1}, playerMap = {}) {
93
99
  if (!node.node.listeners.has(this)) {
94
100
  node.addListener(this);