@energy8platform/game-engine 0.14.1 → 0.14.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 CHANGED
@@ -3151,6 +3151,7 @@ class FlexContainer extends pixi_js.Container {
3151
3151
  /** @internal */ _rawHeight;
3152
3152
  _layoutChildren = [];
3153
3153
  _layoutDirty = true;
3154
+ _layoutSuspended = false;
3154
3155
  constructor(config = {}) {
3155
3156
  super();
3156
3157
  this._config = {
@@ -3212,7 +3213,19 @@ class FlexContainer extends pixi_js.Container {
3212
3213
  }
3213
3214
  }
3214
3215
  const result = super.addChild(...children);
3215
- if (this._layoutDirty)
3216
+ if (this._layoutDirty && !this._layoutSuspended)
3217
+ this.updateLayout();
3218
+ return result;
3219
+ }
3220
+ addChildAt(child, index) {
3221
+ if (!this._layoutChildren.includes(child)) {
3222
+ // Insert into layout children at matching position
3223
+ const layoutIndex = Math.min(index, this._layoutChildren.length);
3224
+ this._layoutChildren.splice(layoutIndex, 0, child);
3225
+ this._layoutDirty = true;
3226
+ }
3227
+ const result = super.addChildAt(child, index);
3228
+ if (this._layoutDirty && !this._layoutSuspended)
3216
3229
  this.updateLayout();
3217
3230
  return result;
3218
3231
  }
@@ -3230,6 +3243,16 @@ class FlexContainer extends pixi_js.Container {
3230
3243
  get flexChildren() {
3231
3244
  return this._layoutChildren;
3232
3245
  }
3246
+ /** Suspend automatic layout recalculation. Call resumeLayout() to flush. */
3247
+ suspendLayout() {
3248
+ this._layoutSuspended = true;
3249
+ }
3250
+ /** Resume automatic layout and flush if dirty. */
3251
+ resumeLayout() {
3252
+ this._layoutSuspended = false;
3253
+ if (this._layoutDirty)
3254
+ this.updateLayout();
3255
+ }
3233
3256
  /** Update the container size and recalculate layout */
3234
3257
  resize(width, height) {
3235
3258
  this._explicitWidth = width;