babylonjs-gui 5.29.0 → 5.30.0

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/babylon.gui.d.ts CHANGED
@@ -858,6 +858,14 @@ declare module BABYLON.GUI {
858
858
  * @returns the current container
859
859
  */
860
860
  removeControl(control: Control): Container;
861
+ /**
862
+ * An event triggered when any control is added to this container.
863
+ */
864
+ onControlAddedObservable: BABYLON.Observable<BABYLON.Nullable<Control>>;
865
+ /**
866
+ * An event triggered when any control is removed from this container.
867
+ */
868
+ onControlRemovedObservable: BABYLON.Observable<BABYLON.Nullable<Control>>;
861
869
  /**
862
870
  * @internal
863
871
  */
@@ -1098,6 +1106,14 @@ declare module BABYLON.GUI {
1098
1106
  * @returns current class name
1099
1107
  */
1100
1108
  getClassName(): string;
1109
+ /**
1110
+ * Gets or sets the accessibility tag to describe the control for accessibility purpose.
1111
+ * By default, GUI controls already indicate accessibility info, but one can override the info using this tag.
1112
+ */
1113
+ set accessibilityTag(value: BABYLON.Nullable<BABYLON.IAccessibilityTag>);
1114
+ get accessibilityTag(): BABYLON.Nullable<BABYLON.IAccessibilityTag>;
1115
+ protected _accessibilityTag: BABYLON.Nullable<BABYLON.IAccessibilityTag>;
1116
+ onAccessibilityTagChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.IAccessibilityTag>>;
1101
1117
  /**
1102
1118
  * An event triggered when pointer wheel is scrolled
1103
1119
  */
@@ -1142,6 +1158,10 @@ declare module BABYLON.GUI {
1142
1158
  * An event triggered when the control has been disposed
1143
1159
  */
1144
1160
  onDisposeObservable: BABYLON.Observable<Control>;
1161
+ /**
1162
+ * An event triggered when the control isVisible is changed
1163
+ */
1164
+ onIsVisibleChangedObservable: BABYLON.Observable<boolean>;
1145
1165
  /**
1146
1166
  * Get the hosting AdvancedDynamicTexture
1147
1167
  */
@@ -2001,6 +2021,10 @@ declare module BABYLON.GUI {
2001
2021
  */
2002
2022
  export class Image extends Control {
2003
2023
  name?: string | undefined;
2024
+ /**
2025
+ * Specifies an alternate text for the image, if the image for some reason cannot be displayed.
2026
+ */
2027
+ alt?: string;
2004
2028
  private _workingCanvas;
2005
2029
  private _domImage;
2006
2030
  private _imageWidth;
package/babylon.gui.js CHANGED
@@ -1491,6 +1491,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1491
1491
  if (!scene) {
1492
1492
  return;
1493
1493
  }
1494
+ if (this._pointerObserver) {
1495
+ scene.onPointerObservable.remove(this._pointerObserver);
1496
+ }
1494
1497
  this._pointerObserver = scene.onPointerObservable.add(function (pi) {
1495
1498
  if (pi.type !== core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE &&
1496
1499
  pi.type !== core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERUP &&
@@ -3830,7 +3833,7 @@ __webpack_require__.r(__webpack_exports__);
3830
3833
  /* harmony export */ "Container": () => (/* binding */ Container)
3831
3834
  /* harmony export */ });
3832
3835
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
3833
- /* harmony import */ var core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Engines/constants */ "core/Misc/observable");
3836
+ /* harmony import */ var core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/observable */ "core/Misc/observable");
3834
3837
  /* harmony import */ var core_Misc_logger__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__);
3835
3838
  /* harmony import */ var _control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./control */ "../../../lts/gui/dist/2D/controls/control.js");
3836
3839
  /* harmony import */ var _measure__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../measure */ "../../../lts/gui/dist/2D/measure.js");
@@ -3843,6 +3846,7 @@ __webpack_require__.r(__webpack_exports__);
3843
3846
 
3844
3847
 
3845
3848
 
3849
+
3846
3850
  /**
3847
3851
  * Root class for 2D containers
3848
3852
  * @see https://doc.babylonjs.com/how_to/gui#containers
@@ -3878,6 +3882,14 @@ var Container = /** @class */ (function (_super) {
3878
3882
  * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
3879
3883
  */
3880
3884
  _this.maxLayoutCycle = 3;
3885
+ /**
3886
+ * An event triggered when any control is added to this container.
3887
+ */
3888
+ _this.onControlAddedObservable = new core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__.Observable();
3889
+ /**
3890
+ * An event triggered when any control is removed from this container.
3891
+ */
3892
+ _this.onControlRemovedObservable = new core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__.Observable();
3881
3893
  return _this;
3882
3894
  }
3883
3895
  Object.defineProperty(Container.prototype, "renderToIntermediateTexture", {
@@ -4032,6 +4044,7 @@ var Container = /** @class */ (function (_super) {
4032
4044
  control._markAllAsDirty();
4033
4045
  this._reOrderControl(control);
4034
4046
  this._markAsDirty();
4047
+ this.onControlAddedObservable.notifyObservers(control);
4035
4048
  return this;
4036
4049
  };
4037
4050
  /**
@@ -4062,6 +4075,7 @@ var Container = /** @class */ (function (_super) {
4062
4075
  this._host._cleanControlAfterRemoval(control);
4063
4076
  }
4064
4077
  this._markAsDirty();
4078
+ this.onControlRemovedObservable.notifyObservers(control);
4065
4079
  return this;
4066
4080
  };
4067
4081
  /**
@@ -4553,6 +4567,8 @@ var Control = /** @class */ (function () {
4553
4567
  this._linkOffsetX = new _valueAndUnit__WEBPACK_IMPORTED_MODULE_2__.ValueAndUnit(0);
4554
4568
  /** @internal */
4555
4569
  this._linkOffsetY = new _valueAndUnit__WEBPACK_IMPORTED_MODULE_2__.ValueAndUnit(0);
4570
+ this._accessibilityTag = null;
4571
+ this.onAccessibilityTagChangedObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Observable();
4556
4572
  /**
4557
4573
  * An event triggered when pointer wheel is scrolled
4558
4574
  */
@@ -4597,6 +4613,10 @@ var Control = /** @class */ (function () {
4597
4613
  * An event triggered when the control has been disposed
4598
4614
  */
4599
4615
  this.onDisposeObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Observable();
4616
+ /**
4617
+ * An event triggered when the control isVisible is changed
4618
+ */
4619
+ this.onIsVisibleChangedObservable = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Observable();
4600
4620
  /**
4601
4621
  * Gets or sets a fixed ratio for this control.
4602
4622
  * When different from 0, the ratio is used to compute the "second" dimension.
@@ -4712,6 +4732,21 @@ var Control = /** @class */ (function () {
4712
4732
  Control.prototype.getClassName = function () {
4713
4733
  return this._getTypeName();
4714
4734
  };
4735
+ Object.defineProperty(Control.prototype, "accessibilityTag", {
4736
+ get: function () {
4737
+ return this._accessibilityTag;
4738
+ },
4739
+ /**
4740
+ * Gets or sets the accessibility tag to describe the control for accessibility purpose.
4741
+ * By default, GUI controls already indicate accessibility info, but one can override the info using this tag.
4742
+ */
4743
+ set: function (value) {
4744
+ this._accessibilityTag = value;
4745
+ this.onAccessibilityTagChangedObservable.notifyObservers(value);
4746
+ },
4747
+ enumerable: false,
4748
+ configurable: true
4749
+ });
4715
4750
  Object.defineProperty(Control.prototype, "host", {
4716
4751
  /**
4717
4752
  * Get the hosting AdvancedDynamicTexture
@@ -5175,6 +5210,7 @@ var Control = /** @class */ (function () {
5175
5210
  }
5176
5211
  this._isVisible = value;
5177
5212
  this._markAsDirty(true);
5213
+ this.onIsVisibleChangedObservable.notifyObservers(value);
5178
5214
  },
5179
5215
  enumerable: false,
5180
5216
  configurable: true
@@ -15311,13 +15347,13 @@ var StackPanel = /** @class */ (function (_super) {
15311
15347
  // User can now define their own height and width for stack panel.
15312
15348
  var panelWidthChanged = false;
15313
15349
  var panelHeightChanged = false;
15314
- if (!this._manualHeight && this._isVertical) {
15350
+ if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {
15315
15351
  // do not specify height if strictly defined by user
15316
15352
  var previousHeight = this.height;
15317
15353
  this.height = stackHeight + "px";
15318
15354
  panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;
15319
15355
  }
15320
- if (!this._manualWidth && !this._isVertical) {
15356
+ if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {
15321
15357
  // do not specify width if strictly defined by user
15322
15358
  var previousWidth = this.width;
15323
15359
  this.width = stackWidth + "px";