babylonjs-gui 5.43.1 → 5.43.2

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.js CHANGED
@@ -2092,6 +2092,14 @@ var Button = /** @class */ (function (_super) {
2092
2092
  }
2093
2093
  return true;
2094
2094
  };
2095
+ Button.prototype._getRectangleFill = function (context) {
2096
+ if (this.isEnabled) {
2097
+ return this._getBackgroundColor(context);
2098
+ }
2099
+ else {
2100
+ return this._disabledColor;
2101
+ }
2102
+ };
2095
2103
  /**
2096
2104
  * @internal
2097
2105
  */
@@ -3869,7 +3877,7 @@ __webpack_require__.r(__webpack_exports__);
3869
3877
  /* harmony export */ "Container": () => (/* binding */ Container)
3870
3878
  /* harmony export */ });
3871
3879
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
3872
- /* harmony import */ var core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/observable */ "core/Misc/observable");
3880
+ /* harmony import */ var core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! core/Misc/tools */ "core/Misc/observable");
3873
3881
  /* harmony import */ var core_Misc_logger__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__);
3874
3882
  /* harmony import */ var _control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./control */ "../../../lts/gui/dist/2D/controls/control.js");
3875
3883
  /* harmony import */ var _measure__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../measure */ "../../../lts/gui/dist/2D/measure.js");
@@ -3883,6 +3891,7 @@ __webpack_require__.r(__webpack_exports__);
3883
3891
 
3884
3892
 
3885
3893
 
