@energy8platform/game-engine 0.14.0 → 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.d.ts CHANGED
@@ -1355,6 +1355,7 @@ declare class FlexContainer extends Container {
1355
1355
  /** @internal */ _rawHeight: number | string;
1356
1356
  private _layoutChildren;
1357
1357
  private _layoutDirty;
1358
+ private _layoutSuspended;
1358
1359
  constructor(config?: FlexContainerConfig);
1359
1360
  /** Add a child with optional flex config. Also registers in flex layout. */
1360
1361
  addFlexChild(child: Container, flexConfig?: FlexItemConfig): this;
@@ -1367,9 +1368,14 @@ declare class FlexContainer extends Container {
1367
1368
  * This enables declarative usage from React JSX.
1368
1369
  */
1369
1370
  addChild<T extends Container>(...children: T[]): T;
1371
+ addChildAt<T extends Container>(child: T, index: number): T;
1370
1372
  removeChild<T extends Container>(...children: T[]): T;
1371
1373
  /** Get all flex layout children (read-only) */
1372
1374
  get flexChildren(): readonly Container[];
1375
+ /** Suspend automatic layout recalculation. Call resumeLayout() to flush. */
1376
+ suspendLayout(): void;
1377
+ /** Resume automatic layout and flush if dirty. */
1378
+ resumeLayout(): void;
1373
1379
  /** Update the container size and recalculate layout */
1374
1380
  resize(width: number, height: number): void;
1375
1381
  /** Update layout direction */
package/dist/index.esm.js CHANGED
@@ -3150,6 +3150,7 @@ class FlexContainer extends Container {
3150
3150
  /** @internal */ _rawHeight;
3151
3151
  _layoutChildren = [];
3152
3152
  _layoutDirty = true;
3153
+ _layoutSuspended = false;
3153
3154
  constructor(config = {}) {
3154
3155
  super();
3155
3156
  this._config = {
@@ -3211,7 +3212,19 @@ class FlexContainer extends Container {
3211
3212
  }
3212
3213
  }
3213
3214
  const result = super.addChild(...children);
3214
- if (this._layoutDirty)
3215
+ if (this._layoutDirty && !this._layoutSuspended)
3216
+ this.updateLayout();
3217
+ return result;
3218
+ }
3219
+ addChildAt(child, index) {
3220
+ if (!this._layoutChildren.includes(child)) {
3221
+ // Insert into layout children at matching position
3222
+ const layoutIndex = Math.min(index, this._layoutChildren.length);
3223
+ this._layoutChildren.splice(layoutIndex, 0, child);
3224
+ this._layoutDirty = true;
3225
+ }
3226
+ const result = super.addChildAt(child, index);
3227
+ if (this._layoutDirty && !this._layoutSuspended)
3215
3228
  this.updateLayout();
3216
3229
  return result;
3217
3230
  }
@@ -3229,6 +3242,16 @@ class FlexContainer extends Container {
3229
3242
  get flexChildren() {
3230
3243
  return this._layoutChildren;
3231
3244
  }
3245
+ /** Suspend automatic layout recalculation. Call resumeLayout() to flush. */
3246
+ suspendLayout() {
3247
+ this._layoutSuspended = true;
3248
+ }
3249
+ /** Resume automatic layout and flush if dirty. */
3250
+ resumeLayout() {
3251
+ this._layoutSuspended = false;
3252
+ if (this._layoutDirty)
3253
+ this.updateLayout();
3254
+ }
3232
3255
  /** Update the container size and recalculate layout */
3233
3256
  resize(width, height) {
3234
3257
  this._explicitWidth = width;