@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.
- package/dist/scene/HudRuntime.js +16 -9
- package/package.json +1 -1
package/dist/scene/HudRuntime.js
CHANGED
|
@@ -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
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
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
|
-
|
|
121
|
+
np = factory.call(scene.add, x, y, 1, 1, asset.textureKey, String(frame ?? 0), columns, rows);
|
|
117
122
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
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
|