3894
+
3886
3895
  /**
3887
3896
  * Root class for 2D containers
3888
3897
  * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#containers
@@ -3903,6 +3912,8 @@ var Container = /** @class */ (function (_super) {
3903
3912
  /** @internal */
3904
3913
  _this._background = "";
3905
3914
  /** @internal */
3915
+ _this._backgroundGradient = null;
3916
+ /** @internal */
3906
3917
  _this._adaptWidthToChildren = false;
3907
3918
  /** @internal */
3908
3919
  _this._adaptHeightToChildren = false;
@@ -3994,6 +4005,21 @@ var Container = /** @class */ (function (_super) {
3994
4005
  enumerable: false,
3995
4006
  configurable: true
3996
4007
  });
4008
+ Object.defineProperty(Container.prototype, "backgroundGradient", {
4009
+ /** Gets or sets background gradient color. Takes precedence over background */
4010
+ get: function () {
4011
+ return this._backgroundGradient;
4012
+ },
4013
+ set: function (value) {
4014
+ if (this._backgroundGradient === value) {
4015
+ return;
4016
+ }
4017
+ this._backgroundGradient = value;
4018
+ this._markAsDirty();
4019
+ },
4020
+ enumerable: false,
4021
+ configurable: true
4022
+ });
3997
4023
  Object.defineProperty(Container.prototype, "children", {
3998
4024
  /** Gets the list of children */
3999
4025
  get: function () {
@@ -4164,11 +4190,14 @@ var Container = /** @class */ (function (_super) {
4164
4190
  this._children[index]._markAllAsDirty();
4165
4191
  }
4166
4192
  };
4193
+ Container.prototype._getBackgroundColor = function (context) {
4194
+ return this._backgroundGradient ? this._backgroundGradient.getCanvasGradient(context) : this._background;
4195
+ };
4167
4196
  /**
4168
4197
  * @internal
4169
4198
  */
4170
4199
  Container.prototype._localDraw = function (context) {
4171
- if (this._background) {
4200
+ if (this._background || this._backgroundGradient) {
4172
4201
  context.save();
4173
4202
  if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
4174
4203
  context.shadowColor = this.shadowColor;
@@ -4176,7 +4205,7 @@ var Container = /** @class */ (function (_super) {
4176
4205
  context.shadowOffsetX = this.shadowOffsetX;
4177
4206
  context.shadowOffsetY = this.shadowOffsetY;
4178
4207
  }
4179
- context.fillStyle = this._background;
4208
+ context.fillStyle = this._getBackgroundColor(context);
4180
4209
  context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
4181
4210
  context.restore();
4182
4211
  }
@@ -4387,6 +4416,10 @@ var Container = /** @class */ (function (_super) {
4387
4416
  */
4388
4417
  Container.prototype.serialize = function (serializationObject) {
4389
4418
  _super.prototype.serialize.call(this, serializationObject);
4419
+ if (this.backgroundGradient) {
4420
+ serializationObject.backgroundGradient = {};
4421
+ this.backgroundGradient.serialize(serializationObject.backgroundGradient);
4422
+ }
4390
4423
  if (!this.children.length) {
4391
4424
  return;
4392
4425
  }
@@ -4411,13 +4444,20 @@ var Container = /** @class */ (function (_super) {
4411
4444
  * @internal
4412
4445
  */
4413
4446
  Container.prototype._parseFromContent = function (serializedObject, host) {
4447
+ var _a;
4414
4448
  _super.prototype._parseFromContent.call(this, serializedObject, host);
4415
4449
  this._link(host);
4450
+ // Gradient
4451
+ if (serializedObject.backgroundGradient) {
4452
+ var className = core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__.Tools.Instantiate("BABYLON.GUI." + serializedObject.backgroundGradient.className);
4453
+ this._backgroundGradient = new className();
4454
+ (_a = this._backgroundGradient) === null || _a === void 0 ? void 0 : _a.parse(serializedObject.backgroundGradient);
4455
+ }
4416
4456
  if (!serializedObject.children) {
4417
4457
  return;
4418
4458
  }
4419
- for (var _i = 0, _a = serializedObject.children; _i < _a.length; _i++) {
4420
- var childData = _a[_i];
4459
+ for (var _i = 0, _b = serializedObject.children; _i < _b.length; _i++) {
4460
+ var childData = _b[_i];
4421
4461
  this.addControl(_control__WEBPACK_IMPORTED_MODULE_2__.Control.Parse(childData, host));
4422
4462
  }
4423
4463
  };
@@ -4436,6 +4476,9 @@ var Container = /** @class */ (function (_super) {
4436
4476
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
4437
4477
  (0,core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__.serialize)()
4438
4478
  ], Container.prototype, "background", null);
4479
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
4480
+ (0,core_Misc_logger__WEBPACK_IMPORTED_MODULE_1__.serialize)()
4481
+ ], Container.prototype, "backgroundGradient", null);
4439
4482
  return Container;
4440
4483
  }(_control__WEBPACK_IMPORTED_MODULE_2__.Control));
4441
4484
 
@@ -4554,6 +4597,7 @@ var Control = /** @class */ (function () {
4554
4597
  this._disabledColor = "#9a9a9a";
4555
4598
  this._disabledColorItem = "#6a6a6a";
4556
4599
  this._isReadOnly = false;
4600
+ this._gradient = null;
4557
4601
  /** @internal */
4558
4602
  this._rebuildLayout = false;
4559
4603
  /** @internal */
@@ -5203,6 +5247,21 @@ var Control = /** @class */ (function () {
5203
5247
  enumerable: false,
5204
5248
  configurable: true
5205
5249
  });
5250
+ Object.defineProperty(Control.prototype, "gradient", {
5251
+ /** Gets or sets gradient. Setting a gradient will override the color */
5252
+ get: function () {
5253
+ return this._gradient;
5254
+ },
5255
+ set: function (value) {
5256
+ if (this._gradient === value) {
5257
+ return;
5258
+ }
5259
+ this._gradient = value;
5260
+ this._markAsDirty();
5261
+ },
5262
+ enumerable: false,
5263
+ configurable: true
5264
+ });
5206
5265
  Object.defineProperty(Control.prototype, "zIndex", {
5207
5266
  /** Gets or sets z index which is used to reorder controls on the z axis */
5208
5267
  get: function () {
@@ -6046,6 +6105,9 @@ var Control = /** @class */ (function () {
6046
6105
  Control.prototype._renderHighlightSpecific = function (context) {
6047
6106
  context.strokeRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
6048
6107
  };
6108
+ Control.prototype._getColor = function (context) {
6109
+ return this.gradient ? this.gradient.getCanvasGradient(context) : this.color;
6110
+ };
6049
6111
  /**
6050
6112
  * @internal
6051
6113
  */
@@ -6063,8 +6125,8 @@ var Control = /** @class */ (function () {
6063
6125
  if (this._font) {
6064
6126
  context.font = this._font;
6065
6127
  }
6066
- if (this._color) {
6067
- context.fillStyle = this._color;
6128
+ if (this._color || this.gradient) {
6129
+ context.fillStyle = this._getColor(context);
6068
6130
  }
6069
6131
  if (Control.AllowAlphaInheritance) {
6070
6132
  context.globalAlpha *= this._alpha;
@@ -6604,6 +6666,10 @@ var Control = /** @class */ (function () {
6604
6666
  serializationObject.fontWeight = this.fontWeight;
6605
6667
  serializationObject.fontStyle = this.fontStyle;
6606
6668
  }
6669
+ if (this._gradient) {
6670
+ serializationObject.gradient = {};
6671
+ this._gradient.serialize(serializationObject.gradient);
6672
+ }
6607
6673
  // Animations
6608
6674
  core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.SerializationHelper.AppendSerializedAnimations(this, serializationObject);
6609
6675
  };
@@ -6611,6 +6677,7 @@ var Control = /** @class */ (function () {
6611
6677
  * @internal
6612
6678
  */
6613
6679
  Control.prototype._parseFromContent = function (serializedObject, host) {
6680
+ var _a;
6614
6681
  if (serializedObject.fontFamily) {
6615
6682
  this.fontFamily = serializedObject.fontFamily;
6616
6683
  }
@@ -6623,6 +6690,12 @@ var Control = /** @class */ (function () {
6623
6690
  if (serializedObject.fontStyle) {
6624
6691
  this.fontStyle = serializedObject.fontStyle;
6625
6692
  }
6693
+ // Gradient
6694
+ if (serializedObject.gradient) {
6695
+ var className = core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Tools.Instantiate("BABYLON.GUI." + serializedObject.gradient.className);
6696
+ this._gradient = new className();
6697
+ (_a = this._gradient) === null || _a === void 0 ? void 0 : _a.parse(serializedObject.gradient);
6698
+ }
6626
6699
  // Animations
6627
6700
  if (serializedObject.animations) {
6628
6701
  this.animations = [];
@@ -6850,6 +6923,9 @@ var Control = /** @class */ (function () {
6850
6923
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
6851
6924
  (0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.serialize)()
6852
6925
  ], Control.prototype, "color", null);
6926
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
6927
+ (0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.serialize)()
6928
+ ], Control.prototype, "gradient", null);
6853
6929
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
6854
6930
  (0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.serialize)()
6855
6931
  ], Control.prototype, "zIndex", null);
@@ -7232,8 +7308,8 @@ var Ellipse = /** @class */ (function (_super) {
7232
7308
  context.shadowOffsetY = this.shadowOffsetY;
7233
7309
  }
7234
7310
  _control__WEBPACK_IMPORTED_MODULE_2__.Control.drawEllipse(this._currentMeasure.left + this._currentMeasure.width / 2, this._currentMeasure.top + this._currentMeasure.height / 2, this._currentMeasure.width / 2 - this._thickness / 2, this._currentMeasure.height / 2 - this._thickness / 2, context);
7235
- if (this._background) {
7236
- context.fillStyle = this._background;
7311
+ if (this._backgroundGradient || this._background) {
7312
+ context.fillStyle = this._getBackgroundColor(context);
7237
7313
  context.fill();
7238
7314
  }
7239
7315
  if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
@@ -7398,6 +7474,344 @@ __webpack_require__.r(__webpack_exports__);
7398
7474
 
7399
7475
 
7400
7476
 
7477
+ /***/ }),
7478
+
7479
+ /***/ "../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js":
7480
+ /*!******************************************************************!*\
7481
+ !*** ../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js ***!
7482
+ \******************************************************************/
7483
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7484
+
7485
+ __webpack_require__.r(__webpack_exports__);
7486
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7487
+ /* harmony export */ "BaseGradient": () => (/* binding */ BaseGradient)
7488
+ /* harmony export */ });
7489
+ /*
7490
+ * Base Gradient class. Should not be used directly.
7491
+ */
7492
+ /**
7493
+ * Class that serves as a base for all the gradients created from context.
7494
+ */
7495
+ var BaseGradient = /** @class */ (function () {
7496
+ function BaseGradient() {
7497
+ this._colorStops = [];
7498
+ this._gradientDirty = true;
7499
+ }
7500
+ BaseGradient.prototype._addColorStopsToCanvasGradient = function () {
7501
+ for (var _i = 0, _a = this._colorStops; _i < _a.length; _i++) {
7502
+ var stop_1 = _a[_i];
7503
+ this._canvasGradient.addColorStop(stop_1.offset, stop_1.color);
7504
+ }
7505
+ };
7506
+ /**
7507
+ * If there are any changes or the context changed, regenerate the canvas gradient object. Else,
7508
+ * reuse the existing gradient.
7509
+ **/
7510
+ BaseGradient.prototype.getCanvasGradient = function (context) {
7511
+ if (this._gradientDirty || this._context !== context) {
7512
+ this._context = context;
7513
+ this._canvasGradient = this._createCanvasGradient(context);
7514
+ this._addColorStopsToCanvasGradient();
7515
+ this._gradientDirty = false;
7516
+ }
7517
+ return this._canvasGradient;
7518
+ };
7519
+ /**
7520
+ * Adds a new color stop to the gradient.
7521
+ * @param offset the offset of the stop on the gradient. Should be between 0 and 1
7522
+ * @param color the color of the stop
7523
+ */
7524
+ BaseGradient.prototype.addColorStop = function (offset, color) {
7525
+ this._colorStops.push({ offset: offset, color: color });
7526
+ this._gradientDirty = true;
7527
+ };
7528
+ /**
7529
+ * Removes an existing color stop with the specified offset from the gradient
7530
+ * @param offset the offset of the stop to be removed
7531
+ */
7532
+ BaseGradient.prototype.removeColorStop = function (offset) {
7533
+ this._colorStops = this._colorStops.filter(function (colorStop) { return colorStop.offset !== offset; });
7534
+ this._gradientDirty = true;
7535
+ };
7536
+ /**
7537
+ * Removes all color stops from the gradient
7538
+ */
7539
+ BaseGradient.prototype.clearColorStops = function () {
7540
+ this._colorStops = [];
7541
+ this._gradientDirty = true;
7542
+ };
7543
+ Object.defineProperty(BaseGradient.prototype, "colorStops", {
7544
+ /** Color stops of the gradient */
7545
+ get: function () {
7546
+ return this._colorStops;
7547
+ },
7548
+ enumerable: false,
7549
+ configurable: true
7550
+ });
7551
+ /** Type of the gradient */
7552
+ BaseGradient.prototype.getClassName = function () {
7553
+ return "BaseGradient";
7554
+ };
7555
+ /** Serialize into a json object */
7556
+ BaseGradient.prototype.serialize = function (serializationObject) {
7557
+ serializationObject.colorStops = this._colorStops;
7558
+ serializationObject.className = this.getClassName();
7559
+ };
7560
+ /** Parse from json object */
7561
+ BaseGradient.prototype.parse = function (serializationObject) {
7562
+ this._colorStops = serializationObject.colorStops;
7563
+ };
7564
+ return BaseGradient;
7565
+ }());
7566
+
7567
+
7568
+
7569
+ /***/ }),
7570
+
7571
+ /***/ "../../../lts/gui/dist/2D/controls/gradient/LinearGradient.js":
7572
+ /*!********************************************************************!*\
7573
+ !*** ../../../lts/gui/dist/2D/controls/gradient/LinearGradient.js ***!
7574
+ \********************************************************************/
7575
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7576
+
7577
+ __webpack_require__.r(__webpack_exports__);
7578
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7579
+ /* harmony export */ "LinearGradient": () => (/* binding */ LinearGradient)
7580
+ /* harmony export */ });
7581
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
7582
+ /* harmony import */ var _BaseGradient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BaseGradient */ "../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js");
7583
+ /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core/Misc/typeStore */ "core/Misc/observable");
7584
+ /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__);
7585
+
7586
+
7587
+
7588
+ /**
7589
+ * Gradient along a line that connects two coordinates.
7590
+ * These coordinates are relative to the canvas' space, not to any control's space.
7591
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createLinearGradient
7592
+ */
7593
+ var LinearGradient = /** @class */ (function (_super) {
7594
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(LinearGradient, _super);
7595
+ /**
7596
+ * Creates a new linear gradient
7597
+ * @param x0
7598
+ * @param y0
7599
+ * @param x1
7600
+ * @param y1
7601
+ */
7602
+ function LinearGradient(x0, y0, x1, y1) {
7603
+ var _this = _super.call(this) || this;
7604
+ _this._x0 = x0 !== null && x0 !== void 0 ? x0 : 0;
7605
+ _this._y0 = y0 !== null && y0 !== void 0 ? y0 : 0;
7606
+ _this._x1 = x1 !== null && x1 !== void 0 ? x1 : 0;
7607
+ _this._y1 = y1 !== null && y1 !== void 0 ? y1 : 0;
7608
+ return _this;
7609
+ }
7610
+ LinearGradient.prototype._createCanvasGradient = function (context) {
7611
+ return context.createLinearGradient(this._x0, this._y0, this._x1, this._y1);
7612
+ };
7613
+ Object.defineProperty(LinearGradient.prototype, "x0", {
7614
+ /** X axis coordinate of the starting point in the line */
7615
+ get: function () {
7616
+ return this._x0;
7617
+ },
7618
+ enumerable: false,
7619
+ configurable: true
7620
+ });
7621
+ Object.defineProperty(LinearGradient.prototype, "x1", {
7622
+ /** X axis coordinate of the ending point in the line */
7623
+ get: function () {
7624
+ return this._x1;
7625
+ },
7626
+ enumerable: false,
7627
+ configurable: true
7628
+ });
7629
+ Object.defineProperty(LinearGradient.prototype, "y0", {
7630
+ /** Y axis coordinate of the starting point in the line */
7631
+ get: function () {
7632
+ return this._y0;
7633
+ },
7634
+ enumerable: false,
7635
+ configurable: true
7636
+ });
7637
+ Object.defineProperty(LinearGradient.prototype, "y1", {
7638
+ /** Y axis coordinate of the ending point in the line */
7639
+ get: function () {
7640
+ return this._y1;
7641
+ },
7642
+ enumerable: false,
7643
+ configurable: true
7644
+ });
7645
+ /**
7646
+ * Class name of the gradient
7647
+ * @returns the class name of the gradient
7648
+ */
7649
+ LinearGradient.prototype.getClassName = function () {
7650
+ return "LinearGradient";
7651
+ };
7652
+ /**
7653
+ * Serializes this gradient
7654
+ * @param serializationObject the object to serialize to
7655
+ */
7656
+ LinearGradient.prototype.serialize = function (serializationObject) {
7657
+ _super.prototype.serialize.call(this, serializationObject);
7658
+ serializationObject.x0 = this._x0;
7659
+ serializationObject.y0 = this._y0;
7660
+ serializationObject.x1 = this._x1;
7661
+ serializationObject.y1 = this._y1;
7662
+ };
7663
+ /**
7664
+ * Parses a gradient from a serialization object
7665
+ * @param serializationObject the object to parse from
7666
+ */
7667
+ LinearGradient.prototype.parse = function (serializationObject) {
7668
+ _super.prototype.parse.call(this, serializationObject);
7669
+ this._x0 = serializationObject.x0;
7670
+ this._y0 = serializationObject.y0;
7671
+ this._x1 = serializationObject.x1;
7672
+ this._y1 = serializationObject.y1;
7673
+ };
7674
+ return LinearGradient;
7675
+ }(_BaseGradient__WEBPACK_IMPORTED_MODULE_1__.BaseGradient));
7676
+
7677
+ (0,core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__.RegisterClass)("BABYLON.GUI.LinearGradient", LinearGradient);
7678
+
7679
+
7680
+ /***/ }),
7681
+
7682
+ /***/ "../../../lts/gui/dist/2D/controls/gradient/RadialGradient.js":
7683
+ /*!********************************************************************!*\
7684
+ !*** ../../../lts/gui/dist/2D/controls/gradient/RadialGradient.js ***!
7685
+ \********************************************************************/
7686
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
7687
+
7688
+ __webpack_require__.r(__webpack_exports__);
7689
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
7690
+ /* harmony export */ "RadialGradient": () => (/* binding */ RadialGradient)
7691
+ /* harmony export */ });
7692
+ /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
7693
+ /* harmony import */ var _BaseGradient__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./BaseGradient */ "../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js");
7694
+ /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core/Misc/typeStore */ "core/Misc/observable");
7695
+ /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__);
7696
+
7697
+
7698
+
7699
+ /**
7700
+ * Gradient formed from two circles with their own centers and radius.
7701
+ * The coordinates of the circles centers are relative to the canvas' space, not to any control's space.
7702
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createRadialGradient
7703
+ */
7704
+ var RadialGradient = /** @class */ (function (_super) {
7705
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__extends)(RadialGradient, _super);
7706
+ /**
7707
+ * Creates a new radial gradient
7708
+ * @param x0 x coordinate of the first circle's center
7709
+ * @param y0 y coordinate of the first circle's center
7710
+ * @param r0 radius of the first circle
7711
+ * @param x1 x coordinate of the second circle's center
7712
+ * @param y1 y coordinate of the second circle's center
7713
+ * @param r1 radius of the second circle
7714
+ */
7715
+ function RadialGradient(x0, y0, r0, x1, y1, r1) {
7716
+ var _this = _super.call(this) || this;
7717
+ _this._x0 = x0 !== null && x0 !== void 0 ? x0 : 0;
7718
+ _this._y0 = y0 !== null && y0 !== void 0 ? y0 : 0;
7719
+ _this._r0 = r0 !== null && r0 !== void 0 ? r0 : 0;
7720
+ _this._x1 = x1 !== null && x1 !== void 0 ? x1 : 0;
7721
+ _this._y1 = y1 !== null && y1 !== void 0 ? y1 : 0;
7722
+ _this._r1 = r1 !== null && r1 !== void 0 ? r1 : 0;
7723
+ return _this;
7724
+ }
7725
+ RadialGradient.prototype._createCanvasGradient = function (context) {
7726
+ return context.createRadialGradient(this._x0, this._y0, this._r0, this._x1, this._y1, this._r1);
7727
+ };
7728
+ Object.defineProperty(RadialGradient.prototype, "x0", {
7729
+ /** x coordinate of the first circle's center */
7730
+ get: function () {
7731
+ return this._x0;
7732
+ },
7733
+ enumerable: false,
7734
+ configurable: true
7735
+ });
7736
+ Object.defineProperty(RadialGradient.prototype, "x1", {
7737
+ /** x coordinate of the second circle's center */
7738
+ get: function () {
7739
+ return this._x1;
7740
+ },
7741
+ enumerable: false,
7742
+ configurable: true
7743
+ });
7744
+ Object.defineProperty(RadialGradient.prototype, "y0", {
7745
+ /** y coordinate of the first circle's center */
7746
+ get: function () {
7747
+ return this._y0;
7748
+ },
7749
+ enumerable: false,
7750
+ configurable: true
7751
+ });
7752
+ Object.defineProperty(RadialGradient.prototype, "y1", {
7753
+ /** y coordinate of the second circle's center */
7754
+ get: function () {
7755
+ return this._y1;
7756
+ },
7757
+ enumerable: false,
7758
+ configurable: true
7759
+ });
7760
+ Object.defineProperty(RadialGradient.prototype, "r0", {
7761
+ /** radius of the first circle */
7762
+ get: function () {
7763
+ return this._r0;
7764
+ },
7765
+ enumerable: false,
7766
+ configurable: true
7767
+ });
7768
+ Object.defineProperty(RadialGradient.prototype, "r1", {
7769
+ /** radius of the second circle */
7770
+ get: function () {
7771
+ return this._r1;
7772
+ },
7773
+ enumerable: false,
7774
+ configurable: true
7775
+ });
7776
+ /**
7777
+ * Class name of the gradient
7778
+ * @returns the class name of the gradient
7779
+ */
7780
+ RadialGradient.prototype.getClassName = function () {
7781
+ return "RadialGradient";
7782
+ };
7783
+ /**
7784
+ * Serializes this gradient
7785
+ * @param serializationObject the object to serialize to
7786
+ */
7787
+ RadialGradient.prototype.serialize = function (serializationObject) {
7788
+ _super.prototype.serialize.call(this, serializationObject);
7789
+ serializationObject.x0 = this._x0;
7790
+ serializationObject.y0 = this._y0;
7791
+ serializationObject.r0 = this._r0;
7792
+ serializationObject.x1 = this._x1;
7793
+ serializationObject.y1 = this._y1;
7794
+ serializationObject.r1 = this._r1;
7795
+ };
7796
+ /**
7797
+ * Parses a gradient from a serialization object
7798
+ * @param serializationObject the object to parse from
7799
+ */
7800
+ RadialGradient.prototype.parse = function (serializationObject) {
7801
+ _super.prototype.parse.call(this, serializationObject);
7802
+ this._x0 = serializationObject.x0;
7803
+ this._y0 = serializationObject.y0;
7804
+ this._r0 = serializationObject.r0;
7805
+ this._x1 = serializationObject.x1;
7806
+ this._y1 = serializationObject.y1;
7807
+ this._r1 = serializationObject.r1;
7808
+ };
7809
+ return RadialGradient;
7810
+ }(_BaseGradient__WEBPACK_IMPORTED_MODULE_1__.BaseGradient));
7811
+
7812
+ (0,core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__.RegisterClass)("BABYLON.GUI.RadialGradient", RadialGradient);
7813
+
7814
+
7401
7815
  /***/ }),
7402
7816
 
7403
7817
  /***/ "../../../lts/gui/dist/2D/controls/grid.js":
@@ -8916,6 +9330,7 @@ var Image = /** @class */ (function (_super) {
8916
9330
 
8917
9331
  __webpack_require__.r(__webpack_exports__);
8918
9332
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
9333
+ /* harmony export */ "BaseGradient": () => (/* reexport safe */ _gradient_BaseGradient__WEBPACK_IMPORTED_MODULE_31__.BaseGradient),
8919
9334
  /* harmony export */ "BaseSlider": () => (/* reexport safe */ _sliders_baseSlider__WEBPACK_IMPORTED_MODULE_25__.BaseSlider),
8920
9335
  /* harmony export */ "Button": () => (/* reexport safe */ _button__WEBPACK_IMPORTED_MODULE_0__.Button),
8921
9336
  /* harmony export */ "Checkbox": () => (/* reexport safe */ _checkbox__WEBPACK_IMPORTED_MODULE_1__.Checkbox),
@@ -8935,7 +9350,9 @@ __webpack_require__.r(__webpack_exports__);
8935
9350
  /* harmony export */ "InputTextArea": () => (/* reexport safe */ _inputTextArea__WEBPACK_IMPORTED_MODULE_11__.InputTextArea),
8936
9351
  /* harmony export */ "KeyPropertySet": () => (/* reexport safe */ _virtualKeyboard__WEBPACK_IMPORTED_MODULE_22__.KeyPropertySet),
8937
9352
  /* harmony export */ "Line": () => (/* reexport safe */ _line__WEBPACK_IMPORTED_MODULE_13__.Line),
9353
+ /* harmony export */ "LinearGradient": () => (/* reexport safe */ _gradient_LinearGradient__WEBPACK_IMPORTED_MODULE_32__.LinearGradient),
8938
9354
  /* harmony export */ "MultiLine": () => (/* reexport safe */ _multiLine__WEBPACK_IMPORTED_MODULE_14__.MultiLine),
9355
+ /* harmony export */ "RadialGradient": () => (/* reexport safe */ _gradient_RadialGradient__WEBPACK_IMPORTED_MODULE_33__.RadialGradient),
8939
9356
  /* harmony export */ "RadioButton": () => (/* reexport safe */ _radioButton__WEBPACK_IMPORTED_MODULE_15__.RadioButton),
8940
9357
  /* harmony export */ "RadioGroup": () => (/* reexport safe */ _selector__WEBPACK_IMPORTED_MODULE_17__.RadioGroup),
8941
9358
  /* harmony export */ "Rectangle": () => (/* reexport safe */ _rectangle__WEBPACK_IMPORTED_MODULE_23__.Rectangle),
@@ -8984,6 +9401,12 @@ __webpack_require__.r(__webpack_exports__);
8984
9401
  /* harmony import */ var _sliders_scrollBar__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./sliders/scrollBar */ "../../../lts/gui/dist/2D/controls/sliders/scrollBar.js");
8985
9402
  /* harmony import */ var _sliders_imageScrollBar__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./sliders/imageScrollBar */ "../../../lts/gui/dist/2D/controls/sliders/imageScrollBar.js");
8986
9403
  /* harmony import */ var _statics__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./statics */ "../../../lts/gui/dist/2D/controls/statics.js");
9404
+ /* harmony import */ var _gradient_BaseGradient__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./gradient/BaseGradient */ "../../../lts/gui/dist/2D/controls/gradient/BaseGradient.js");
9405
+ /* harmony import */ var _gradient_LinearGradient__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./gradient/LinearGradient */ "../../../lts/gui/dist/2D/controls/gradient/LinearGradient.js");
9406
+ /* harmony import */ var _gradient_RadialGradient__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./gradient/RadialGradient */ "../../../lts/gui/dist/2D/controls/gradient/RadialGradient.js");
9407
+
9408
+
9409
+
8987
9410
 
