@energy8platform/game-engine 0.15.1 → 0.15.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.
- package/dist/index.cjs.js +15 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +15 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/react.cjs.js +15 -10
- package/dist/react.cjs.js.map +1 -1
- package/dist/react.esm.js +15 -10
- package/dist/react.esm.js.map +1 -1
- package/dist/ui.cjs.js +15 -10
- package/dist/ui.cjs.js.map +1 -1
- package/dist/ui.esm.js +15 -10
- package/dist/ui.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/ui/FlexContainer.ts +15 -10
package/dist/index.cjs.js
CHANGED
|
@@ -2945,24 +2945,29 @@ function measureChild(child, parentContentW = 0, parentContentH = 0) {
|
|
|
2945
2945
|
const cfg = child._flexConfig;
|
|
2946
2946
|
const resolvedLW = resolveDimension(cfg?.layoutWidth, parentContentW);
|
|
2947
2947
|
const resolvedLH = resolveDimension(cfg?.layoutHeight, parentContentH);
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
}
|
|
2951
|
-
// For FlexContainers, use their explicit or computed size
|
|
2948
|
+
// FlexContainer children are top-left origin by construction, so `ox/oy = 0`
|
|
2949
|
+
// is correct and we can skip the `getLocalBounds()` call entirely.
|
|
2952
2950
|
if (child instanceof FlexContainer) {
|
|
2953
2951
|
const fc = child;
|
|
2954
2952
|
const w = fc._explicitWidth > 0 ? fc._explicitWidth : (fc._computedWidth > 0 ? fc._computedWidth : undefined);
|
|
2955
2953
|
const h = fc._explicitHeight > 0 ? fc._explicitHeight : (fc._computedHeight > 0 ? fc._computedHeight : undefined);
|
|
2956
2954
|
if (w !== undefined && h !== undefined) {
|
|
2957
|
-
return { w, h, ox: 0, oy: 0 };
|
|
2955
|
+
return { w: resolvedLW ?? w, h: resolvedLH ?? h, ox: 0, oy: 0 };
|
|
2958
2956
|
}
|
|
2959
2957
|
}
|
|
2960
|
-
// Use localBounds to get the true visual
|
|
2961
|
-
//
|
|
2958
|
+
// Use localBounds to get the true visual origin offset.
|
|
2959
|
+
// We take `ox/oy` from bounds unconditionally — a user-supplied `layoutWidth/Height`
|
|
2960
|
+
// overrides the SIZE used by flex (protection against pre-paint bounds of 0), but
|
|
2961
|
+
// it must NOT erase the center-anchor compensation: Button/Label views are drawn at
|
|
2962
|
+
// `(-w/2..w/2)` and their bounds.x = -w/2 is what lets `layoutLine` place the
|
|
2963
|
+
// visible rectangle where the layout intends.
|
|
2962
2964
|
const bounds = child.getLocalBounds();
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2965
|
+
return {
|
|
2966
|
+
w: resolvedLW ?? bounds.width,
|
|
2967
|
+
h: resolvedLH ?? bounds.height,
|
|
2968
|
+
ox: bounds.x,
|
|
2969
|
+
oy: bounds.y,
|
|
2970
|
+
};
|
|
2966
2971
|
}
|
|
2967
2972
|
/**
|
|
2968
2973
|
* Set a child's main or cross dimension.
|