@babylonjs/gui 7.44.0 → 7.45.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.
@@ -2104,6 +2104,16 @@ export class Control {
2104
2104
  if (!this.isSerializable && !force) {
2105
2105
  return;
2106
2106
  }
2107
+ let idealWidth = 0;
2108
+ let idealHeight = 0;
2109
+ // the host's ideal width and height are influencing the serialization, as they are used in getValue() of ValueAndUnit.
2110
+ // for a proper serialization, we need to temporarily set them to 0 and re-set them back afterwards.
2111
+ if (this.host) {
2112
+ idealHeight = this.host.idealHeight;
2113
+ idealWidth = this.host.idealWidth;
2114
+ this.host.idealWidth = 0;
2115
+ this.host.idealHeight = 0;
2116
+ }
2107
2117
  SerializationHelper.Serialize(this, serializationObject);
2108
2118
  serializationObject.name = this.name;
2109
2119
  serializationObject.className = this.getClassName();
@@ -2129,6 +2139,11 @@ export class Control {
2129
2139
  }
2130
2140
  // Animations
2131
2141
  SerializationHelper.AppendSerializedAnimations(this, serializationObject);
2142
+ // re-set the ideal width and height
2143
+ if (this.host) {
2144
+ this.host.idealWidth = idealWidth;
2145
+ this.host.idealHeight = idealHeight;
2146
+ }
2132
2147
  }
2133
2148
  /**
2134
2149
  * @internal