babylonjs-gui 9.32.0 → 9.32.1

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
@@ -4180,8 +4180,10 @@ declare namespace BABYLON.GUI {
4180
4180
  /** @internal */
4181
4181
  _isFullscreen: boolean;
4182
4182
  private _fullscreenViewport;
4183
- private _idealWidth;
4184
- private _idealHeight;
4183
+ /** @internal */
4184
+ _idealWidth: number;
4185
+ /** @internal */
4186
+ _idealHeight: number;
4185
4187
  private _useSmallestIdeal;
4186
4188
  private _renderAtIdealSize;
4187
4189
  private _focusedControl;
@@ -7642,6 +7644,7 @@ declare namespace BABYLON.GUI {
7642
7644
  */
7643
7645
  _processObservables(type: number, x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
7644
7646
  private _getStyleProperty;
7647
+ private _getFont;
7645
7648
  private _prepareFont;
7646
7649
  /**
7647
7650
  * A control has a dimension fully defined if that dimension doesn't depend on the parent's dimension.
@@ -7672,6 +7675,7 @@ declare namespace BABYLON.GUI {
7672
7675
  parse(serializedObject: any, host?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Control;
7673
7676
  /**
7674
7677
  * Serializes the current control
7678
+ * Preserves the live layout and cached font metrics when adaptive scaling is enabled.
7675
7679
  * @param serializationObject defined the JSON serialized object
7676
7680
  * @param force if the control should be serialized even if the isSerializable flag is set to false (default false)
7677
7681
  * @param allowCanvas defines if the control is allowed to use a Canvas2D object to serialize (true by default)
@@ -875,12 +875,13 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
875
875
  else if (e === t.PointerEventTypes.POINTERTAP)
876
876
  return this._host._lastControlDown[n] && this._host._lastControlDown[n]._onPointerPick(this, this._dummyVector2, n, o, !0, a), delete this._host._lastControlDown[n], !0; return !1; };
877
877
  e.prototype._getStyleProperty = function (e, t) { var i; var s = null !== (i = this._style && this._style[e]) && void 0 !== i ? i : this[e]; return !s && this.parent ? this.parent._getStyleProperty(e, t) : this.parent ? s : t; };
878
+ e.prototype._getFont = function () { return this._getStyleProperty("fontStyle", "") + " " + this._getStyleProperty("fontWeight", "") + " " + this.fontSizeInPixels + "px " + this._getStyleProperty("fontFamily", "Arial"); };
878
879
  e.prototype._prepareFont = function () {
879
880
  var e_6, _a;
880
881
  var t, i;
881
882
  if (!this._font && !this._fontSet)
882
883
  return;
883
- this._font = this._getStyleProperty("fontStyle", "") + " " + this._getStyleProperty("fontWeight", "") + " " + this.fontSizeInPixels + "px " + this._getStyleProperty("fontFamily", "Arial"), this._fontOffset = e._GetFontOffset(this._font, null === (i = null === (t = this._host) || void 0 === t ? void 0 : t.getScene()) || void 0 === i ? void 0 : i.getEngine());
884
+ this._font = this._getFont(), this._fontOffset = e._GetFontOffset(this._font, null === (i = null === (t = this._host) || void 0 === t ? void 0 : t.getScene()) || void 0 === i ? void 0 : i.getEngine());
884
885
  var s = this.getDescendants();
885
886
  try {
886
887
  for (var s_4 = __values(s), s_4_1 = s_4.next(); !s_4_1.done; s_4_1 = s_4.next()) {
@@ -903,13 +904,20 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
903
904
  var _this = this;
904
905
  return this._urlRewriter = s, t.SerializationHelper.Parse(function () { return _this; }, e, null), this.name = e.name, this._parseFromContent(e, null != i ? i : this._host), this;
905
906
  };
906
- e.prototype.serialize = function (e, i, s) {
907
- if (i === void 0) { i = !1; }
908
- if (s === void 0) { s = !0; }
909
- if (!this.isSerializable && !i)
907
+ e.prototype.serialize = function (i, s, a) {
908
+ if (s === void 0) { s = !1; }
909
+ if (a === void 0) { a = !0; }
910
+ var n, o, r;
911
+ if (!this.isSerializable && !s)
910
912
  return;
911
- var a = 0, n = 0;
912
- this.host && (n = this.host.idealHeight, a = this.host.idealWidth, this.host.idealWidth = 0, this.host.idealHeight = 0), t.SerializationHelper.Serialize(this, e), e.name = this.name, e.className = this.getClassName(), s && this._prepareFont(), this._fontFamily && (e.fontFamily = this._fontFamily), this.fontSize && (e.fontSize = this.fontSize), this.fontWeight && (e.fontWeight = this.fontWeight), this.fontStyle && (e.fontStyle = this.fontStyle), this._gradient && (e.gradient = {}, this._gradient.serialize(e.gradient)), t.SerializationHelper.AppendSerializedAnimations(this, e), this.host && (this.host.idealWidth = a, this.host.idealHeight = n);
913
+ var l = this._host, _ = null !== (n = null == l ? void 0 : l.idealWidth) && void 0 !== n ? n : 0, h = null !== (o = null == l ? void 0 : l.idealHeight) && void 0 !== o ? o : 0;
914
+ l && (l._idealWidth = 0, l._idealHeight = 0);
915
+ try {
916
+ t.SerializationHelper.Serialize(this, i), i.name = this.name, i.className = this.getClassName(), a && (this._font || this._fontSet) && (i.fontOffset = e._GetFontOffset(this._getFont(), null === (r = null == l ? void 0 : l.getScene()) || void 0 === r ? void 0 : r.getEngine())), this._fontFamily && (i.fontFamily = this._fontFamily), this.fontSize && (i.fontSize = this.fontSize), this.fontWeight && (i.fontWeight = this.fontWeight), this.fontStyle && (i.fontStyle = this.fontStyle), this._gradient && (i.gradient = {}, this._gradient.serialize(i.gradient)), t.SerializationHelper.AppendSerializedAnimations(this, i);
917
+ }
918
+ finally {
919
+ l && (l._idealWidth = _, l._idealHeight = h);
920
+ }
913
921
  };
914
922
  e.prototype._parseFromContent = function (e, i, s) { var a, n; if (e.fontFamily && (this.fontFamily = e.fontFamily), e.fontSize && (this.fontSize = e.fontSize), e.fontWeight && (this.fontWeight = e.fontWeight), e.fontStyle && (this.fontStyle = e.fontStyle), e.gradient) {
915
923
  var i_7 = t.Tools.Instantiate("BABYLON.GUI." + e.gradient.className);