babylonjs-gui 5.18.0 → 5.21.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
@@ -107,6 +107,8 @@ declare module BABYLON.GUI {
107
107
  private _cursorChanged;
108
108
  private _defaultMousePointerId;
109
109
  /** @hidden */
110
+ _capturedPointerIds: Set<number>;
111
+ /** @hidden */
110
112
  _numLayoutCalls: number;
111
113
  /** Gets the number of layout calls made the last time the ADT has been rendered */
112
114
  get numLayoutCalls(): number;
@@ -3519,8 +3521,12 @@ declare module BABYLON.GUI {
3519
3521
  private _thumbHeight;
3520
3522
  private _barImageHeight;
3521
3523
  private _tempMeasure;
3524
+ private _invertScrollDirection;
3522
3525
  /** Number of 90° rotation to apply on the images when in vertical mode */
3523
3526
  num90RotationInVerticalMode: number;
3527
+ /** Inverts the scrolling direction (default: false) */
3528
+ get invertScrollDirection(): boolean;
3529
+ set invertScrollDirection(invert: boolean);
3524
3530
  /**
3525
3531
  * Gets or sets the image used to render the background for horizontal bar
3526
3532
  */
@@ -3575,12 +3581,16 @@ declare module BABYLON.GUI {
3575
3581
  private _background;
3576
3582
  private _borderColor;
3577
3583
  private _tempMeasure;
3584
+ private _invertScrollDirection;
3578
3585
  /** Gets or sets border color */
3579
3586
  get borderColor(): string;
3580
3587
  set borderColor(value: string);
3581
3588
  /** Gets or sets background color */
3582
3589
  get background(): string;
3583
3590
  set background(value: string);
3591
+ /** Inverts the scrolling direction (default: false) */
3592
+ get invertScrollDirection(): boolean;
3593
+ set invertScrollDirection(invert: boolean);
3584
3594
  /**
3585
3595
  * Creates a new Slider
3586
3596
  * @param name defines the control name
package/babylon.gui.js CHANGED
@@ -522,6 +522,8 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
522
522
  _this._cursorChanged = false;
523
523
  _this._defaultMousePointerId = 0;
524
524
  /** @hidden */
525
+ _this._capturedPointerIds = new Set();
526
+ /** @hidden */
525
527
  _this._numLayoutCalls = 0;
526
528
  /** @hidden */
527
529
  _this._numRenderCalls = 0;
@@ -1379,6 +1381,11 @@ var AdvancedDynamicTexture = /** @class */ (function (_super) {
1379
1381
  }
1380
1382
  var tempViewport = new core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.Viewport(0, 0, 0, 0);
1381
1383
  this._prePointerObserver = scene.onPrePointerObservable.add(function (pi) {
1384
+ if (scene.isPointerCaptured(pi.event.pointerId) &&
1385
+ pi.type === core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERUP &&
1386
+ !_this._capturedPointerIds.has(pi.event.pointerId)) {
1387
+ return;
1388
+ }
1382
1389
  if (pi.type !== core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERMOVE &&
1383
1390
  pi.type !== core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERUP &&
1384
1391
  pi.type !== core_Misc_observable__WEBPACK_IMPORTED_MODULE_1__.PointerEventTypes.POINTERDOWN &&
@@ -6394,6 +6401,9 @@ var Control = /** @class */ (function () {
6394
6401
  if (canNotify && this.parent != null && !this.isPointerBlocker) {
6395
6402
  this.parent._onPointerDown(target, coordinates, pointerId, buttonIndex, pi);
6396
6403
  }
6404
+ if (pi && this.uniqueId !== this._host.rootContainer.uniqueId) {
6405
+ this._host._capturedPointerIds.add(pi.event.pointerId);
6406
+ }
6397
6407
  return true;
6398
6408
  };
6399
6409
  /**
@@ -6419,6 +6429,9 @@ var Control = /** @class */ (function () {
6419
6429
  if (canNotify && this.parent != null && !this.isPointerBlocker) {
6420
6430
  this.parent._onPointerUp(target, coordinates, pointerId, buttonIndex, canNotifyClick, pi);
6421
6431
  }
6432
+ if (pi && this.uniqueId !== this._host.rootContainer.uniqueId) {
6433
+ this._host._capturedPointerIds.delete(pi.event.pointerId);
6434
+ }
6422
6435
  };
6423
6436
  /**
6424
6437
  * @param pointerId
@@ -12100,17 +12113,17 @@ var Rectangle = /** @class */ (function (_super) {
12100
12113
  var y = this._currentMeasure.top + offset;
12101
12114
  var width = this._currentMeasure.width - offset * 2;
12102
12115
  var height = this._currentMeasure.height - offset * 2;
12103
- var radius = Math.min(height / 2 - 2, Math.min(width / 2 - 2, this._cornerRadius));
12116
+ var radius = Math.min(height / 2, Math.min(width / 2, this._cornerRadius));
12104
12117
  context.beginPath();
12105
12118
  context.moveTo(x + radius, y);
12106
12119
  context.lineTo(x + width - radius, y);
12107
- context.quadraticCurveTo(x + width, y, x + width, y + radius);
12120
+ context.arc(x + width - radius, y + radius, radius, (3 * Math.PI) / 2, Math.PI * 2);
12108
12121
  context.lineTo(x + width, y + height - radius);
12109
- context.quadraticCurveTo(x + width, y + height, x + width - radius, y + height);
12122
+ context.arc(x + width - radius, y + height - radius, radius, 0, Math.PI / 2);
12110
12123
  context.lineTo(x + radius, y + height);
12111
- context.quadraticCurveTo(x, y + height, x, y + height - radius);
12124
+ context.arc(x + radius, y + height - radius, radius, Math.PI / 2, Math.PI);
12112
12125
  context.lineTo(x, y + radius);
12113
- context.quadraticCurveTo(x, y, x + radius, y);
12126
+ context.arc(x + radius, y + radius, radius, Math.PI, (3 * Math.PI) / 2);
12114
12127
  context.closePath();
12115
12128
  };
12116
12129
  Rectangle.prototype._clipForChildren = function (context) {
@@ -12150,7 +12163,7 @@ __webpack_require__.r(__webpack_exports__);
12150
12163
  /* harmony import */ var _scrollViewerWindow__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./scrollViewerWindow */ "../../../lts/gui/dist/2D/controls/scrollViewers/scrollViewerWindow.js");
12151
12164
  /* harmony import */ var _sliders_scrollBar__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../sliders/scrollBar */ "../../../lts/gui/dist/2D/controls/sliders/scrollBar.js");
12152
12165
  /* harmony import */ var _sliders_imageScrollBar__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../sliders/imageScrollBar */ "../../../lts/gui/dist/2D/controls/sliders/imageScrollBar.js");
12153
- /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core/Misc/typeStore */ "core/Misc/observable");
12166
+ /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! core/Misc/decorators */ "core/Misc/observable");
12154
12167
  /* harmony import */ var core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7___default = /*#__PURE__*/__webpack_require__.n(core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__);
12155
12168
 
12156
12169
 
@@ -12160,6 +12173,7 @@ __webpack_require__.r(__webpack_exports__);
12160
12173
 
12161
12174
 
12162
12175
 
12176
+
12163
12177
  /**
12164
12178
  * Class used to hold a viewer window and sliders in a grid
12165
12179
  */
@@ -12825,6 +12839,21 @@ var ScrollViewer = /** @class */ (function (_super) {
12825
12839
  this._onWheelObserver = null;
12826
12840
  _super.prototype.dispose.call(this);
12827
12841
  };
12842
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
12843
+ (0,core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__.serialize)()
12844
+ ], ScrollViewer.prototype, "wheelPrecision", null);
12845
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
12846
+ (0,core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__.serialize)()
12847
+ ], ScrollViewer.prototype, "scrollBackground", null);
12848
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
12849
+ (0,core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__.serialize)()
12850
+ ], ScrollViewer.prototype, "barColor", null);
12851
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
12852
+ (0,core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__.serialize)()
12853
+ ], ScrollViewer.prototype, "barSize", null);
12854
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
12855
+ (0,core_Misc_typeStore__WEBPACK_IMPORTED_MODULE_7__.serialize)()
12856
+ ], ScrollViewer.prototype, "barBackground", null);
12828
12857
  return ScrollViewer;
