@energy8platform/game-engine 0.15.0 → 0.15.1

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 CHANGED
@@ -3451,30 +3451,35 @@ class FlexContainer extends pixi_js.Container {
3451
3451
  this._computedHeight = this._explicitHeight > 0 ? this._explicitHeight : (pt + naturalMainSize + pb);
3452
3452
  }
3453
3453
  // Position flexExclude children (absolute positioning).
3454
- // All position props describe the visual (bounds) rectangle, so we subtract
3455
- // `ox/oy` to compensate for children with a centered origin (Button, Label).
3454
+ // All position props describe the visual (bounds) rectangle. We derive the
3455
+ // visual rectangle directly from `getLocalBounds()` rather than the
3456
+ // layout-config `w`/`h` returned by measureChild — those may differ from
3457
+ // actual bounds when the user pins `layoutWidth`/`layoutHeight` to a value
3458
+ // that doesn't match the child's real visual extent (e.g. a Button whose
3459
+ // text overflows its configured `width`). Mixing layout size with real
3460
+ // bounds-origin would shift the visual center off the requested point.
3456
3461
  // `centerX/centerY` take precedence over `left/right` / `top/bottom` on each axis.
3457
3462
  for (const child of this._layoutChildren) {
3458
3463
  if (!child._flexConfig?.flexExclude)
3459
3464
  continue;
3460
3465
  const cfg = child._flexConfig;
3461
- const { w, h, ox, oy } = measureChild(child, pctRefW, pctRefH);
3466
+ const bounds = child.getLocalBounds();
3462
3467
  const cw = this._computedWidth;
3463
3468
  const ch = this._computedHeight;
3464
3469
  const centerX = resolveDimension(cfg.centerX, pctRefW);
3465
3470
  if (centerX !== undefined)
3466
- child.x = centerX - w / 2 - ox;
3471
+ child.x = centerX - bounds.x - bounds.width / 2;
3467
3472
  else if (cfg.left !== undefined)
3468
- child.x = cfg.left - ox;
3473
+ child.x = cfg.left - bounds.x;
3469
3474
  else if (cfg.right !== undefined)
3470
- child.x = cw - w - cfg.right - ox;
3475
+ child.x = cw - cfg.right - bounds.x - bounds.width;
3471
3476
  const centerY = resolveDimension(cfg.centerY, pctRefH);
3472
3477
  if (centerY !== undefined)
3473
- child.y = centerY - h / 2 - oy;
3478
+ child.y = centerY - bounds.y - bounds.height / 2;
3474
3479
  else if (cfg.top !== undefined)
3475
- child.y = cfg.top - oy;
3480
+ child.y = cfg.top - bounds.y;
3476
3481
  else if (cfg.bottom !== undefined)
3477
- child.y = ch - h - cfg.bottom - oy;
3482
+ child.y = ch - cfg.bottom - bounds.y - bounds.height;
3478
3483
  }
3479
3484
  }
3480
3485
  /** Computed content size (after layout) */