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