babylonjs-gui 5.19.0 → 5.20.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
@@ -3519,8 +3519,12 @@ declare module BABYLON.GUI {
3519
3519
  private _thumbHeight;
3520
3520
  private _barImageHeight;
3521
3521
  private _tempMeasure;
3522
+ private _invertScrollDirection;
3522
3523
  /** Number of 90° rotation to apply on the images when in vertical mode */
3523
3524
  num90RotationInVerticalMode: number;
3525
+ /** Inverts the scrolling direction (default: false) */
3526
+ get invertScrollDirection(): boolean;
3527
+ set invertScrollDirection(invert: boolean);
3524
3528
  /**
3525
3529
  * Gets or sets the image used to render the background for horizontal bar
3526
3530
  */
@@ -3575,12 +3579,16 @@ declare module BABYLON.GUI {
3575
3579
  private _background;
3576
3580
  private _borderColor;
3577
3581
  private _tempMeasure;
3582
+ private _invertScrollDirection;
3578
3583
  /** Gets or sets border color */
3579
3584
  get borderColor(): string;
3580
3585
  set borderColor(value: string);
3581
3586
  /** Gets or sets background color */
3582
3587
  get background(): string;
3583
3588
  set background(value: string);
3589
+ /** Inverts the scrolling direction (default: false) */
3590
+ get invertScrollDirection(): boolean;
3591
+ set invertScrollDirection(invert: boolean);
3584
3592
  /**
3585
3593
  * Creates a new Slider
3586
3594
  * @param name defines the control name
package/babylon.gui.js CHANGED
@@ -12100,17 +12100,17 @@ var Rectangle = /** @class */ (function (_super) {
12100
12100
  var y = this._currentMeasure.top + offset;
12101
12101
  var width = this._currentMeasure.width - offset * 2;
12102
12102
  var height = this._currentMeasure.height - offset * 2;
12103
- var radius = Math.min(height / 2 - 2, Math.min(width / 2 - 2, this._cornerRadius));
12103
+ var radius = Math.min(height / 2, Math.min(width / 2, this._cornerRadius));
12104
12104
  context.beginPath();
12105
12105
  context.moveTo(x + radius, y);
12106
12106
  context.lineTo(x + width - radius, y);
12107
- context.quadraticCurveTo(x + width, y, x + width, y + radius);
12107
+ context.arc(x + width - radius, y + radius, radius, (3 * Math.PI) / 2, Math.PI * 2);
12108
12108
  context.lineTo(x + width, y + height - radius);
12109
- context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
12109
+ context.arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
12110
12110
  context.lineTo(x + radius, y + height);
12111
- context.quadraticCurveTo(x, y + height, x, y + height - radius);
12111
+ context.arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
12112
12112
  context.lineTo(x, y + radius);
12113
- context.quadraticCurveTo(x, y, x + radius, y);
12113
+ context.arc(x + radius, y + radius, radius, Math.PI, (3 * Math.PI) / 2);
12114
12114
  context.closePath();
12115
12115
  };
12116
12116
  Rectangle.prototype._clipForChildren = function (context) {
@@ -14478,10 +14478,22 @@ var ImageScrollBar = /** @class */ (function (_super) {
14478
14478
  _this._thumbHeight = 1;
14479
14479
  _this._barImageHeight = 1;
14480
14480
  _this._tempMeasure = new _measure__WEBPACK_IMPORTED_MODULE_2__.Measure(0, 0, 0, 0);
14481
+ _this._invertScrollDirection = false;
14481
14482
  /** Number of 90° rotation to apply on the images when in vertical mode */
14482
14483
  _this.num90RotationInVerticalMode = 1;
14483
14484
  return _this;
14484
14485
  }
14486
+ Object.defineProperty(ImageScrollBar.prototype, "invertScrollDirection", {
14487
+ /** Inverts the scrolling direction (default: false) */
14488
+ get: function () {
14489
+ return this._invertScrollDirection;
14490
+ },
14491
+ set: function (invert) {
14492
+ this._invertScrollDirection = invert;
14493
+ },
14494
+ enumerable: false,
14495
+ configurable: true
14496
+ });
14485
14497
  Object.defineProperty(ImageScrollBar.prototype, "backgroundImage", {
14486
14498
  /**
14487
14499
  * Gets or sets the image used to render the background for horizontal bar
@@ -14682,6 +14694,7 @@ var ImageScrollBar = /** @class */ (function (_super) {
14682
14694
  x = this._transformedPosition.x;
14683
14695
  y = this._transformedPosition.y;
14684
14696
  }
14697
+ var sign = this._invertScrollDirection ? -1 : 1;
14685
14698
  if (this._first) {
14686
14699
  this._first = false;
14687
14700
  this._originX = x;
@@ -14707,7 +14720,7 @@ var ImageScrollBar = /** @class */ (function (_super) {
14707
14720
  else {
14708
14721
  delta = (x - this._originX) / (this._currentMeasure.width - this._effectiveThumbThickness);
14709
14722
  }
14710
- this.value += delta * (this.maximum - this.minimum);
14723
+ this.value += sign * delta * (this.maximum - this.minimum);
14711
14724
  this._originX = x;
14712
14725
  this._originY = y;
14713
14726
  };
@@ -14718,6 +14731,9 @@ var ImageScrollBar = /** @class */ (function (_super) {
14718
14731
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14719
14732
  (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14720
14733
  ], ImageScrollBar.prototype, "num90RotationInVerticalMode", void 0);
14734
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14735
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14736
+ ], ImageScrollBar.prototype, "invertScrollDirection", null);
14721
14737
  return ImageScrollBar;
14722
14738
  }(_baseSlider__WEBPACK_IMPORTED_MODULE_1__.BaseSlider));
14723
14739
 
@@ -14759,6 +14775,7 @@ var ScrollBar = /** @class */ (function (_super) {
14759
14775
  _this._background = "black";
14760
14776
  _this._borderColor = "white";
14761
14777
  _this._tempMeasure = new _measure__WEBPACK_IMPORTED_MODULE_2__.Measure(0, 0, 0, 0);
14778
+ _this._invertScrollDirection = false;
14762
14779
  return _this;
14763
14780
  }
14764
14781
  Object.defineProperty(ScrollBar.prototype, "borderColor", {
@@ -14791,6 +14808,17 @@ var ScrollBar = /** @class */ (function (_super) {
14791
14808
  enumerable: false,
14792
14809
  configurable: true
14793
14810
  });
14811
+ Object.defineProperty(ScrollBar.prototype, "invertScrollDirection", {
14812
+ /** Inverts the scrolling direction (default: false) */
14813
+ get: function () {
14814
+ return this._invertScrollDirection;
14815
+ },
14816
+ set: function (invert) {
14817
+ this._invertScrollDirection = invert;
14818
+ },
14819
+ enumerable: false,
14820
+ configurable: true
14821
+ });
14794
14822
  ScrollBar.prototype._getTypeName = function () {
14795
14823
  return "Scrollbar";
14796
14824
  };
@@ -14841,6 +14869,7 @@ var ScrollBar = /** @class */ (function (_super) {
14841
14869
  x = this._transformedPosition.x;
14842
14870
  y = this._transformedPosition.y;
14843
14871
  }
14872
+ var sign = this._invertScrollDirection ? -1 : 1;
14844
14873
  if (this._first) {
14845
14874
  this._first = false;
14846
14875
  this._originX = x;
@@ -14866,7 +14895,7 @@ var ScrollBar = /** @class */ (function (_super) {
14866
14895
  else {
14867
14896
  delta = (x - this._originX) / (this._currentMeasure.width - this._effectiveThumbThickness);
14868
14897
  }
14869
- this.value += delta * (this.maximum - this.minimum);
14898
+ this.value += sign * delta * (this.maximum - this.minimum);
14870
14899
  this._originX = x;
14871
14900
  this._originY = y;
14872
14901
  };
@@ -14880,6 +14909,9 @@ var ScrollBar = /** @class */ (function (_super) {
14880
14909
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14881
14910
  (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14882
14911
  ], ScrollBar.prototype, "background", null);
14912
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14913
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14914
+ ], ScrollBar.prototype, "invertScrollDirection", null);
14883
14915
  return ScrollBar;
14884
14916
  }(_baseSlider__WEBPACK_IMPORTED_MODULE_1__.BaseSlider));
14885
14917