@energy8platform/game-engine 0.14.2 → 0.14.4

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
@@ -3258,7 +3258,8 @@ class FlexContainer extends pixi_js.Container {
3258
3258
  this._explicitWidth = width;
3259
3259
  this._explicitHeight = height;
3260
3260
  this._layoutDirty = true;
3261
- this.updateLayout();
3261
+ if (!this._layoutSuspended)
3262
+ this.updateLayout();
3262
3263
  }
3263
3264
  /** Update layout direction */
3264
3265
  setDirection(direction) {
@@ -3291,6 +3292,10 @@ class FlexContainer extends pixi_js.Container {
3291
3292
  * adding/removing children without resize.
3292
3293
  */
3293
3294
  updateLayout() {
3295
+ if (this._layoutSuspended) {
3296
+ this._layoutDirty = true;
3297
+ return;
3298
+ }
3294
3299
  this._layoutDirty = false;
3295
3300
  const { direction, justifyContent, alignItems, gap, flexWrap, alignContent } = this._config;
3296
3301
  const [pt, pr, pb, pl] = this._padding;
@@ -3499,11 +3504,12 @@ class FlexContainer extends pixi_js.Container {
3499
3504
  this._explicitWidth = typeof w === 'number' ? w : 0;
3500
3505
  this._explicitHeight = typeof h === 'number' ? h : 0;
3501
3506
  this._layoutDirty = true;
3502
- this.updateLayout();
3507
+ if (!this._layoutSuspended)
3508
+ this.updateLayout();
3503
3509
  }
3504
3510
  return;
3505
3511
  }
3506
- if (this._layoutDirty)
3512
+ if (this._layoutDirty && !this._layoutSuspended)
3507
3513
  this.updateLayout();
3508
3514
  }
3509
3515
  destroy(options) {
@@ -4086,6 +4092,14 @@ class Panel extends pixi_js.Container {
4086
4092
  get content() {
4087
4093
  return this._content;
4088
4094
  }
4095
+ /** Suspend content layout recalculation. Call resumeLayout() to flush. */
4096
+ suspendLayout() {
4097
+ this._content.suspendLayout();
4098
+ }
4099
+ /** Resume content layout and flush if dirty. */
4100
+ resumeLayout() {
4101
+ this._content.resumeLayout();
4102
+ }
4089
4103
  /** Convenience: add a child to the content layout */
4090
4104
  addContent(child) {
4091
4105
  this._content.addFlexChild(child);
@@ -4389,6 +4403,7 @@ class Modal extends pixi_js.Container {
4389
4403
  _contentContainer;
4390
4404
  _config;
4391
4405
  _showing = false;
4406
+ _internalSetup = true;
4392
4407
  /** Called when the modal is closed */
4393
4408
  onClose;
4394
4409
  constructor(config = {}) {
@@ -4410,11 +4425,34 @@ class Modal extends pixi_js.Container {
4410
4425
  this._contentContainer = new pixi_js.Container();
4411
4426
  this.addChild(this._contentContainer);
4412
4427
  this.visible = false;
4428
+ this._internalSetup = false;
4413
4429
  }
4414
4430
  /** Content container — add your UI here */
4415
4431
  get content() {
4416
4432
  return this._contentContainer;
4417
4433
  }
4434
+ /**
4435
+ * Override addChild so external children are routed to _contentContainer.
4436
+ * Enables `<modal><flexContainer>...</flexContainer></modal>` in React JSX.
4437
+ */
4438
+ addChild(...children) {
4439
+ if (this._internalSetup) {
4440
+ return super.addChild(...children);
4441
+ }
4442
+ for (const child of children) {
4443
+ this._contentContainer.addChild(child);
4444
+ }
4445
+ return children[0];
4446
+ }
4447
+ removeChild(...children) {
4448
+ if (this._internalSetup) {
4449
+ return super.removeChild(...children);
4450
+ }
4451
+ for (const child of children) {
4452
+ this._contentContainer.removeChild(child);
4453
+ }
4454
+ return children[0];
4455
+ }
4418
4456
  /** Whether the modal is currently showing */
4419
4457
  get isShowing() {
4420
4458
  return this._showing;