@babylonjs/gui 9.14.0 → 9.16.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.
Files changed (106) hide show
  1. package/2D/advancedDynamicTexture.d.ts +2 -2
  2. package/2D/advancedDynamicTexture.js +2 -2
  3. package/2D/advancedDynamicTexture.js.map +1 -1
  4. package/2D/controls/checkbox.pure.js +164 -153
  5. package/2D/controls/checkbox.pure.js.map +1 -1
  6. package/2D/controls/colorpicker.pure.js +1300 -1289
  7. package/2D/controls/colorpicker.pure.js.map +1 -1
  8. package/2D/controls/container.pure.js +597 -582
  9. package/2D/controls/container.pure.js.map +1 -1
  10. package/2D/controls/control.pure.js +2474 -2434
  11. package/2D/controls/control.pure.js.map +1 -1
  12. package/2D/controls/displayGrid.pure.js +201 -190
  13. package/2D/controls/displayGrid.pure.js.map +1 -1
  14. package/2D/controls/ellipse.pure.js +96 -85
  15. package/2D/controls/ellipse.pure.js.map +1 -1
  16. package/2D/controls/grid.pure.js +511 -500
  17. package/2D/controls/grid.pure.js.map +1 -1
  18. package/2D/controls/image.pure.js +888 -877
  19. package/2D/controls/image.pure.js.map +1 -1
  20. package/2D/controls/inputText.pure.js +988 -973
  21. package/2D/controls/inputText.pure.js.map +1 -1
  22. package/2D/controls/inputTextArea.pure.js +955 -944
  23. package/2D/controls/inputTextArea.pure.js.map +1 -1
  24. package/2D/controls/line.pure.js +237 -226
  25. package/2D/controls/line.pure.js.map +1 -1
  26. package/2D/controls/multiLine.pure.js +233 -222
  27. package/2D/controls/multiLine.pure.js.map +1 -1
  28. package/2D/controls/radioButton.pure.js +182 -169
  29. package/2D/controls/radioButton.pure.js.map +1 -1
  30. package/2D/controls/rectangle.pure.js +211 -200
  31. package/2D/controls/rectangle.pure.js.map +1 -1
  32. package/2D/controls/scrollViewers/scrollViewer.pure.js +579 -567
  33. package/2D/controls/scrollViewers/scrollViewer.pure.js.map +1 -1
  34. package/2D/controls/scrollViewers/scrollViewerWindow.d.ts +1 -1
  35. package/2D/controls/scrollViewers/scrollViewerWindow.js +2 -2
  36. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  37. package/2D/controls/selector.d.ts +2 -2
  38. package/2D/controls/selector.js +8 -8
  39. package/2D/controls/selector.js.map +1 -1
  40. package/2D/controls/sliders/baseSlider.d.ts +1 -1
  41. package/2D/controls/sliders/baseSlider.js +292 -281
  42. package/2D/controls/sliders/baseSlider.js.map +1 -1
  43. package/2D/controls/sliders/imageBasedSlider.pure.js +158 -147
  44. package/2D/controls/sliders/imageBasedSlider.pure.js.map +1 -1
  45. package/2D/controls/sliders/imageScrollBar.js +237 -223
  46. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  47. package/2D/controls/sliders/scrollBar.pure.js +169 -158
  48. package/2D/controls/sliders/scrollBar.pure.js.map +1 -1
  49. package/2D/controls/sliders/slider.pure.js +251 -240
  50. package/2D/controls/sliders/slider.pure.js.map +1 -1
  51. package/2D/controls/stackPanel.pure.js +236 -221
  52. package/2D/controls/stackPanel.pure.js.map +1 -1
  53. package/2D/controls/textBlock.pure.js +637 -626
  54. package/2D/controls/textBlock.pure.js.map +1 -1
  55. package/2D/math2D.d.ts +1 -1
  56. package/2D/math2D.js +1 -1
  57. package/2D/math2D.js.map +1 -1
  58. package/2D/measure.js +1 -1
  59. package/2D/measure.js.map +1 -1
  60. package/3D/controls/MRTK3/touchHolographicButton.d.ts +4 -4
  61. package/3D/controls/MRTK3/touchHolographicButton.js +10 -10
  62. package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
  63. package/3D/controls/holographicBackplate.d.ts +1 -1
  64. package/3D/controls/holographicBackplate.js +1 -1
  65. package/3D/controls/holographicBackplate.js.map +1 -1
  66. package/3D/controls/holographicButton.d.ts +1 -1
  67. package/3D/controls/holographicButton.js +4 -4
  68. package/3D/controls/holographicButton.js.map +1 -1
  69. package/3D/controls/holographicSlate.js +4 -4
  70. package/3D/controls/holographicSlate.js.map +1 -1
  71. package/3D/controls/slider3D.d.ts +3 -3
  72. package/3D/controls/slider3D.js +3 -3
  73. package/3D/controls/slider3D.js.map +1 -1
  74. package/3D/controls/touchHolographicButton.d.ts +2 -2
  75. package/3D/controls/touchHolographicButton.js +5 -5
  76. package/3D/controls/touchHolographicButton.js.map +1 -1
  77. package/3D/controls/touchHolographicMenu.js +1 -1
  78. package/3D/controls/touchHolographicMenu.js.map +1 -1
  79. package/3D/gizmos/gizmoHandle.d.ts +1 -1
  80. package/3D/gizmos/gizmoHandle.js +1 -1
  81. package/3D/gizmos/gizmoHandle.js.map +1 -1
  82. package/3D/materials/fluent/fluentMaterial.pure.d.ts +4 -4
  83. package/3D/materials/fluent/fluentMaterial.pure.js +322 -270
  84. package/3D/materials/fluent/fluentMaterial.pure.js.map +1 -1
  85. package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.js +510 -451
  86. package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.js.map +1 -1
  87. package/3D/materials/fluentButton/fluentButtonMaterial.pure.js +612 -526
  88. package/3D/materials/fluentButton/fluentButtonMaterial.pure.js.map +1 -1
  89. package/3D/materials/fluentMaterial.d.ts +1 -1
  90. package/3D/materials/fluentMaterial.js +1 -1
  91. package/3D/materials/fluentMaterial.js.map +1 -1
  92. package/3D/materials/handle/handleMaterial.pure.js +3 -1
  93. package/3D/materials/handle/handleMaterial.pure.js.map +1 -1
  94. package/3D/materials/mrdl/mrdlBackglowMaterial.pure.js +313 -271
  95. package/3D/materials/mrdl/mrdlBackglowMaterial.pure.js.map +1 -1
  96. package/3D/materials/mrdl/mrdlBackplateMaterial.pure.js +462 -402
  97. package/3D/materials/mrdl/mrdlBackplateMaterial.pure.js.map +1 -1
  98. package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.js +583 -498
  99. package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.js.map +1 -1
  100. package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.js +226 -200
  101. package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.js.map +1 -1
  102. package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.js +961 -822
  103. package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.js.map +1 -1
  104. package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.js +961 -822
  105. package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.js.map +1 -1
  106. package/package.json +2 -2