12829
12858
  }(_rectangle__WEBPACK_IMPORTED_MODULE_1__.Rectangle));
12830
12859
 
@@ -14462,10 +14491,22 @@ var ImageScrollBar = /** @class */ (function (_super) {
14462
14491
  _this._thumbHeight = 1;
14463
14492
  _this._barImageHeight = 1;
14464
14493
  _this._tempMeasure = new _measure__WEBPACK_IMPORTED_MODULE_2__.Measure(0, 0, 0, 0);
14494
+ _this._invertScrollDirection = false;
14465
14495
  /** Number of 90° rotation to apply on the images when in vertical mode */
14466
14496
  _this.num90RotationInVerticalMode = 1;
14467
14497
  return _this;
14468
14498
  }
14499
+ Object.defineProperty(ImageScrollBar.prototype, "invertScrollDirection", {
14500
+ /** Inverts the scrolling direction (default: false) */
14501
+ get: function () {
14502
+ return this._invertScrollDirection;
14503
+ },
14504
+ set: function (invert) {
14505
+ this._invertScrollDirection = invert;
14506
+ },
14507
+ enumerable: false,
14508
+ configurable: true
14509
+ });
14469
14510
  Object.defineProperty(ImageScrollBar.prototype, "backgroundImage", {
14470
14511
  /**
14471
14512
  * Gets or sets the image used to render the background for horizontal bar
@@ -14666,6 +14707,7 @@ var ImageScrollBar = /** @class */ (function (_super) {
14666
14707
  x = this._transformedPosition.x;
14667
14708
  y = this._transformedPosition.y;
14668
14709
  }
14710
+ var sign = this._invertScrollDirection ? -1 : 1;
14669
14711
  if (this._first) {
14670
14712
  this._first = false;
14671
14713
  this._originX = x;
@@ -14691,7 +14733,7 @@ var ImageScrollBar = /** @class */ (function (_super) {
14691
14733
  else {
14692
14734
  delta = (x - this._originX) / (this._currentMeasure.width - this._effectiveThumbThickness);
14693
14735
  }
14694
- this.value += delta * (this.maximum - this.minimum);
14736
+ this.value += sign * delta * (this.maximum - this.minimum);
14695
14737
  this._originX = x;
14696
14738
  this._originY = y;
14697
14739
  };
@@ -14702,6 +14744,9 @@ var ImageScrollBar = /** @class */ (function (_super) {
14702
14744
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14703
14745
  (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14704
14746
  ], ImageScrollBar.prototype, "num90RotationInVerticalMode", void 0);
14747
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14748
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14749
+ ], ImageScrollBar.prototype, "invertScrollDirection", null);
14705
14750
  return ImageScrollBar;
14706
14751
  }(_baseSlider__WEBPACK_IMPORTED_MODULE_1__.BaseSlider));
14707
14752
 
@@ -14743,6 +14788,7 @@ var ScrollBar = /** @class */ (function (_super) {
14743
14788
  _this._background = "black";
14744
14789
  _this._borderColor = "white";
14745
14790
  _this._tempMeasure = new _measure__WEBPACK_IMPORTED_MODULE_2__.Measure(0, 0, 0, 0);
14791
+ _this._invertScrollDirection = false;
14746
14792
  return _this;
14747
14793
  }
14748
14794
  Object.defineProperty(ScrollBar.prototype, "borderColor", {
@@ -14775,6 +14821,17 @@ var ScrollBar = /** @class */ (function (_super) {
14775
14821
  enumerable: false,
14776
14822
  configurable: true
14777
14823
  });
14824
+ Object.defineProperty(ScrollBar.prototype, "invertScrollDirection", {
14825
+ /** Inverts the scrolling direction (default: false) */
14826
+ get: function () {
14827
+ return this._invertScrollDirection;
14828
+ },
14829
+ set: function (invert) {
14830
+ this._invertScrollDirection = invert;
14831
+ },
14832
+ enumerable: false,
14833
+ configurable: true
14834
+ });
14778
14835
  ScrollBar.prototype._getTypeName = function () {
14779
14836
  return "Scrollbar";
14780
14837
  };
@@ -14825,6 +14882,7 @@ var ScrollBar = /** @class */ (function (_super) {
14825
14882
  x = this._transformedPosition.x;
14826
14883
  y = this._transformedPosition.y;
14827
14884
  }
14885
+ var sign = this._invertScrollDirection ? -1 : 1;
14828
14886
  if (this._first) {
14829
14887
  this._first = false;
14830
14888
  this._originX = x;
@@ -14850,7 +14908,7 @@ var ScrollBar = /** @class */ (function (_super) {
14850
14908
  else {
14851
14909
  delta = (x - this._originX) / (this._currentMeasure.width - this._effectiveThumbThickness);
14852
14910
  }
14853
- this.value += delta * (this.maximum - this.minimum);
14911
+ this.value += sign * delta * (this.maximum - this.minimum);
14854
14912
  this._originX = x;
14855
14913
  this._originY = y;
14856
14914
  };
@@ -14864,6 +14922,9 @@ var ScrollBar = /** @class */ (function (_super) {
14864
14922
  (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14865
14923
  (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14866
14924
  ], ScrollBar.prototype, "background", null);
14925
+ (0,tslib__WEBPACK_IMPORTED_MODULE_0__.__decorate)([
14926
+ (0,core_Misc_decorators__WEBPACK_IMPORTED_MODULE_3__.serialize)()
14927
+ ], ScrollBar.prototype, "invertScrollDirection", null);
14867
14928
  return ScrollBar;
14868
14929
  }(_baseSlider__WEBPACK_IMPORTED_MODULE_1__.BaseSlider));
14869
14930