@energy8platform/game-engine 0.33.4 → 0.33.6

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/dist/scene.esm.js CHANGED
@@ -3129,17 +3129,21 @@ const reelGridContribution = {
3129
3129
  system.setBoard(board.map((column) => column.map((cell) => (typeof cell === 'string' ? { symbol: cell } : cell))));
3130
3130
  };
3131
3131
  setBoard(props.board);
3132
- // The reel system's local content does not start at (0,0) (cells/decoration extend
3133
- // around the geometry origin), so align it inside a wrapper: measure() re-reads the
3134
- // real local bounds each layout and keeps the wrapper's (0,0) = content top-left.
3132
+ // The reel system's local content does not start at (0,0) (cells center on geometry
3133
+ // positions), so align it inside a wrapper. The origin comes from the STATIC geometry
3134
+ // (first cell center half cell), never from getLocalBounds animated cells hang
3135
+ // far outside the window mid-spin and a bounds-based origin would drift the grid.
3135
3136
  const wrapper = new Container();
3136
3137
  wrapper.addChild(system.view);
3137
- let contentOrigin = { x: 0, y: 0 };
3138
+ const contentOrigin = { x: 0, y: 0 };
3138
3139
  const syncContent = () => {
3139
- const lb = system.view.getLocalBounds();
3140
- contentOrigin = { x: lb.x, y: lb.y };
3141
- system.view.position.set(-lb.x, -lb.y);
3142
- return { width: lb.width, height: lb.height };
3140
+ const geom = system.grid.geometry;
3141
+ const first = system.grid.cellPosition(0, 0);
3142
+ const cell = system.config.grid.cellSize;
3143
+ contentOrigin.x = first.x - cell / 2;
3144
+ contentOrigin.y = first.y - cell / 2;
3145
+ system.view.position.set(-contentOrigin.x, -contentOrigin.y);
3146
+ return { width: geom.gridW, height: geom.gridH };
3143
3147
  };
3144
3148
  const instance = {
3145
3149
  view: wrapper,