@@ -1,297 +1,308 @@
1
- import { __decorate } from "@babylonjs/core/tslib.es6.js";
1
+ import { __esDecorate, __runInitializers } from "@babylonjs/core/tslib.es6.js";
2
2
  import { Observable } from "@babylonjs/core/Misc/observable.js";
3
- import { Control } from "../control.js";
3
+ import { Control } from "../control.pure.js";
4
4
  import { ValueAndUnit } from "../../valueAndUnit.js";
5
5
  import { serialize } from "@babylonjs/core/Misc/decorators.js";
6
6
  import { Logger } from "@babylonjs/core/Misc/logger.js";
7
7
  /**
8
8
  * Class used to create slider controls
9
9
  */
10
- export class BaseSlider extends Control {
11
- /** Gets or sets a boolean indicating if the thumb must be rendered */
12
- get displayThumb() {
13
- return this._displayThumb;
14
- }
15
- set displayThumb(value) {
16
- if (this._displayThumb === value) {
17
- return;
18
- }
19
- this._displayThumb = value;
20
- this._markAsDirty();
21
- }
22
- /** Gets or sets a step to apply to values (0 by default) */
23
- get step() {
24
- return this._step;
25
- }
26
- set step(value) {
27
- if (this._step === value) {
28
- return;
29
- }
30
- this._step = value;
31
- this._markAsDirty();
32
- }
33
- /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
34
- get barOffset() {
35
- return this._barOffset.toString(this._host);
36
- }
37
- /** Gets main bar offset in pixels*/
38
- get barOffsetInPixels() {
39
- return this._barOffset.getValueInPixel(this._host, this._cachedParentMeasure.width);
40
- }
41
- set barOffset(value) {
42
- if (this._barOffset.toString(this._host) === value) {
43
- return;
44
- }
45
- if (this._barOffset.fromString(value)) {
46
- this._markAsDirty();
47
- }
48
- }
49
- /** Gets or sets thumb width */
50
- get thumbWidth() {
51
- return this._thumbWidth.toString(this._host);
52
- }
53
- /** Gets thumb width in pixels */
54
- get thumbWidthInPixels() {
55
- return this._thumbWidth.getValueInPixel(this._host, this._cachedParentMeasure.width);
56
- }
57
- set thumbWidth(value) {
58
- if (this._thumbWidth.toString(this._host) === value) {
59
- return;
60
- }
61
- if (this._thumbWidth.fromString(value)) {
62
- this._markAsDirty();
63
- }
64
- }
65
- /** Gets or sets minimum value */
66
- get minimum() {
67
- return this._minimum;
68
- }
69
- set minimum(value) {
70
- if (this._minimum === value) {
71
- return;
72
- }
73
- this._minimum = value;
74
- this._markAsDirty();
75
- this.value = Math.max(Math.min(this.value, this._maximum), this._minimum);
76
- }
77
- /** Gets or sets maximum value */
78
- get maximum() {
79
- return this._maximum;
80
- }
81
- set maximum(value) {
82
- if (this._maximum === value) {
83
- return;
84
- }
85
- this._maximum = value;
86
- this._markAsDirty();
87
- this.value = Math.max(Math.min(this.value, this._maximum), this._minimum);
88
- }
89
- /** Gets or sets current value */
90
- get value() {
91
- return this._value;
92
- }
93
- set value(value) {
94
- value = Math.max(Math.min(value, this._maximum), this._minimum);
95
- if (this._value === value) {
96
- return;
97
- }
98
- this._value = value;
99
- this._markAsDirty();
100
- this.onValueChangedObservable.notifyObservers(this._value, undefined, this, this);
101
- }
102
- /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
103
- get isVertical() {
104
- return this._isVertical;
105
- }
106
- set isVertical(value) {
107
- if (this._isVertical === value) {
108
- return;
109
- }
110
- this._isVertical = value;
111
- this._markAsDirty();
112
- }
113
- /** Gets or sets a value indicating if the thumb can go over main bar extends */
114
- get isThumbClamped() {
115
- return this._isThumbClamped;
116
- }
117
- set isThumbClamped(value) {
118
- if (this._isThumbClamped === value) {
119
- return;
120
- }
121
- this._isThumbClamped = value;
122
- this._markAsDirty();
123
- }
124
- /**
125
- * Creates a new BaseSlider
126
- * @param name defines the control name
127
- */
128
- constructor(name) {
129
- super(name);
130
- this.name = name;
131
- this._thumbWidth = new ValueAndUnit(20, ValueAndUnit.UNITMODE_PIXEL, false);
132
- this._minimum = 0;
133
- this._maximum = 100;
134
- this._value = 50;
135
- this._isVertical = false;
136
- this._barOffset = new ValueAndUnit(5, ValueAndUnit.UNITMODE_PIXEL, false);
137
- this._isThumbClamped = false;
138
- this._displayThumb = true;
139
- this._step = 0;
140
- this._lastPointerDownId = -1;
141
- // Shared rendering info
142
- this._effectiveBarOffset = 0;
143
- /** Observable raised when the slider value changes */
144
- this.onValueChangedObservable = new Observable();
145
- // Events
146
- this._pointerIsDown = false;
147
- this.isPointerBlocker = true;
148
- }
149
- _getTypeName() {
150
- return "BaseSlider";
151
- }
152
- _getThumbPosition() {
153
- if (this.isVertical) {
154
- return ((this.maximum - this.value) / (this.maximum - this.minimum)) * this._backgroundBoxLength;
155
- }
156
- return ((this.value - this.minimum) / (this.maximum - this.minimum)) * this._backgroundBoxLength;
157
- }
158
- _getThumbThickness(type) {
159
- let thumbThickness = 0;
160
- switch (type) {
161
- case "circle":
162
- if (this._thumbWidth.isPixel) {
163
- thumbThickness = Math.max(this._thumbWidth.getValue(this._host), this._backgroundBoxThickness);
10
+ let BaseSlider = (() => {
11
+ var _a;
12
+ let _classSuper = Control;
13
+ let _instanceExtraInitializers = [];
14
+ let _get_displayThumb_decorators;
15
+ let _get_step_decorators;
16
+ let _get_barOffset_decorators;
17
+ let _get_thumbWidth_decorators;
18
+ let _get_minimum_decorators;
19
+ let _get_maximum_decorators;
20
+ let _get_value_decorators;
21
+ let _get_isVertical_decorators;
22
+ let _get_isThumbClamped_decorators;
23
+ return _a = class BaseSlider extends _classSuper {
24
+ /** Gets or sets a boolean indicating if the thumb must be rendered */
25
+ get displayThumb() {
26
+ return this._displayThumb;
27
+ }
28
+ set displayThumb(value) {
29
+ if (this._displayThumb === value) {
30
+ return;
31
+ }
32
+ this._displayThumb = value;
33
+ this._markAsDirty();
34
+ }
35
+ /** Gets or sets a step to apply to values (0 by default) */
36
+ get step() {
37
+ return this._step;
38
+ }
39
+ set step(value) {
40
+ if (this._step === value) {
41
+ return;
42
+ }
43
+ this._step = value;
44
+ this._markAsDirty();
45
+ }
46
+ /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
47
+ get barOffset() {
48
+ return this._barOffset.toString(this._host);
49
+ }
50
+ /** Gets main bar offset in pixels*/
51
+ get barOffsetInPixels() {
52
+ return this._barOffset.getValueInPixel(this._host, this._cachedParentMeasure.width);
53
+ }
54
+ set barOffset(value) {
55
+ if (this._barOffset.toString(this._host) === value) {
56
+ return;
57
+ }
58
+ if (this._barOffset.fromString(value)) {
59
+ this._markAsDirty();
60
+ }
61
+ }
62
+ /** Gets or sets thumb width */
63
+ get thumbWidth() {
64
+ return this._thumbWidth.toString(this._host);
65
+ }
66
+ /** Gets thumb width in pixels */
67
+ get thumbWidthInPixels() {
68
+ return this._thumbWidth.getValueInPixel(this._host, this._cachedParentMeasure.width);
69
+ }
70
+ set thumbWidth(value) {
71
+ if (this._thumbWidth.toString(this._host) === value) {
72
+ return;
73
+ }
74
+ if (this._thumbWidth.fromString(value)) {
75
+ this._markAsDirty();
76
+ }
77
+ }
78
+ /** Gets or sets minimum value */
79
+ get minimum() {
80
+ return this._minimum;
81
+ }
82
+ set minimum(value) {
83
+ if (this._minimum === value) {
84
+ return;
85
+ }
86
+ this._minimum = value;
87
+ this._markAsDirty();
88
+ this.value = Math.max(Math.min(this.value, this._maximum), this._minimum);
89
+ }
90
+ /** Gets or sets maximum value */
91
+ get maximum() {
92
+ return this._maximum;
93
+ }
94
+ set maximum(value) {
95
+ if (this._maximum === value) {
96
+ return;
97
+ }
98
+ this._maximum = value;
99
+ this._markAsDirty();
100
+ this.value = Math.max(Math.min(this.value, this._maximum), this._minimum);
101
+ }
102
+ /** Gets or sets current value */
103
+ get value() {
104
+ return this._value;
105
+ }
106
+ set value(value) {
107
+ value = Math.max(Math.min(value, this._maximum), this._minimum);
108
+ if (this._value === value) {
109
+ return;
110
+ }
111
+ this._value = value;
112
+ this._markAsDirty();
113
+ this.onValueChangedObservable.notifyObservers(this._value, undefined, this, this);
114
+ }
115
+ /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
116
+ get isVertical() {
117
+ return this._isVertical;
118
+ }
119
+ set isVertical(value) {
120
+ if (this._isVertical === value) {
121
+ return;
122
+ }
123
+ this._isVertical = value;
124
+ this._markAsDirty();
125
+ }
126
+ /** Gets or sets a value indicating if the thumb can go over main bar extends */
127
+ get isThumbClamped() {
128
+ return this._isThumbClamped;
129
+ }
130
+ set isThumbClamped(value) {
131
+ if (this._isThumbClamped === value) {
132
+ return;
133
+ }
134
+ this._isThumbClamped = value;
135
+ this._markAsDirty();
136
+ }
137
+ /**
138
+ * Creates a new BaseSlider
139
+ * @param name defines the control name
140
+ */
141
+ constructor(name) {
142
+ super(name);
143
+ this.name = (__runInitializers(this, _instanceExtraInitializers), name);
144
+ this._thumbWidth = new ValueAndUnit(20, ValueAndUnit.UNITMODE_PIXEL, false);
145
+ this._minimum = 0;
146
+ this._maximum = 100;
147
+ this._value = 50;
148
+ this._isVertical = false;
149
+ this._barOffset = new ValueAndUnit(5, ValueAndUnit.UNITMODE_PIXEL, false);
150
+ this._isThumbClamped = false;
151
+ this._displayThumb = true;
152
+ this._step = 0;
153
+ this._lastPointerDownId = -1;
154
+ // Shared rendering info
155
+ this._effectiveBarOffset = 0;
156
+ /** Observable raised when the slider value changes */
157
+ this.onValueChangedObservable = new Observable();
158
+ // Events
159
+ this._pointerIsDown = false;
160
+ this.isPointerBlocker = true;
161
+ }
162
+ _getTypeName() {
163
+ return "BaseSlider";
164
+ }
165
+ _getThumbPosition() {
166
+ if (this.isVertical) {
167
+ return ((this.maximum - this.value) / (this.maximum - this.minimum)) * this._backgroundBoxLength;
168
+ }
169
+ return ((this.value - this.minimum) / (this.maximum - this.minimum)) * this._backgroundBoxLength;
170
+ }
171
+ _getThumbThickness(type) {
172
+ let thumbThickness = 0;
173
+ switch (type) {
174
+ case "circle":
175
+ if (this._thumbWidth.isPixel) {
176
+ thumbThickness = Math.max(this._thumbWidth.getValue(this._host), this._backgroundBoxThickness);
177
+ }
178
+ else {
179
+ thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);
180
+ }
181
+ break;
182
+ case "rectangle":
183
+ if (this._thumbWidth.isPixel) {
184
+ thumbThickness = Math.min(this._thumbWidth.getValue(this._host), this._backgroundBoxThickness);
185
+ }
186
+ else {
187
+ thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);
188
+ }
189
+ }
190
+ return thumbThickness;
191
+ }
192
+ _prepareRenderingData(type) {
193
+ // Main bar
194
+ this._effectiveBarOffset = 0;
195
+ this._renderLeft = this._currentMeasure.left;
196
+ this._renderTop = this._currentMeasure.top;
197
+ this._renderWidth = this._currentMeasure.width;
198
+ this._renderHeight = this._currentMeasure.height;
199
+ this._backgroundBoxLength = Math.max(this._currentMeasure.width, this._currentMeasure.height);
200
+ this._backgroundBoxThickness = Math.min(this._currentMeasure.width, this._currentMeasure.height);
201
+ this._effectiveThumbThickness = this._getThumbThickness(type);
202
+ if (this.displayThumb) {
203
+ this._backgroundBoxLength -= this._effectiveThumbThickness;
204
+ }
205
+ //throw error when height is less than width for vertical slider
206
+ if (this.isVertical && this._currentMeasure.height < this._currentMeasure.width) {
207
+ Logger.Error("Height should be greater than width");
208
+ return;
209
+ }
210
+ if (this._barOffset.isPixel) {
211
+ this._effectiveBarOffset = Math.min(this._barOffset.getValue(this._host), this._backgroundBoxThickness);
212
+ }
213
+ else {
214
+ this._effectiveBarOffset = this._backgroundBoxThickness * this._barOffset.getValue(this._host);
215
+ }
216
+ this._backgroundBoxThickness -= this._effectiveBarOffset * 2;
217
+ if (this.isVertical) {
218
+ this._renderLeft += this._effectiveBarOffset;
219
+ if (!this.isThumbClamped && this.displayThumb) {
220
+ this._renderTop += this._effectiveThumbThickness / 2;
221
+ }
222
+ this._renderHeight = this._backgroundBoxLength;
223
+ this._renderWidth = this._backgroundBoxThickness;
164
224
  }
165
225
  else {
166
- thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);
226
+ this._renderTop += this._effectiveBarOffset;
227
+ if (!this.isThumbClamped && this.displayThumb) {
228
+ this._renderLeft += this._effectiveThumbThickness / 2;
229
+ }
230
+ this._renderHeight = this._backgroundBoxThickness;
231
+ this._renderWidth = this._backgroundBoxLength;
167
232
  }
168
- break;
169
- case "rectangle":
170
- if (this._thumbWidth.isPixel) {
171
- thumbThickness = Math.min(this._thumbWidth.getValue(this._host), this._backgroundBoxThickness);
233
+ }
234
+ /**
235
+ * @internal
236
+ */
237
+ _updateValueFromPointer(x, y) {
238
+ this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);
239
+ x = this._transformedPosition.x;
240
+ y = this._transformedPosition.y;
241
+ let value;
242
+ if (this._isVertical) {
243
+ value = this._minimum + (1 - (y - this._currentMeasure.top) / this._currentMeasure.height) * (this._maximum - this._minimum);
172
244
  }
173
245
  else {
174
- thumbThickness = this._backgroundBoxThickness * this._thumbWidth.getValue(this._host);
246
+ value = this._minimum + ((x - this._currentMeasure.left) / this._currentMeasure.width) * (this._maximum - this._minimum);
247
+ }
248
+ this.value = this._step ? Math.round(value / this._step) * this._step : value;
249
+ }
250
+ _onPointerDown(target, coordinates, pointerId, buttonIndex, pi) {
251
+ if (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {
252
+ return false;
253
+ }
254
+ if (this.isReadOnly) {
255
+ return true;
256
+ }
257
+ this._pointerIsDown = true;
258
+ this._updateValueFromPointer(coordinates.x, coordinates.y);
259
+ this._host._capturingControl[pointerId] = this;
260
+ this._lastPointerDownId = pointerId;
261
+ return true;
262
+ }
263
+ _onPointerMove(target, coordinates, pointerId, pi) {
264
+ // Only listen to pointer move events coming from the last pointer to click on the element (To support dual vr controller interaction)
265
+ if (pointerId != this._lastPointerDownId) {
266
+ return;
267
+ }
268
+ if (this._pointerIsDown && !this.isReadOnly) {
269
+ this._updateValueFromPointer(coordinates.x, coordinates.y);
175
270
  }
176
- }
177
- return thumbThickness;
178
- }
179
- _prepareRenderingData(type) {
180
- // Main bar
181
- this._effectiveBarOffset = 0;
182
- this._renderLeft = this._currentMeasure.left;
183
- this._renderTop = this._currentMeasure.top;
184
- this._renderWidth = this._currentMeasure.width;
185
- this._renderHeight = this._currentMeasure.height;
186
- this._backgroundBoxLength = Math.max(this._currentMeasure.width, this._currentMeasure.height);
187
- this._backgroundBoxThickness = Math.min(this._currentMeasure.width, this._currentMeasure.height);
188
- this._effectiveThumbThickness = this._getThumbThickness(type);
189
- if (this.displayThumb) {
190
- this._backgroundBoxLength -= this._effectiveThumbThickness;
191
- }
192
- //throw error when height is less than width for vertical slider
193
- if (this.isVertical && this._currentMeasure.height < this._currentMeasure.width) {
194
- Logger.Error("Height should be greater than width");
195
- return;
196
- }
197
- if (this._barOffset.isPixel) {
198
- this._effectiveBarOffset = Math.min(this._barOffset.getValue(this._host), this._backgroundBoxThickness);
199
- }
200
- else {
201
- this._effectiveBarOffset = this._backgroundBoxThickness * this._barOffset.getValue(this._host);
202
- }
203
- this._backgroundBoxThickness -= this._effectiveBarOffset * 2;
204
- if (this.isVertical) {
205
- this._renderLeft += this._effectiveBarOffset;
206
- if (!this.isThumbClamped && this.displayThumb) {
207
- this._renderTop += this._effectiveThumbThickness / 2;
271
+ super._onPointerMove(target, coordinates, pointerId, pi);
272
+ }
273
+ _onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick) {
274
+ this._pointerIsDown = false;
275
+ delete this._host._capturingControl[pointerId];
276
+ super._onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick);
208
277
  }
209
- this._renderHeight = this._backgroundBoxLength;
210
- this._renderWidth = this._backgroundBoxThickness;
211
- }
212
- else {
213
- this._renderTop += this._effectiveBarOffset;
214
- if (!this.isThumbClamped && this.displayThumb) {
215
- this._renderLeft += this._effectiveThumbThickness / 2;
278
+ _onCanvasBlur() {
279
+ this._forcePointerUp();
280
+ super._onCanvasBlur();
216
281
  }
217
- this._renderHeight = this._backgroundBoxThickness;
218
- this._renderWidth = this._backgroundBoxLength;
219
- }
220
- }
221
- /**
222
- * @internal
223
- */
224
- _updateValueFromPointer(x, y) {
225
- this._invertTransformMatrix.transformCoordinates(x, y, this._transformedPosition);
226
- x = this._transformedPosition.x;
227
- y = this._transformedPosition.y;
228
- let value;
229
- if (this._isVertical) {
230
- value = this._minimum + (1 - (y - this._currentMeasure.top) / this._currentMeasure.height) * (this._maximum - this._minimum);
231
- }
232
- else {
233
- value = this._minimum + ((x - this._currentMeasure.left) / this._currentMeasure.width) * (this._maximum - this._minimum);
234
- }
235
- this.value = this._step ? Math.round(value / this._step) * this._step : value;
236
- }
237
- _onPointerDown(target, coordinates, pointerId, buttonIndex, pi) {
238
- if (!super._onPointerDown(target, coordinates, pointerId, buttonIndex, pi)) {
239
- return false;
240
- }
241
- if (this.isReadOnly) {
242
- return true;
243
- }
244
- this._pointerIsDown = true;
245
- this._updateValueFromPointer(coordinates.x, coordinates.y);
246
- this._host._capturingControl[pointerId] = this;
247
- this._lastPointerDownId = pointerId;
248
- return true;
249
- }
250
- _onPointerMove(target, coordinates, pointerId, pi) {
251
- // Only listen to pointer move events coming from the last pointer to click on the element (To support dual vr controller interaction)
252
- if (pointerId != this._lastPointerDownId) {
253
- return;
254
- }
255
- if (this._pointerIsDown && !this.isReadOnly) {
256
- this._updateValueFromPointer(coordinates.x, coordinates.y);
257
- }
258
- super._onPointerMove(target, coordinates, pointerId, pi);
259
- }
260
- _onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick) {
261
- this._pointerIsDown = false;
262
- delete this._host._capturingControl[pointerId];
263
- super._onPointerUp(target, coordinates, pointerId, buttonIndex, notifyClick);
264
- }
265
- _onCanvasBlur() {
266
- this._forcePointerUp();
267
- super._onCanvasBlur();
268
- }
269
- }
270
- __decorate([
271
- serialize()
272
- ], BaseSlider.prototype, "displayThumb", null);
273
- __decorate([
274
- serialize()
275
- ], BaseSlider.prototype, "step", null);
276
- __decorate([
277
- serialize()
278
- ], BaseSlider.prototype, "barOffset", null);
279
- __decorate([
280
- serialize()
281
- ], BaseSlider.prototype, "thumbWidth", null);
282
- __decorate([
283
- serialize()
284
- ], BaseSlider.prototype, "minimum", null);
285
- __decorate([
286
- serialize()
287
- ], BaseSlider.prototype, "maximum", null);
288
- __decorate([
289
- serialize()
290
- ], BaseSlider.prototype, "value", null);
291
- __decorate([
292
- serialize()
293
- ], BaseSlider.prototype, "isVertical", null);
294
- __decorate([
295
- serialize()
296
- ], BaseSlider.prototype, "isThumbClamped", null);
282
+ },
283
+ (() => {
284
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
285
+ _get_displayThumb_decorators = [serialize()];
286
+ _get_step_decorators = [serialize()];
287
+ _get_barOffset_decorators = [serialize()];
288
+ _get_thumbWidth_decorators = [serialize()];
289
+ _get_minimum_decorators = [serialize()];
290
+ _get_maximum_decorators = [serialize()];
291
+ _get_value_decorators = [serialize()];
292
+ _get_isVertical_decorators = [serialize()];
293
+ _get_isThumbClamped_decorators = [serialize()];
294
+ __esDecorate(_a, null, _get_displayThumb_decorators, { kind: "getter", name: "displayThumb", static: false, private: false, access: { has: obj => "displayThumb" in obj, get: obj => obj.displayThumb }, metadata: _metadata }, null, _instanceExtraInitializers);
295
+ __esDecorate(_a, null, _get_step_decorators, { kind: "getter", name: "step", static: false, private: false, access: { has: obj => "step" in obj, get: obj => obj.step }, metadata: _metadata }, null, _instanceExtraInitializers);
296
+ __esDecorate(_a, null, _get_barOffset_decorators, { kind: "getter", name: "barOffset", static: false, private: false, access: { has: obj => "barOffset" in obj, get: obj => obj.barOffset }, metadata: _metadata }, null, _instanceExtraInitializers);
297
+ __esDecorate(_a, null, _get_thumbWidth_decorators, { kind: "getter", name: "thumbWidth", static: false, private: false, access: { has: obj => "thumbWidth" in obj, get: obj => obj.thumbWidth }, metadata: _metadata }, null, _instanceExtraInitializers);
298
+ __esDecorate(_a, null, _get_minimum_decorators, { kind: "getter", name: "minimum", static: false, private: false, access: { has: obj => "minimum" in obj, get: obj => obj.minimum }, metadata: _metadata }, null, _instanceExtraInitializers);
299
+ __esDecorate(_a, null, _get_maximum_decorators, { kind: "getter", name: "maximum", static: false, private: false, access: { has: obj => "maximum" in obj, get: obj => obj.maximum }, metadata: _metadata }, null, _instanceExtraInitializers);
300
+ __esDecorate(_a, null, _get_value_decorators, { kind: "getter", name: "value", static: false, private: false, access: { has: obj => "value" in obj, get: obj => obj.value }, metadata: _metadata }, null, _instanceExtraInitializers);
301
+ __esDecorate(_a, null, _get_isVertical_decorators, { kind: "getter", name: "isVertical", static: false, private: false, access: { has: obj => "isVertical" in obj, get: obj => obj.isVertical }, metadata: _metadata }, null, _instanceExtraInitializers);
302
+ __esDecorate(_a, null, _get_isThumbClamped_decorators, { kind: "getter", name: "isThumbClamped", static: false, private: false, access: { has: obj => "isThumbClamped" in obj, get: obj => obj.isThumbClamped }, metadata: _metadata }, null, _instanceExtraInitializers);
303
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
304
+ })(),
305
+ _a;
306
+ })();
307
+ export { BaseSlider };
297
308
  //# sourceMappingURL=baseSlider.js.map