8988
9411
 
8989
9412
 
@@ -11494,7 +11917,7 @@ var Line = /** @class */ (function (_super) {
11494
11917
  context.shadowOffsetY = this.shadowOffsetY;
11495
11918
  }
11496
11919
  this._applyStates(context);
11497
- context.strokeStyle = this.color;
11920
+ context.strokeStyle = this._getColor(context);
11498
11921
  context.lineWidth = this._lineWidth;
11499
11922
  context.setLineDash(this._dash);
11500
11923
  context.beginPath();
@@ -12171,6 +12594,9 @@ var Rectangle = /** @class */ (function (_super) {
12171
12594
  }
12172
12595
  return 0;
12173
12596
  };
12597
+ Rectangle.prototype._getRectangleFill = function (context) {
12598
+ return this._getBackgroundColor(context);
12599
+ };
12174
12600
  Rectangle.prototype._localDraw = function (context) {
12175
12601
  context.save();
12176
12602
  if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
@@ -12179,8 +12605,8 @@ var Rectangle = /** @class */ (function (_super) {
12179
12605
  context.shadowOffsetX = this.shadowOffsetX;
12180
12606
  context.shadowOffsetY = this.shadowOffsetY;
12181
12607
  }
12182
- if (this._background) {
12183
- context.fillStyle = this.typeName === "Button" ? (this.isEnabled ? this._background : this.disabledColor) : this._background;
12608
+ if (this._background || this._backgroundGradient) {
12609
+ context.fillStyle = this._getRectangleFill(context);
12184
12610
  if (this._cornerRadius) {
12185
12611
  this._drawRoundedRect(context, this._thickness / 2);
12186
12612
  context.fill();
@@ -12195,8 +12621,8 @@ var Rectangle = /** @class */ (function (_super) {
12195
12621
  context.shadowOffsetX = 0;
12196
12622
  context.shadowOffsetY = 0;
12197
12623
  }
12198
- if (this.color) {
12199
- context.strokeStyle = this.color;
12624
+ if (this.color || this.gradient) {
12625
+ context.strokeStyle = this.gradient ? this.gradient.getCanvasGradient(context) : this.color;
12200
12626
  }
12201
12627
  context.lineWidth = this._thickness;
12202
12628
  if (this._cornerRadius) {
@@ -14835,12 +15261,14 @@ __webpack_require__.r(__webpack_exports__);
14835
15261
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
14836
15262
  /* harmony import */ var _baseSlider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseSlider */ "../../../lts/gui/dist/2D/controls/sliders/baseSlider.js");
14837
15263
  /* harmony import */ var _measure__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../measure */ "../../../lts/gui/dist/2D/measure.js");
14838
- /* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core/Misc/decorators */ "core/Misc/observable");
15264
+ /* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! core/Misc/typeStore */ "core/Misc/observable");
14839
15265
  /* harmony import */ var core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__);
14840
15266
 
14841
15267
 
14842
15268
 
14843
15269
 
15270
+
15271
+
14844
15272
  /**
14845
15273
  * Class used to create slider controls
14846
15274
  */
@@ -14857,6 +15285,7 @@ var ScrollBar = /** @class */ (function (_super) {
14857
15285
  _this._borderColor = "white";
14858
15286
  _this._tempMeasure = new _measure__WEBPACK_IMPORTED_MODULE_2__.Measure(0, 0, 0, 0);
14859
15287
  _this._invertScrollDirection = false;
15288
+ _this._backgroundGradient = null;
14860
15289
  return _this;
14861
15290
  }
14862
15291
  Object.defineProperty(ScrollBar.prototype, "borderColor", {
@@ -14889,6 +15318,21 @@ var ScrollBar = /** @class */ (function (_super) {
14889
15318
  enumerable: false,
14890
15319
  configurable: true
14891
15320
  });
15321
+ Object.defineProperty(ScrollBar.prototype, "backgroundGradient", {
15322
+ /** Gets or sets background gradient. Takes precedence over gradient. */
15323
+ get: function () {
15324
+ return this._backgroundGradient;
15325
+ },
15326
+ set: function (value) {
15327
+ if (this._backgroundGradient === value) {
15328
+ return;
15329
+ }
15330
+ this._backgroundGradient = value;
15331
+ this._markAsDirty();
15332
+ },
15333
+ enumerable: false,
15334
+ configurable: true
15335
+ });
14892
15336
  Object.defineProperty(ScrollBar.prototype, "invertScrollDirection", {
14893
15337
  /** Inverts the scrolling direction (default: false) */
14894
15338
  get: function () {
@@ -14913,16 +15357,19 @@ var ScrollBar = /** @class */ (function (_super) {
14913
15357
  }
14914
15358
  return thumbThickness;
14915
15359
  };
15360
+ ScrollBar.prototype._getBackgroundColor = function (context) {
15361
+ return this._backgroundGradient ? this._backgroundGradient.getCanvasGradient(context) : this._background;
15362
+ };
14916
15363
  ScrollBar.prototype._draw = function (context) {
14917
15364
  context.save();
14918
15365
  this._applyStates(context);
14919
15366
  this._prepareRenderingData("rectangle");
14920
15367
  var left = this._renderLeft;
14921
15368
  var thumbPosition = this._getThumbPosition();
14922
- context.fillStyle = this._background;
15369
+ context.fillStyle = this._getBackgroundColor(context);
14923
15370
  context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
14924
15371
  // Value bar
14925
- context.fillStyle = this.color;
15372
+ context.fillStyle = this._getColor(context);
14926
15373
  // Thumb
14927
15374
  if (this.isVertical) {
14928
15375
  this._tempMeasure.left = left - this._effectiveBarOffset;
@@ -14982,6 +15429,21 @@ var ScrollBar = /** @class */ (function (_super) {
14982
15429
  this._first = true;
14983
15430
  return _super.prototype._onPointerDown.call(this, target, coordinates, pointerId, buttonIndex, pi);
14984
15431
  };
15432
+ ScrollBar.prototype.serialize = function (serializationObject) {
15433
+ _super.prototype.serialize.call(this, serializationObject);
15434
+ if (this.backgroundGradient) {
15435
+ serializationObject.backgroundGradient = {};
15436
+ this.backgroundGradient.serialize(serializationObject.backgroundGradient);
15437
+ }
15438
+ };
15439
+ ScrollBar.prototype._parseFromContent = function (serializationObject, host) {
15440
+ _super.prototype._parseFromContent.call(this, serializationObject, host);
15441
+ if (serializationObject.backgroundGradient) {
15442
+ var className = core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.Tools.Instantiate("BABYLON.GUI." + serializationObject.backgroundGradient.className);
15443
+ this.backgroundGradient = new className();
15444
+ this.backgroundGradient.parse(serializationObject.backgroundGradient);
15445
+ }
15446
+ };
14985
15447
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14986
15448
  (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14987
15449
  ], ScrollBar.prototype, "borderColor", null);
@@ -14994,6 +15456,7 @@ var ScrollBar = /** @class */ (function (_super) {
14994
15456
  return ScrollBar;
14995
15457
  }(_baseSlider__WEBPACK_IMPORTED_MODULE_1__.BaseSlider));
14996
15458
 
15459
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.RegisterClass)("BABYLON.GUI.Scrollbar", ScrollBar);
14997
15460
 
14998
15461
 
14999
15462
  /***/ }),
@@ -15010,12 +15473,13 @@ __webpack_require__.r(__webpack_exports__);
15010
15473
  /* harmony export */ });
15011
15474
  /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "../../../../node_modules/tslib/tslib.es6.js");
15012
15475
  /* harmony import */ var _baseSlider__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./baseSlider */ "../../../lts/gui/dist/2D/controls/sliders/baseSlider.js");
15013
- /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core/Misc/decorators */ "core/Misc/observable");
15476
+ /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! core/Misc/tools */ "core/Misc/observable");
15014
15477
  /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__);
15015
15478
 
15016
15479
 
15017
15480
 
15018
15481
 
15482
+
15019
15483
  /**
15020
15484
  * Class used to create slider controls
15021
15485
  */
@@ -15033,6 +15497,7 @@ var Slider = /** @class */ (function (_super) {
15033
15497
  _this._thumbColor = "";
15034
15498
  _this._isThumbCircle = false;
15035
15499
  _this._displayValueBar = true;
15500
+ _this._backgroundGradient = null;
15036
15501
  return _this;
15037
15502
  }
15038
15503
  Object.defineProperty(Slider.prototype, "displayValueBar", {
@@ -15080,6 +15545,21 @@ var Slider = /** @class */ (function (_super) {
15080
15545
  enumerable: false,
15081
15546
  configurable: true
15082
15547
  });
15548
+ Object.defineProperty(Slider.prototype, "backgroundGradient", {
15549
+ /** Gets or sets background gradient */
15550
+ get: function () {
15551
+ return this._backgroundGradient;
15552
+ },
15553
+ set: function (value) {
15554
+ if (this._backgroundGradient === value) {
15555
+ return;
15556
+ }
15557
+ this._backgroundGradient = value;
15558
+ this._markAsDirty();
15559
+ },
15560
+ enumerable: false,
15561
+ configurable: true
15562
+ });
15083
15563
  Object.defineProperty(Slider.prototype, "thumbColor", {
15084
15564
  /** Gets or sets thumb's color */
15085
15565
  get: function () {
@@ -15113,6 +15593,9 @@ var Slider = /** @class */ (function (_super) {
15113
15593
  Slider.prototype._getTypeName = function () {
15114
15594
  return "Slider";
15115
15595
  };
15596
+ Slider.prototype._getBackgroundColor = function (context) {
15597
+ return this._backgroundGradient ? this._backgroundGradient.getCanvasGradient(context) : this._background;
15598
+ };
15116
15599
  Slider.prototype._draw = function (context) {
15117
15600
  context.save();
15118
15601
  this._applyStates(context);
@@ -15141,7 +15624,7 @@ var Slider = /** @class */ (function (_super) {
15141
15624
  context.shadowOffsetY = this.shadowOffsetY;
15142
15625
  }
15143
15626
  var thumbPosition = this._getThumbPosition();
15144
- context.fillStyle = this._background;
15627
+ context.fillStyle = this._getBackgroundColor(context);
15145
15628
  if (this.isVertical) {
15146
15629
  if (this.isThumbClamped) {
15147
15630
  if (this.isThumbCircle) {
@@ -15180,7 +15663,7 @@ var Slider = /** @class */ (function (_super) {
15180
15663
  context.shadowOffsetY = 0;
15181
15664
  }
15182
15665
  // Value bar
15183
- context.fillStyle = this.color;
15666
+ context.fillStyle = this._getColor(context);
15184
15667
  if (this._displayValueBar) {
15185
15668
  if (this.isVertical) {
15186
15669
  if (this.isThumbClamped) {
@@ -15216,7 +15699,7 @@ var Slider = /** @class */ (function (_super) {
15216
15699
  }
15217
15700
  }
15218
15701
  // Thumb
15219
- context.fillStyle = this._thumbColor || this.color;
15702
+ context.fillStyle = this._thumbColor || this._getColor(context);
15220
15703
  if (this.displayThumb) {
15221
15704
  if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
15222
15705
  context.shadowColor = this.shadowColor;
@@ -15264,6 +15747,22 @@ var Slider = /** @class */ (function (_super) {
15264
15747
  }
15265
15748
  context.restore();
15266
15749
  };
15750
+ Slider.prototype.serialize = function (serializationObject) {
15751
+ _super.prototype.serialize.call(this, serializationObject);
15752
+ if (this.backgroundGradient) {
15753
+ serializationObject.backgroundGradient = {};
15754
+ this.backgroundGradient.serialize(serializationObject.backgroundGradient);
15755
+ }
15756
+ };
15757
+ /** @internal */
15758
+ Slider.prototype._parseFromContent = function (serializedObject, host) {
15759
+ _super.prototype._parseFromContent.call(this, serializedObject, host);
15760
+ if (serializedObject.backgroundGradient) {
15761
+ var className = core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__.Tools.Instantiate("BABYLON.GUI." + serializedObject.backgroundGradient.className);
15762
+ this.backgroundGradient = new className();
15763
+ this.backgroundGradient.parse(serializedObject.backgroundGradient);
15764
+ }
15765
+ };
15267
15766
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
15268
15767
  (0,core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_2__.serialize)()
15269
15768
  ], Slider.prototype, "displayValueBar", null);
@@ -15688,6 +16187,7 @@ var TextBlock = /** @class */ (function (_super) {
15688
16187
  _this._underline = false;
15689
16188
  _this._lineThrough = false;
15690
16189
  _this._wordDivider = " ";
16190
+ _this._forceResizeWidth = false;
15691
16191
  /**
15692
16192
  * An event triggered after the text is changed
15693
16193
  */
@@ -15933,6 +16433,25 @@ var TextBlock = /** @class */ (function (_super) {
15933
16433
  enumerable: false,
15934
16434
  configurable: true
15935
16435
  });
16436
+ Object.defineProperty(TextBlock.prototype, "forceResizeWidth", {
16437
+ /**
16438
+ * By default, if a text block has text wrapping other than Clip, its width
16439
+ * is not resized even if resizeToFit = true. This parameter forces the width
16440
+ * to be resized.
16441
+ */
16442
+ get: function () {
16443
+ return this._forceResizeWidth;
16444
+ },
16445
+ set: function (value) {
16446
+ if (this._forceResizeWidth === value) {
16447
+ return;
16448
+ }
16449
+ this._forceResizeWidth = value;
16450
+ this._markAsDirty();
16451
+ },
16452
+ enumerable: false,
16453
+ configurable: true
16454
+ });
15936
16455
  TextBlock.prototype._getTypeName = function () {
15937
16456
  return "TextBlock";
15938
16457
  };
@@ -15952,9 +16471,9 @@ var TextBlock = /** @class */ (function (_super) {
15952
16471
  }
15953
16472
  }
15954
16473
  if (this._resizeToFit) {
15955
- if (this._textWrapping === TextWrapping.Clip) {
15956
- var newWidth = (this._paddingLeftInPixels + this._paddingRightInPixels + maxLineWidth) | 0;
15957
- if (newWidth !== this._width.internalValue) {
16474
+ if (this._textWrapping === TextWrapping.Clip || this._forceResizeWidth) {
16475
+ var newWidth = Math.ceil(this._paddingLeftInPixels + this._paddingRightInPixels + maxLineWidth);
16476
+ if (newWidth !== this._width.getValueInPixel(this._host, this._tempParentMeasure.width)) {
15958
16477
  this._width.updateInPlace(newWidth, _valueAndUnit__WEBPACK_IMPORTED_MODULE_2__.ValueAndUnit.UNITMODE_PIXEL);
15959
16478
  this._rebuildLayout = true;
15960
16479
  }
@@ -16255,6 +16774,9 @@ var TextBlock = /** @class */ (function (_super) {
16255
16774
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
16256
16775
  (0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.serialize)()
16257
16776
  ], TextBlock.prototype, "wordDivider", null);
16777
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
16778
+ (0,core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.serialize)()
16779
+ ], TextBlock.prototype, "forceResizeWidth", null);
16258
16780
  return TextBlock;
16259
16781
  }(_control__WEBPACK_IMPORTED_MODULE_3__.Control));
16260
16782
 
@@ -16968,6 +17490,7 @@ __webpack_require__.r(__webpack_exports__);
16968
17490
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
16969
17491
  /* harmony export */ "AdvancedDynamicTexture": () => (/* reexport safe */ _advancedDynamicTexture__WEBPACK_IMPORTED_MODULE_1__.AdvancedDynamicTexture),
16970
17492
  /* harmony export */ "AdvancedDynamicTextureInstrumentation": () => (/* reexport safe */ _adtInstrumentation__WEBPACK_IMPORTED_MODULE_2__.AdvancedDynamicTextureInstrumentation),
17493
+ /* harmony export */ "BaseGradient": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.BaseGradient),
16971
17494
  /* harmony export */ "BaseSlider": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.BaseSlider),
16972
17495
  /* harmony export */ "Button": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.Button),
16973
17496
  /* harmony export */ "Checkbox": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.Checkbox),
@@ -16987,11 +17510,13 @@ __webpack_require__.r(__webpack_exports__);
16987
17510
  /* harmony export */ "InputTextArea": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.InputTextArea),
16988
17511
  /* harmony export */ "KeyPropertySet": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.KeyPropertySet),
16989
17512
  /* harmony export */ "Line": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.Line),
17513
+ /* harmony export */ "LinearGradient": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.LinearGradient),
16990
17514
  /* harmony export */ "MathTools": () => (/* reexport safe */ _math2D__WEBPACK_IMPORTED_MODULE_3__.MathTools),
16991
17515
  /* harmony export */ "Matrix2D": () => (/* reexport safe */ _math2D__WEBPACK_IMPORTED_MODULE_3__.Matrix2D),
16992
17516
  /* harmony export */ "Measure": () => (/* reexport safe */ _measure__WEBPACK_IMPORTED_MODULE_4__.Measure),
16993
17517
  /* harmony export */ "MultiLine": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.MultiLine),
16994
17518
  /* harmony export */ "MultiLinePoint": () => (/* reexport safe */ _multiLinePoint__WEBPACK_IMPORTED_MODULE_5__.MultiLinePoint),
17519
+ /* harmony export */ "RadialGradient": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.RadialGradient),
16995
17520
  /* harmony export */ "RadioButton": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.RadioButton),
16996
17521
  /* harmony export */ "RadioGroup": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.RadioGroup),
16997
17522
  /* harmony export */ "Rectangle": () => (/* reexport safe */ _controls_index__WEBPACK_IMPORTED_MODULE_0__.Rectangle),
@@ -29996,6 +30521,7 @@ __webpack_require__.r(__webpack_exports__);
29996
30521
  /* harmony export */ "AbstractButton3D": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.AbstractButton3D),
29997
30522
  /* harmony export */ "AdvancedDynamicTexture": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.AdvancedDynamicTexture),
29998
30523
  /* harmony export */ "AdvancedDynamicTextureInstrumentation": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.AdvancedDynamicTextureInstrumentation),
30524
+ /* harmony export */ "BaseGradient": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.BaseGradient),
29999
30525
  /* harmony export */ "BaseSlider": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.BaseSlider),
30000
30526
  /* harmony export */ "Button": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.Button),
30001
30527
  /* harmony export */ "Button3D": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.Button3D),
@@ -30032,6 +30558,7 @@ __webpack_require__.r(__webpack_exports__);
30032
30558
  /* harmony export */ "InputTextArea": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.InputTextArea),
