@unboxy/phaser-sdk 0.2.38 → 0.2.39

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.
@@ -107,17 +107,24 @@ function createImageOrNinePatch(scene, x, y, width, height, asset, frame) {
107
107
  if (factory) {
108
108
  const columns = [cuts.leftWidth, undefined, cuts.rightWidth];
109
109
  const rows = [cuts.topHeight, undefined, cuts.bottomHeight];
110
- // Per-frame uses rex's 9-arg `(scene, x, y, w, h, key, baseFrame, cols, rows)`
111
- // form baseFrame scopes the slicing to that one cell of the spritesheet.
112
- // rex types baseFrame as string; Phaser accepts either string or number
113
- // for spritesheet frame access, but passing String() satisfies the typed
114
- // overload on rex's side.
110
+ // Construct at a placeholder 1×1 size, then resize() to target. Reason:
111
+ // Phaser 3.60+ refactored RenderTexture so that setSize() (which rex's
112
+ // constructor calls) only updates the gameobject's display dimensions,
113
+ // NOT the underlying DynamicTexture's canvas. The 9-slice draw pass
114
+ // then draws into the default 32×32 canvas and only the top-left
115
+ // corner of the patch is visible at 200×64 display. resize() — unlike
116
+ // setSize() — does call DynamicTexture.setSize, but rex's resize early-
117
+ // returns when current dims match target. Forcing initial dims of 1×1
118
+ // ensures resize() to (width, height) does real work.
119
+ let np;
115
120
  if (isPerFrame) {
116
- return factory.call(scene.add, x, y, width, height, asset.textureKey, String(frame ?? 0), columns, rows);
121
+ np = factory.call(scene.add, x, y, 1, 1, asset.textureKey, String(frame ?? 0), columns, rows);
117
122
  }
118
- // Middle column/row left undefined → that segment stretches to fill
119
- // the remaining space between the two fixed-width edges.
120
- return factory.call(scene.add, x, y, width, height, asset.textureKey, columns, rows);
123
+ else {
124
+ np = factory.call(scene.add, x, y, 1, 1, asset.textureKey, columns, rows);
125
+ }
126
+ np.resize(width, height);
127
+ return np;
121
128
  }
122
129
  // Plugin not registered — degrade to a stretched Image rather than crash
123
130
  // an entire HUD render. Symptom is "corners distort on resize", not a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unboxy/phaser-sdk",
3
- "version": "0.2.38",
3
+ "version": "0.2.39",
4
4
  "description": "Unboxy Phaser 3 SDK — game infrastructure for the Unboxy platform",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",