babylonjs-gui 5.27.1 → 5.29.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
  /**
@@ -922,7 +922,7 @@ declare module BABYLON.GUI {
922
922
  * Root class used for all 2D controls
923
923
  * @see https://doc.babylonjs.com/how_to/gui#controls
924
924
  */
925
- export class Control {
925
+ export class Control implements BABYLON.IAnimatable {
926
926
  /** defines the name of the control */
927
927
  name?: string | undefined;
928
928
  /**
@@ -1419,6 +1419,10 @@ declare module BABYLON.GUI {
1419
1419
  * Gets/sets the deoverlap movement multiplier
1420
1420
  */
1421
1421
  overlapDeltaMultiplier?: number;
1422
+ /**
1423
+ * Array of animations
1424
+ */
1425
+ animations: BABYLON.Nullable<BABYLON.Animation[]>;
1422
1426
  /**
1423
1427
  * Creates a new control
1424
1428
  * @param name defines the name of the control
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
@@ -1751,7 +1752,14 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1751
1752
  request.addEventListener("readystatechange", function () {
1752
1753
  if (request.readyState == 4) {
1753
1754
  if (request.status == 200) {
1754
- var gui = snippet ? JSON.parse(JSON.parse(request.responseText).jsonPayload).gui : request.responseText;
1755
+ var gui = void 0;
1756
+ if (snippet) {
1757
+ var payload = JSON.parse(JSON.parse(request.responseText).jsonPayload);
1758
+ gui = payload.encodedGui ? new TextDecoder("utf-8").decode((0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.DecodeBase64ToBinary)(payload.encodedGui)) : payload.gui;
1759
+ }
1760
+ else {
1761
+ gui = request.responseText;
1762
+ }
1755
1763
  var serializationObject = JSON.parse(gui);
1756
1764
  resolve(serializationObject);
1757
1765
  }
@@ -1973,7 +1981,7 @@ var Button = /** @class */ (function (_super) {
1973
1981
  });
1974
1982
  Object.defineProperty(Button.prototype, "textBlock", {
1975
1983
  /**
1976
- * Returns the image part of the button (if any)
1984
+ * Returns the TextBlock part of the button (if any)
1977
1985
  */
1978
1986
  get: function () {
1979
1987
  return this._textBlock;
@@ -4597,6 +4605,10 @@ var Control = /** @class */ (function () {
4597
4605
  */
4598
4606
  this.fixedRatio = 0;
4599
4607
  this._fixedRatioMasterIsWidth = true;
4608
+ /**
4609
+ * Array of animations
4610
+ */
4611
+ this.animations = null;
4600
4612
  this._tmpMeasureA = new _measure__WEBPACK_IMPORTED_MODULE_3__.Measure(0, 0, 0, 0);
4601
4613
  }
4602
4614
  Object.defineProperty(Control.prototype, "isReadOnly", {
@@ -6491,6 +6503,8 @@ var Control = /** @class */ (function () {
6491
6503
  serializationObject.fontWeight = this.fontWeight;
6492
6504
  serializationObject.fontStyle = this.fontStyle;
6493
6505
  }
6506
+ // Animations
6507
+ core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.SerializationHelper.AppendSerializedAnimations(this, serializationObject);
6494
6508
  };
6495
6509
  /**
6496
6510
  * @internal
@@ -6508,6 +6522,22 @@ var Control = /** @class */ (function () {
6508
6522
  if (serializedObject.fontStyle) {
6509
6523
  this.fontStyle = serializedObject.fontStyle;
6510
6524
  }
6525
+ // Animations
6526
+ if (serializedObject.animations) {
6527
+ this.animations = [];
6528
+ for (var animationIndex = 0; animationIndex < serializedObject.animations.length; animationIndex++) {
6529
+ var parsedAnimation = serializedObject.animations[animationIndex];
6530
+ var internalClass = (0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.GetClass)("BABYLON.Animation");
6531
+ if (internalClass) {
6532
+ this.animations.push(internalClass.Parse(parsedAnimation));
6533
+ }
6534
+ }
6535
+ if (serializedObject.autoAnimate && this._host && this._host.getScene()) {
6536
+ this._host
6537
+ .getScene()
6538
+ .beginAnimation(this, serializedObject.autoAnimateFrom, serializedObject.autoAnimateTo, serializedObject.autoAnimateLoop, serializedObject.autoAnimateSpeed || 1.0);
6539
+ }
6540
+ }
6511
6541
  };
6512
6542
  /** Releases associated resources */
6513
6543
  Control.prototype.dispose = function () {