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