@babylonjs/gui 6.6.1 → 6.8.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.
@@ -326,14 +326,22 @@ export declare class Control implements IAnimatable {
326
326
  */
327
327
  get verticalAlignment(): number;
328
328
  set verticalAlignment(value: number);
329
+ private _fixedRatio;
330
+ set fixedRatio(value: number);
329
331
  /**
330
332
  * Gets or sets a fixed ratio for this control.
331
333
  * When different from 0, the ratio is used to compute the "second" dimension.
332
334
  * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
333
335
  * second dimension is computed as first dimension * fixedRatio
334
336
  */
335
- fixedRatio: number;
336
- protected _fixedRatioMasterIsWidth: boolean;
337
+ get fixedRatio(): number;
338
+ private _fixedRatioMasterIsWidth;
339
+ set fixedRatioMasterIsWidth(value: boolean);
340
+ /**
341
+ * Gets or sets a boolean indicating that the fixed ratio is set on the width instead of the height. True by default.
342
+ * When the height of a control is set, this property is changed to false.
343
+ */
344
+ get fixedRatioMasterIsWidth(): boolean;
337
345
  /**
338
346
  * Gets or sets control width
339
347
  * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
@@ -281,6 +281,36 @@ export class Control {
281
281
  this._verticalAlignment = value;
282
282
  this._markAsDirty();
283
283
  }
284
+ set fixedRatio(value) {
285
+ if (this._fixedRatio === value) {
286
+ return;
287
+ }
288
+ this._fixedRatio = value;
289
+ this._markAsDirty();
290
+ }
291
+ /**
292
+ * Gets or sets a fixed ratio for this control.
293
+ * When different from 0, the ratio is used to compute the "second" dimension.
294
+ * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
295
+ * second dimension is computed as first dimension * fixedRatio
296
+ */
297
+ get fixedRatio() {
298
+ return this._fixedRatio;
299
+ }
300
+ set fixedRatioMasterIsWidth(value) {
301
+ if (this._fixedRatioMasterIsWidth === value) {
302
+ return;
303
+ }
304
+ this._fixedRatioMasterIsWidth = value;
305
+ this._markAsDirty();
306
+ }
307
+ /**
308
+ * Gets or sets a boolean indicating that the fixed ratio is set on the width instead of the height. True by default.
309
+ * When the height of a control is set, this property is changed to false.
310
+ */
311
+ get fixedRatioMasterIsWidth() {
312
+ return this._fixedRatioMasterIsWidth;
313
+ }
284
314
  /**
285
315
  * Gets or sets control width
286
316
  * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#position-and-size
@@ -963,13 +993,7 @@ export class Control {
963
993
  * An event triggered when the control isVisible is changed
964
994
  */
965
995
  this.onIsVisibleChangedObservable = new Observable();
966
- /**
967
- * Gets or sets a fixed ratio for this control.
968
- * When different from 0, the ratio is used to compute the "second" dimension.
969
- * The first dimension used in the computation is the last one set (by setting width / widthInPixels or height / heightInPixels), and the
970
- * second dimension is computed as first dimension * fixedRatio
971
- */
972
- this.fixedRatio = 0;
996
+ this._fixedRatio = 0;
973
997
  this._fixedRatioMasterIsWidth = true;
974
998
  /**
975
999
  * Array of animations
@@ -1478,12 +1502,12 @@ export class Control {
1478
1502
  else {
1479
1503
  this._currentMeasure.height *= this._height.getValue(this._host);
1480
1504
  }
1481
- if (this.fixedRatio !== 0) {
1505
+ if (this._fixedRatio !== 0) {
1482
1506
  if (this._fixedRatioMasterIsWidth) {
1483
- this._currentMeasure.height = this._currentMeasure.width * this.fixedRatio;
1507
+ this._currentMeasure.height = this._currentMeasure.width * this._fixedRatio;
1484
1508
  }
1485
1509
  else {
1486
- this._currentMeasure.width = this._currentMeasure.height * this.fixedRatio;
1510
+ this._currentMeasure.width = this._currentMeasure.height * this._fixedRatio;
1487
1511
  }
1488
1512
  }
1489
1513
  }
@@ -1921,7 +1945,7 @@ export class Control {
1921
1945
  * @internal
1922
1946
  */
1923
1947
  _parseFromContent(serializedObject, host) {
1924
- var _a;
1948
+ var _a, _b;
1925
1949
  if (serializedObject.fontFamily) {
1926
1950
  this.fontFamily = serializedObject.fontFamily;
1927
1951
  }
@@ -1956,6 +1980,7 @@ export class Control {
1956
1980
  .beginAnimation(this, serializedObject.autoAnimateFrom, serializedObject.autoAnimateTo, serializedObject.autoAnimateLoop, serializedObject.autoAnimateSpeed || 1.0);
1957
1981
  }
1958
1982
  }
1983
+ this.fixedRatioMasterIsWidth = (_b = serializedObject.fixedRatioMasterIsWidth) !== null && _b !== void 0 ? _b : this.fixedRatioMasterIsWidth;
1959
1984
  }
1960
1985
  /** Releases associated resources */
1961
1986
  dispose() {
@@ -2139,7 +2164,10 @@ __decorate([
2139
2164
  ], Control.prototype, "verticalAlignment", null);
2140
2165
  __decorate([
2141
2166
  serialize()
2142
- ], Control.prototype, "fixedRatio", void 0);
2167
+ ], Control.prototype, "fixedRatio", null);
2168
+ __decorate([
2169
+ serialize()
2170
+ ], Control.prototype, "fixedRatioMasterIsWidth", null);
2143
2171
  __decorate([
2144
2172
  serialize()
2145
2173
  ], Control.prototype, "width", null);