30033
30559
  /* harmony export */ "KeyPropertySet": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.KeyPropertySet),
30034
30560
  /* harmony export */ "Line": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.Line),
30561
+ /* harmony export */ "LinearGradient": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.LinearGradient),
30035
30562
  /* harmony export */ "MRDLBackplateMaterial": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.MRDLBackplateMaterial),
30036
30563
  /* harmony export */ "MRDLSliderBarMaterial": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.MRDLSliderBarMaterial),
30037
30564
  /* harmony export */ "MRDLSliderThumbMaterial": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.MRDLSliderThumbMaterial),
@@ -30043,6 +30570,7 @@ __webpack_require__.r(__webpack_exports__);
30043
30570
  /* harmony export */ "MultiLinePoint": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.MultiLinePoint),
30044
30571
  /* harmony export */ "NearMenu": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.NearMenu),
30045
30572
  /* harmony export */ "PlanePanel": () => (/* reexport safe */ _3D_index__WEBPACK_IMPORTED_MODULE_1__.PlanePanel),
30573
+ /* harmony export */ "RadialGradient": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.RadialGradient),
30046
30574
  /* harmony export */ "RadioButton": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.RadioButton),
30047
30575
  /* harmony export */ "RadioGroup": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.RadioGroup),
30048
30576
  /* harmony export */ "Rectangle": () => (/* reexport safe */ _2D_index__WEBPACK_IMPORTED_MODULE_0__.Rectangle),
