babylonjs-gui 5.37.0 → 5.39.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
@@ -1674,6 +1674,19 @@ declare module BABYLON.GUI {
1674
1674
  */
1675
1675
  _processObservables(type: number, x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
1676
1676
  private _prepareFont;
1677
+ /**
1678
+ * Clones a control and its descendants
1679
+ * @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
1680
+ * @returns the cloned control
1681
+ */
1682
+ clone(host?: AdvancedDynamicTexture): Control;
1683
+ /**
1684
+ * Parses a serialized object into this control
1685
+ * @param serializedObject the object with the serialized properties
1686
+ * @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
1687
+ * @returns this control
1688
+ */
1689
+ parse(serializedObject: any, host?: AdvancedDynamicTexture): Control;
1677
1690
  /**
1678
1691
  * Serializes the current control
1679
1692
  * @param serializationObject defined the JSON serialized object
package/babylon.gui.js CHANGED
@@ -131,7 +131,7 @@ function __generator(thisArg, body) {
131
131
  function verb(n) { return function (v) { return step([n, v]); }; }
132
132
  function step(op) {
133
133
  if (f) throw new TypeError("Generator is already executing.");
134
- while (_) try {
134
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
135
135
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
136
136
  if (y = 0, t) op = [op[0] & 2, t.value];
137
137
  switch (op[0]) {
@@ -6525,6 +6525,32 @@ var Control = /** @class */ (function () {
6525
6525
  //children need to be refreshed
6526
6526
  this.getDescendants().forEach(function (child) { return child._markAllAsDirty(); });
6527
6527
  };
6528
+ /**
6529
+ * Clones a control and its descendants
6530
+ * @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
6531
+ * @returns the cloned control
6532
+ */
6533
+ Control.prototype.clone = function (host) {
6534
+ var serialization = {};
6535
+ this.serialize(serialization);
6536
+ var controlType = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Tools.Instantiate("BABYLON.GUI." + serialization.className);
6537
+ var cloned = new controlType();
6538
+ cloned.parse(serialization, host);
6539
+ return cloned;
6540
+ };
6541
+ /**
6542
+ * Parses a serialized object into this control
6543
+ * @param serializedObject the object with the serialized properties
6544
+ * @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
6545
+ * @returns this control
6546
+ */
6547
+ Control.prototype.parse = function (serializedObject, host) {
6548
+ var _this = this;
6549
+ core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.SerializationHelper.Parse(function () { return _this; }, serializedObject, null);
6550
+ this.name = serializedObject.name;
6551
+ this._parseFromContent(serializedObject, host !== null && host !== void 0 ? host : this._host);
6552
+ return this;
6553
+ };
6528
6554
  /**
6529
6555
  * Serializes the current control
6530
6556
  * @param serializationObject defined the JSON serialized object