babylonjs-gui 5.28.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
@@ -556,7 +556,7 @@ declare module BABYLON.GUI {
556
556
  get image(): BABYLON.Nullable<Image>;
557
557
  private _textBlock;
558
558
  /**
559
- * Returns the image part of the button (if any)
559
+ * Returns the TextBlock part of the button (if any)
560
560
  */
561
561
  get textBlock(): BABYLON.Nullable<TextBlock>;
562
562
  /**
@@ -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
@@ -451,7 +451,7 @@ __webpack_require__.r(__webpack_exports__);
451
451
  /* harmony export */ "AdvancedDynamicTexture": () => (/* binding */ AdvancedDynamicTexture)
452
452
  /* harmony export */ });
453
453
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
454
- /* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/typeStore */ "core/Misc/observable");
454
+ /* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/stringTools */ "core/Misc/observable");
455
455
  /* harmony import */ var core_Misc_observable__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__);
456
456
  /* harmony import */ var _controls_container__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./controls/container */ "../../../lts/gui/dist/2D/controls/container.js");
457
457
  /* harmony import */ var _controls_control__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./controls/control */ "../../../lts/gui/dist/2D/controls/control.js");
@@ -476,6 +476,7 @@ __webpack_require__.r(__webpack_exports__);
476
476
 
477
477
 
478
478
 
479
+
479
480
 
480
481
  /**
481
482
  * Class used to create texture to support 2D GUI elements
@@ -1490,6 +1491,9 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1490
1491
  if (!scene) {
1491
1492
  return;
1492
1493
  }
1494
+ if (this._pointerObserver) {
1495
+ scene.onPointerObservable.remove(this._pointerObserver);
1496
+ }
1493
1497
  this._pointerObserver = scene.onPointerObservable.add(function (pi) {
1494
1498
  if (pi.type !== core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE &&
1495
1499
  pi.type !== core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERUP &&
@@ -1751,7 +1755,14 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1751
1755
  request.addEventListener("readystatechange", function () {
1752
1756
  if (request.readyState == 4) {
1753
1757
  if (request.status == 200) {
1754
- var gui = snippet ? JSON.parse(JSON.parse(request.responseText).jsonPayload).gui : request.responseText;
1758
+ var gui = void 0;
1759
+ if (snippet) {
1760
+ var payload = JSON.parse(JSON.parse(request.responseText).jsonPayload);
1761
+ gui = payload.encodedGui ? new TextDecoder("utf-8").decode((0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.DecodeBase64ToBinary)(payload.encodedGui)) : payload.gui;
1762
+ }
1763
+ else {
1764
+ gui = request.responseText;
1765
+ }
1755
1766
  var serializationObject = JSON.parse(gui);
1756
1767
  resolve(serializationObject);
1757
1768
  }
@@ -1973,7 +1984,7 @@ var Button = /** @class */ (function (_super) {
1973
1984
  });
1974
1985
  Object.defineProperty(Button.prototype, "textBlock", {
1975
1986
  /**
1976
- * Returns the image part of the button (if any)
1987
+ * Returns the TextBlock part of the button (if any)
1977
1988
  */
1978
1989
  get: function () {
1979
1990
  return this._textBlock;
@@ -3822,7 +3833,7 @@ __webpack_require__.r(__webpack_exports__);
3822
3833
  /* harmony export */ "Container": () => (/* binding */ Container)
3823
3834
  /* harmony export */ });
3824
3835
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
3825
- /* 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");
3826
3837
  /* harmony import */ var core_Misc_logger__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__);
3827
3838
  /* harmony import */ var _control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./control */ "../../../lts/gui/dist/2D/controls/control.js");
3828
3839
  /* harmony import */ var _measure__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../measure */ "../../../lts/gui/dist/2D/measure.js");
@@ -3835,6 +3846,7 @@ __webpack_require__.r(__webpack_exports__);
3835
3846
 
3836
3847
 
3837
3848
 
3849
+
3838
3850
  /**
3839
3851
  * Root class for 2D containers
3840
3852
  * @see https://doc.babylonjs.com/how_to/gui#containers
@@ -3870,6 +3882,14 @@ var Container = /** @class */ (function (_super) {
3870
3882
  * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
3871
3883
  */
3872
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();
3873
3893
  return _this;
3874
3894
  }
3875
3895
  Object.defineProperty(Container.prototype, "renderToIntermediateTexture", {
@@ -4024,6 +4044,7 @@ var Container = /** @class */ (function (_super) {
4024
4044
  control._markAllAsDirty();
4025
4045
  this._reOrderControl(control);
4026
4046
  this._markAsDirty();
4047
+ this.onControlAddedObservable.notifyObservers(control);
4027
4048
  return this;
4028
4049
  };
4029
4050
  /**
@@ -4054,6 +4075,7 @@ var Container = /** @class */ (function (_super) {
4054
4075
  this._host._cleanControlAfterRemoval(control);
4055
4076
  }
4056
4077
  this._markAsDirty();
4078
+ this.onControlRemovedObservable.notifyObservers(control);
4057
4079
  return this;
4058
4080
  };
4059
4081
  /**
@@ -4545,6 +4567,8 @@ var Control = /** @class */ (function () {
4545
4567
  this._linkOffsetX = new _valueAndUnit__WEBPACK_IMPORTED_MODULE_2__.ValueAndUnit(0);
4546
4568
  /** @internal */
4547
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();
4548
4572
  /**
4549
4573
  * An event triggered when pointer wheel is scrolled
4550
4574
  */
@@ -4589,6 +4613,10 @@ var Control = /** @class */ (function () {
4589
4613
  * An event triggered when the control has been disposed
4590
4614
  */
4591
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();
4592
4620
  /**
4593
4621
  * Gets or sets a fixed ratio for this control.
4594
4622
  * When different from 0, the ratio is used to compute the "second" dimension.
@@ -4704,6 +4732,21 @@ var Control = /** @class */ (function () {
4704
4732
  Control.prototype.getClassName = function () {
4705
4733
  return this._getTypeName();
4706
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
+ });
4707
4750
  Object.defineProperty(Control.prototype, "host", {
4708
4751
  /**
4709
4752
  * Get the hosting AdvancedDynamicTexture
@@ -5167,6 +5210,7 @@ var Control = /** @class */ (function () {
5167
5210
  }
5168
5211
  this._isVisible = value;
5169
5212
  this._markAsDirty(true);
5213
+ this.onIsVisibleChangedObservable.notifyObservers(value);
5170
5214
  },
5171
5215
  enumerable: false,
5172
5216
  configurable: true
@@ -15303,13 +15347,13 @@ var StackPanel = /** @class */ (function (_super) {
15303
15347
  // User can now define their own height and width for stack panel.
15304
15348
  var panelWidthChanged = false;
15305
15349
  var panelHeightChanged = false;
15306
- if (!this._manualHeight && this._isVertical) {
15350
+ if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {
15307
15351
  // do not specify height if strictly defined by user
15308
15352
  var previousHeight = this.height;
15309
15353
  this.height = stackHeight + "px";
15310
15354
  panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;
15311
15355
  }
15312
- if (!this._manualWidth && !this._isVertical) {
15356
+ if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {
15313
15357
  // do not specify width if strictly defined by user
15314
15358
  var previousWidth = this.width;
15315
15359
  this.width = stackWidth + "px";