@@ -30097,6 +30625,7 @@ __webpack_require__.r(__webpack_exports__);
30097
30625
  /* harmony export */ "AbstractButton3D": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.AbstractButton3D),
30098
30626
  /* harmony export */ "AdvancedDynamicTexture": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.AdvancedDynamicTexture),
30099
30627
  /* harmony export */ "AdvancedDynamicTextureInstrumentation": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.AdvancedDynamicTextureInstrumentation),
30628
+ /* harmony export */ "BaseGradient": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.BaseGradient),
30100
30629
  /* harmony export */ "BaseSlider": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.BaseSlider),
30101
30630
  /* harmony export */ "Button": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.Button),
30102
30631
  /* harmony export */ "Button3D": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.Button3D),
@@ -30133,6 +30662,7 @@ __webpack_require__.r(__webpack_exports__);
30133
30662
  /* harmony export */ "InputTextArea": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.InputTextArea),
30134
30663
  /* harmony export */ "KeyPropertySet": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.KeyPropertySet),
30135
30664
  /* harmony export */ "Line": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.Line),
30665
+ /* harmony export */ "LinearGradient": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.LinearGradient),
30136
30666
  /* harmony export */ "MRDLBackplateMaterial": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MRDLBackplateMaterial),
30137
30667
  /* harmony export */ "MRDLSliderBarMaterial": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MRDLSliderBarMaterial),
30138
30668
  /* harmony export */ "MRDLSliderThumbMaterial": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MRDLSliderThumbMaterial),
@@ -30144,6 +30674,7 @@ __webpack_require__.r(__webpack_exports__);
30144
30674
  /* harmony export */ "MultiLinePoint": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.MultiLinePoint),
30145
30675
  /* harmony export */ "NearMenu": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.NearMenu),
30146
30676
  /* harmony export */ "PlanePanel": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.PlanePanel),
30677
+ /* harmony export */ "RadialGradient": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.RadialGradient),
30147
30678
  /* harmony export */ "RadioButton": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.RadioButton),
30148
30679
  /* harmony export */ "RadioGroup": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.RadioGroup),
30149
30680
  /* harmony export */ "Rectangle": () => (/* reexport safe */ _index__WEBPACK_IMPORTED_MODULE_0__.Rectangle),