@babylonjs/gui 5.19.0 → 5.22.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 (180) hide show
  1. package/2D/adtInstrumentation.js +70 -90
  2. package/2D/adtInstrumentation.js.map +1 -1
  3. package/2D/advancedDynamicTexture.d.ts +8 -0
  4. package/2D/advancedDynamicTexture.js +559 -620
  5. package/2D/advancedDynamicTexture.js.map +1 -1
  6. package/2D/controls/button.js +76 -90
  7. package/2D/controls/button.js.map +1 -1
  8. package/2D/controls/checkbox.js +86 -106
  9. package/2D/controls/checkbox.js.map +1 -1
  10. package/2D/controls/colorpicker.js +395 -415
  11. package/2D/controls/colorpicker.js.map +1 -1
  12. package/2D/controls/container.js +187 -230
  13. package/2D/controls/container.js.map +1 -1
  14. package/2D/controls/control.js +1073 -1353
  15. package/2D/controls/control.js.map +1 -1
  16. package/2D/controls/displayGrid.js +152 -196
  17. package/2D/controls/displayGrid.js.map +1 -1
  18. package/2D/controls/ellipse.js +32 -40
  19. package/2D/controls/ellipse.js.map +1 -1
  20. package/2D/controls/focusableButton.js +30 -35
  21. package/2D/controls/focusableButton.js.map +1 -1
  22. package/2D/controls/grid.js +172 -212
  23. package/2D/controls/grid.js.map +1 -1
  24. package/2D/controls/image.js +489 -592
  25. package/2D/controls/image.js.map +1 -1
  26. package/2D/controls/inputPassword.js +9 -16
  27. package/2D/controls/inputPassword.js.map +1 -1
  28. package/2D/controls/inputText.js +380 -467
  29. package/2D/controls/inputText.js.map +1 -1
  30. package/2D/controls/inputTextArea.js +234 -273
  31. package/2D/controls/inputTextArea.js.map +1 -1
  32. package/2D/controls/line.js +147 -198
  33. package/2D/controls/line.js.map +1 -1
  34. package/2D/controls/multiLine.js +87 -113
  35. package/2D/controls/multiLine.js.map +1 -1
  36. package/2D/controls/radioButton.js +106 -127
  37. package/2D/controls/radioButton.js.map +1 -1
  38. package/2D/controls/rectangle.js +64 -76
  39. package/2D/controls/rectangle.js.map +1 -1
  40. package/2D/controls/scrollViewers/scrollViewer.js +439 -543
  41. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
  42. package/2D/controls/scrollViewers/scrollViewerWindow.js +99 -118
  43. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  44. package/2D/controls/selector.js +241 -329
  45. package/2D/controls/selector.js.map +1 -1
  46. package/2D/controls/sliders/baseSlider.js +182 -230
  47. package/2D/controls/sliders/baseSlider.js.map +1 -1
  48. package/2D/controls/sliders/imageBasedSlider.js +86 -109
  49. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  50. package/2D/controls/sliders/imageScrollBar.d.ts +4 -0
  51. package/2D/controls/sliders/imageScrollBar.js +149 -163
  52. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  53. package/2D/controls/sliders/scrollBar.d.ts +4 -0
  54. package/2D/controls/sliders/scrollBar.js +65 -65
  55. package/2D/controls/sliders/scrollBar.js.map +1 -1
  56. package/2D/controls/sliders/slider.js +91 -115
  57. package/2D/controls/sliders/slider.js.map +1 -1
  58. package/2D/controls/stackPanel.js +114 -135
  59. package/2D/controls/stackPanel.js.map +1 -1
  60. package/2D/controls/statics.js +5 -5
  61. package/2D/controls/statics.js.map +1 -1
  62. package/2D/controls/textBlock.js +322 -384
  63. package/2D/controls/textBlock.js.map +1 -1
  64. package/2D/controls/textWrapper.js +27 -41
  65. package/2D/controls/textWrapper.js.map +1 -1
  66. package/2D/controls/toggleButton.js +105 -121
  67. package/2D/controls/toggleButton.js.map +1 -1
  68. package/2D/controls/virtualKeyboard.js +101 -123
  69. package/2D/controls/virtualKeyboard.js.map +1 -1
  70. package/2D/math2D.js +62 -70
  71. package/2D/math2D.js.map +1 -1
  72. package/2D/measure.js +30 -32
  73. package/2D/measure.js.map +1 -1
  74. package/2D/multiLinePoint.js +71 -89
  75. package/2D/multiLinePoint.js.map +1 -1
  76. package/2D/style.js +55 -73
  77. package/2D/style.js.map +1 -1
  78. package/2D/valueAndUnit.js +71 -104
  79. package/2D/valueAndUnit.js.map +1 -1
  80. package/2D/xmlLoader.js +70 -84
  81. package/2D/xmlLoader.js.map +1 -1
  82. package/3D/behaviors/defaultBehavior.js +40 -59
  83. package/3D/behaviors/defaultBehavior.js.map +1 -1
  84. package/3D/controls/abstractButton3D.js +8 -12
  85. package/3D/controls/abstractButton3D.js.map +1 -1
  86. package/3D/controls/button3D.js +30 -35
  87. package/3D/controls/button3D.js.map +1 -1
  88. package/3D/controls/container3D.js +57 -71
  89. package/3D/controls/container3D.js.map +1 -1
  90. package/3D/controls/contentDisplay3D.js +47 -60
  91. package/3D/controls/contentDisplay3D.js.map +1 -1
  92. package/3D/controls/control3D.js +123 -158
  93. package/3D/controls/control3D.js.map +1 -1
  94. package/3D/controls/cylinderPanel.js +28 -38
  95. package/3D/controls/cylinderPanel.js.map +1 -1
  96. package/3D/controls/handMenu.js +20 -29
  97. package/3D/controls/handMenu.js.map +1 -1
  98. package/3D/controls/holographicBackplate.js +52 -72
  99. package/3D/controls/holographicBackplate.js.map +1 -1
  100. package/3D/controls/holographicButton.js +160 -200
  101. package/3D/controls/holographicButton.js.map +1 -1
  102. package/3D/controls/holographicSlate.js +176 -206
  103. package/3D/controls/holographicSlate.js.map +1 -1
  104. package/3D/controls/meshButton3D.js +24 -30
  105. package/3D/controls/meshButton3D.js.map +1 -1
  106. package/3D/controls/nearMenu.js +57 -71
  107. package/3D/controls/nearMenu.js.map +1 -1
  108. package/3D/controls/planePanel.js +6 -13
  109. package/3D/controls/planePanel.js.map +1 -1
  110. package/3D/controls/scatterPanel.js +43 -54
  111. package/3D/controls/scatterPanel.js.map +1 -1
  112. package/3D/controls/slider3D.js +168 -222
  113. package/3D/controls/slider3D.js.map +1 -1
  114. package/3D/controls/spherePanel.js +29 -39
  115. package/3D/controls/spherePanel.js.map +1 -1
  116. package/3D/controls/stackPanel3D.js +36 -49
  117. package/3D/controls/stackPanel3D.js.map +1 -1
  118. package/3D/controls/touchButton3D.js +126 -154
  119. package/3D/controls/touchButton3D.js.map +1 -1
  120. package/3D/controls/touchHolographicButton.js +223 -272
  121. package/3D/controls/touchHolographicButton.js.map +1 -1
  122. package/3D/controls/touchHolographicMenu.js +55 -66
  123. package/3D/controls/touchHolographicMenu.js.map +1 -1
  124. package/3D/controls/touchMeshButton3D.js +24 -30
  125. package/3D/controls/touchMeshButton3D.js.map +1 -1
  126. package/3D/controls/volumeBasedPanel.js +85 -107
  127. package/3D/controls/volumeBasedPanel.js.map +1 -1
  128. package/3D/gizmos/gizmoHandle.js +68 -103
  129. package/3D/gizmos/gizmoHandle.js.map +1 -1
  130. package/3D/gizmos/slateGizmo.js +165 -182
  131. package/3D/gizmos/slateGizmo.js.map +1 -1
  132. package/3D/gui3DManager.js +76 -101
  133. package/3D/gui3DManager.js.map +1 -1
  134. package/3D/materials/fluent/fluentMaterial.js +110 -119
  135. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  136. package/3D/materials/fluent/shaders/fluent.fragment.js +20 -3
  137. package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -1
  138. package/3D/materials/fluent/shaders/fluent.vertex.js +11 -3
  139. package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -1
  140. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +168 -177
  141. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  142. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +9 -3
  143. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -1
  144. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +15 -3
  145. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -1
  146. package/3D/materials/fluentButton/fluentButtonMaterial.js +205 -213
  147. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  148. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +6 -3
  149. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -1
  150. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +6 -3
  151. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -1
  152. package/3D/materials/handle/handleMaterial.js +56 -69
  153. package/3D/materials/handle/handleMaterial.js.map +1 -1
  154. package/3D/materials/handle/shaders/handle.fragment.js +3 -3
  155. package/3D/materials/handle/shaders/handle.fragment.js.map +1 -1
  156. package/3D/materials/handle/shaders/handle.vertex.js +3 -3
  157. package/3D/materials/handle/shaders/handle.vertex.js.map +1 -1
  158. package/3D/materials/mrdl/mrdlBackplateMaterial.js +158 -166
  159. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  160. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +322 -330
  161. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  162. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +322 -330
  163. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  164. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +9 -3
  165. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -1
  166. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +6 -3
  167. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -1
  168. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +24 -3
  169. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -1
  170. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +12 -3
  171. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -1
  172. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +24 -3
  173. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -1
  174. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +12 -3
  175. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -1
  176. package/3D/vector3WithInfo.js +6 -12
  177. package/3D/vector3WithInfo.js.map +1 -1
  178. package/legacy/legacy.js +1 -1
  179. package/legacy/legacy.js.map +1 -1
  180. package/package.json +2 -5
@@ -1,4 +1,3 @@
1
- import { __extends } from "tslib";
2
1
  import { Rectangle } from "./rectangle.js";
3
2
  import { StackPanel } from "./stackPanel.js";
4
3
  import { Control } from "./control.js";
@@ -10,12 +9,12 @@ import { Container } from "./container.js";
10
9
  /** Class used to create a RadioGroup
11
10
  * which contains groups of radio buttons
12
11
  */
13
- var SelectorGroup = /** @class */ (function () {
12
+ export class SelectorGroup {
14
13
  /**
15
14
  * Creates a new SelectorGroup
16
15
  * @param name of group, used as a group heading
17
16
  */
18
- function SelectorGroup(
17
+ constructor(
19
18
  /** name of SelectorGroup */
20
19
  name) {
21
20
  this.name = name;
@@ -25,42 +24,30 @@ var SelectorGroup = /** @class */ (function () {
25
24
  this._groupPanel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
26
25
  this._groupHeader = this._addGroupHeader(name);
27
26
  }
28
- Object.defineProperty(SelectorGroup.prototype, "groupPanel", {
29
- /** Gets the groupPanel of the SelectorGroup */
30
- get: function () {
31
- return this._groupPanel;
32
- },
33
- enumerable: false,
34
- configurable: true
35
- });
36
- Object.defineProperty(SelectorGroup.prototype, "selectors", {
37
- /** Gets the selectors array */
38
- get: function () {
39
- return this._selectors;
40
- },
41
- enumerable: false,
42
- configurable: true
43
- });
44
- Object.defineProperty(SelectorGroup.prototype, "header", {
45
- /** Gets and sets the group header */
46
- get: function () {
47
- return this._groupHeader.text;
48
- },
49
- set: function (label) {
50
- if (this._groupHeader.text === "label") {
51
- return;
52
- }
53
- this._groupHeader.text = label;
54
- },
55
- enumerable: false,
56
- configurable: true
57
- });
27
+ /** Gets the groupPanel of the SelectorGroup */
28
+ get groupPanel() {
29
+ return this._groupPanel;
30
+ }
31
+ /** Gets the selectors array */
32
+ get selectors() {
33
+ return this._selectors;
34
+ }
35
+ /** Gets and sets the group header */
36
+ get header() {
37
+ return this._groupHeader.text;
38
+ }
39
+ set header(label) {
40
+ if (this._groupHeader.text === "label") {
41
+ return;
42
+ }
43
+ this._groupHeader.text = label;
44
+ }
58
45
  /**
59
46
  * @param text
60
47
  * @hidden
61
48
  */
62
- SelectorGroup.prototype._addGroupHeader = function (text) {
63
- var groupHeading = new TextBlock("groupHead", text);
49
+ _addGroupHeader(text) {
50
+ const groupHeading = new TextBlock("groupHead", text);
64
51
  groupHeading.width = 0.9;
65
52
  groupHeading.height = "30px";
66
53
  groupHeading.textWrapping = true;
@@ -70,49 +57,41 @@ var SelectorGroup = /** @class */ (function () {
70
57
  groupHeading.left = "2px";
71
58
  this._groupPanel.addControl(groupHeading);
72
59
  return groupHeading;
73
- };
60
+ }
74
61
  /**
75
62
  * @param selectorNb
76
63
  * @hidden
77
64
  */
78
- SelectorGroup.prototype._getSelector = function (selectorNb) {
65
+ _getSelector(selectorNb) {
79
66
  if (selectorNb < 0 || selectorNb >= this._selectors.length) {
80
67
  return;
81
68
  }
82
69
  return this._selectors[selectorNb];
83
- };
70
+ }
84
71
  /** Removes the selector at the given position
85
72
  * @param selectorNb the position of the selector within the group
86
73
  */
87
- SelectorGroup.prototype.removeSelector = function (selectorNb) {
74
+ removeSelector(selectorNb) {
88
75
  if (selectorNb < 0 || selectorNb >= this._selectors.length) {
89
76
  return;
90
77
  }
91
78
  this._groupPanel.removeControl(this._selectors[selectorNb]);
92
79
  this._selectors.splice(selectorNb, 1);
93
- };
94
- return SelectorGroup;
95
- }());
96
- export { SelectorGroup };
80
+ }
81
+ }
97
82
  /** Class used to create a CheckboxGroup
98
83
  * which contains groups of checkbox buttons
99
84
  */
100
- var CheckboxGroup = /** @class */ (function (_super) {
101
- __extends(CheckboxGroup, _super);
102
- function CheckboxGroup() {
103
- return _super !== null && _super.apply(this, arguments) || this;
104
- }
85
+ export class CheckboxGroup extends SelectorGroup {
105
86
  /** Adds a checkbox as a control
106
87
  * @param text is the label for the selector
107
88
  * @param func is the function called when the Selector is checked
108
89
  * @param checked is true when Selector is checked
109
90
  */
110
91
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
111
- CheckboxGroup.prototype.addCheckbox = function (text, func, checked) {
112
- if (func === void 0) { func = function (s) { }; }
113
- if (checked === void 0) { checked = false; }
92
+ addCheckbox(text, func = (s) => { }, checked = false) {
114
93
  checked = checked || false;
115
- var button = new Checkbox();
94
+ const button = new Checkbox();
116
95
  button.width = "20px";
117
96
  button.height = "20px";
118
97
  button.color = "#364249";
@@ -121,7 +100,7 @@ var CheckboxGroup = /** @class */ (function (_super) {
121
100
  button.onIsCheckedChangedObservable.add(function (state) {
122
101
  func(state);
123
102
  });
124
- var _selector = Control.AddHeader(button, text, "200px", { isHorizontal: true, controlFirst: true });
103
+ const _selector = Control.AddHeader(button, text, "200px", { isHorizontal: true, controlFirst: true });
125
104
  _selector.height = "30px";
126
105
  _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
127
106
  _selector.left = "4px";
@@ -132,51 +111,47 @@ var CheckboxGroup = /** @class */ (function (_super) {
132
111
  button.color = this.groupPanel.parent.parent.buttonColor;
133
112
  button.background = this.groupPanel.parent.parent.buttonBackground;
134
113
  }
135
- };
114
+ }
136
115
  /**
137
116
  * @param selectorNb
138
117
  * @param label
139
118
  * @hidden
140
119
  */
141
- CheckboxGroup.prototype._setSelectorLabel = function (selectorNb, label) {
120
+ _setSelectorLabel(selectorNb, label) {
142
121
  this.selectors[selectorNb].children[1].text = label;
143
- };
122
+ }
144
123
  /**
145
124
  * @param selectorNb
146
125
  * @param color
147
126
  * @hidden
148
127
  */
149
- CheckboxGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
128
+ _setSelectorLabelColor(selectorNb, color) {
150
129
  this.selectors[selectorNb].children[1].color = color;
151
- };
130
+ }
152
131
  /**
153
132
  * @param selectorNb
154
133
  * @param color
155
134
  * @hidden
156
135
  */
157
- CheckboxGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
136
+ _setSelectorButtonColor(selectorNb, color) {
158
137
  this.selectors[selectorNb].children[0].color = color;
159
- };
138
+ }
160
139
  /**
161
140
  * @param selectorNb
162
141
  * @param color
163
142
  * @hidden
164
143
  */
165
- CheckboxGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
144
+ _setSelectorButtonBackground(selectorNb, color) {
166
145
  this.selectors[selectorNb].children[0].background = color;
167
- };
168
- return CheckboxGroup;
169
- }(SelectorGroup));
170
- export { CheckboxGroup };
146
+ }
147
+ }
171
148
  /** Class used to create a RadioGroup
172
149
  * which contains groups of radio buttons
173
150
  */
174
- var RadioGroup = /** @class */ (function (_super) {
175
- __extends(RadioGroup, _super);
176
- function RadioGroup() {
177
- var _this = _super !== null && _super.apply(this, arguments) || this;
178
- _this._selectNb = 0;
179
- return _this;
151
+ export class RadioGroup extends SelectorGroup {
152
+ constructor() {
153
+ super(...arguments);
154
+ this._selectNb = 0;
180
155
  }
181
156
  /** Adds a radio button as a control
182
157
  * @param label is the label for the selector
@@ -184,11 +159,9 @@ var RadioGroup = /** @class */ (function (_super) {
184
159
  * @param checked is true when Selector is checked
185
160
  */
186
161
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
187
- RadioGroup.prototype.addRadio = function (label, func, checked) {
188
- if (func === void 0) { func = function (n) { }; }
189
- if (checked === void 0) { checked = false; }
190
- var nb = this._selectNb++;
191
- var button = new RadioButton();
162
+ addRadio(label, func = (n) => { }, checked = false) {
163
+ const nb = this._selectNb++;
164
+ const button = new RadioButton();
192
165
  button.name = label;
193
166
  button.width = "20px";
194
167
  button.height = "20px";
@@ -201,7 +174,7 @@ var RadioGroup = /** @class */ (function (_super) {
201
174
  func(nb);
202
175
  }
203
176
  });
204
- var _selector = Control.AddHeader(button, label, "200px", { isHorizontal: true, controlFirst: true });
177
+ const _selector = Control.AddHeader(button, label, "200px", { isHorizontal: true, controlFirst: true });
205
178
  _selector.height = "30px";
206
179
  _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
207
180
  _selector.left = "4px";
@@ -212,50 +185,44 @@ var RadioGroup = /** @class */ (function (_super) {
212
185
  button.color = this.groupPanel.parent.parent.buttonColor;
213
186
  button.background = this.groupPanel.parent.parent.buttonBackground;
214
187
  }
215
- };
188
+ }
216
189
  /**
217
190
  * @param selectorNb
218
191
  * @param label
219
192
  * @hidden
220
193
  */
221
- RadioGroup.prototype._setSelectorLabel = function (selectorNb, label) {
194
+ _setSelectorLabel(selectorNb, label) {
222
195
  this.selectors[selectorNb].children[1].text = label;
223
- };
196
+ }
224
197
  /**
225
198
  * @param selectorNb
226
199
  * @param color
227
200
  * @hidden
228
201
  */
229
- RadioGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
202
+ _setSelectorLabelColor(selectorNb, color) {
230
203
  this.selectors[selectorNb].children[1].color = color;
231
- };
204
+ }
232
205
  /**
233
206
  * @param selectorNb
234
207
  * @param color
235
208
  * @hidden
236
209
  */
237
- RadioGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
210
+ _setSelectorButtonColor(selectorNb, color) {
238
211
  this.selectors[selectorNb].children[0].color = color;
239
- };
212
+ }
240
213
  /**
241
214
  * @param selectorNb
242
215
  * @param color
243
216
  * @hidden
244
217
  */
245
- RadioGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
218
+ _setSelectorButtonBackground(selectorNb, color) {
246
219
  this.selectors[selectorNb].children[0].background = color;
247
- };
248
- return RadioGroup;
249
- }(SelectorGroup));
250
- export { RadioGroup };
220
+ }
221
+ }
251
222
  /** Class used to create a SliderGroup
252
223
  * which contains groups of slider buttons
253
224
  */
254
- var SliderGroup = /** @class */ (function (_super) {
255
- __extends(SliderGroup, _super);
256
- function SliderGroup() {
257
- return _super !== null && _super.apply(this, arguments) || this;
258
- }
225
+ export class SliderGroup extends SelectorGroup {
259
226
  /**
260
227
  * Adds a slider to the SelectorGroup
261
228
  * @param label is the label for the SliderBar
@@ -266,18 +233,12 @@ var SliderGroup = /** @class */ (function (_super) {
266
233
  * @param value is the start value for the Slider between min and max
267
234
  * @param onValueChange is the function used to format the value displayed, eg radians to degrees
268
235
  */
269
- SliderGroup.prototype.addSlider = function (label,
236
+ addSlider(label,
270
237
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
271
- func, unit, min, max, value, onValueChange) {
272
- if (func === void 0) { func = function (v) { }; }
273
- if (unit === void 0) { unit = "Units"; }
274
- if (min === void 0) { min = 0; }
275
- if (max === void 0) { max = 0; }
276
- if (value === void 0) { value = 0; }
277
- if (onValueChange === void 0) { onValueChange = function (v) {
278
- return v | 0;
279
- }; }
280
- var button = new Slider();
238
+ func = (v) => { }, unit = "Units", min = 0, max = 0, value = 0, onValueChange = (v) => {
239
+ return v | 0;
240
+ }) {
241
+ const button = new Slider();
281
242
  button.name = unit;
282
243
  button.value = value;
283
244
  button.minimum = min;
@@ -294,7 +255,7 @@ var SliderGroup = /** @class */ (function (_super) {
294
255
  button.parent.children[0].text = button.parent.children[0].name + ": " + onValueChange(value) + " " + button.name;
295
256
  func(value);
296
257
  });
297
- var _selector = Control.AddHeader(button, label + ": " + onValueChange(value) + " " + unit, "30px", { isHorizontal: false, controlFirst: false });
258
+ const _selector = Control.AddHeader(button, label + ": " + onValueChange(value) + " " + unit, "30px", { isHorizontal: false, controlFirst: false });
298
259
  _selector.height = "60px";
299
260
  _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
300
261
  _selector.left = "4px";
@@ -305,252 +266,215 @@ var SliderGroup = /** @class */ (function (_super) {
305
266
  button.color = this.groupPanel.parent.parent.buttonColor;
306
267
  button.background = this.groupPanel.parent.parent.buttonBackground;
307
268
  }
308
- };
269
+ }
309
270
  /**
310
271
  * @param selectorNb
311
272
  * @param label
312
273
  * @hidden
313
274
  */
314
- SliderGroup.prototype._setSelectorLabel = function (selectorNb, label) {
275
+ _setSelectorLabel(selectorNb, label) {
315
276
  this.selectors[selectorNb].children[0].name = label;
316
277
  this.selectors[selectorNb].children[0].text =
317
278
  label + ": " + this.selectors[selectorNb].children[1].value + " " + this.selectors[selectorNb].children[1].name;
318
- };
279
+ }
319
280
  /**
320
281
  * @param selectorNb
321
282
  * @param color
322
283
  * @hidden
323
284
  */
324
- SliderGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
285
+ _setSelectorLabelColor(selectorNb, color) {
325
286
  this.selectors[selectorNb].children[0].color = color;
326
- };
287
+ }
327
288
  /**
328
289
  * @param selectorNb
329
290
  * @param color
330
291
  * @hidden
331
292
  */
332
- SliderGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
293
+ _setSelectorButtonColor(selectorNb, color) {
333
294
  this.selectors[selectorNb].children[1].color = color;
334
- };
295
+ }
335
296
  /**
336
297
  * @param selectorNb
337
298
  * @param color
338
299
  * @hidden
339
300
  */
340
- SliderGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
301
+ _setSelectorButtonBackground(selectorNb, color) {
341
302
  this.selectors[selectorNb].children[1].background = color;
342
- };
343
- return SliderGroup;
344
- }(SelectorGroup));
345
- export { SliderGroup };
303
+ }
304
+ }
346
305
  /** Class used to hold the controls for the checkboxes, radio buttons and sliders
347
306
  * @see https://doc.babylonjs.com/how_to/selector
348
307
  */
349
- var SelectionPanel = /** @class */ (function (_super) {
350
- __extends(SelectionPanel, _super);
308
+ export class SelectionPanel extends Rectangle {
351
309
  /**
352
310
  * Creates a new SelectionPanel
353
311
  * @param name of SelectionPanel
354
312
  * @param groups is an array of SelectionGroups
355
313
  */
356
- function SelectionPanel(
314
+ constructor(
357
315
  /** name of SelectionPanel */
358
316
  name,
359
317
  /** an array of SelectionGroups */
360
- groups) {
361
- if (groups === void 0) { groups = []; }
362
- var _this = _super.call(this, name) || this;
363
- _this.name = name;
364
- _this.groups = groups;
365
- _this._buttonColor = "#364249";
366
- _this._buttonBackground = "#CCCCCC";
367
- _this._headerColor = "black";
368
- _this._barColor = "white";
369
- _this._barHeight = "2px";
370
- _this._spacerHeight = "20px";
371
- _this._bars = new Array();
372
- _this._groups = groups;
373
- _this.thickness = 2;
374
- _this._panel = new StackPanel();
375
- _this._panel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
376
- _this._panel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
377
- _this._panel.top = 5;
378
- _this._panel.left = 5;
379
- _this._panel.width = 0.95;
318
+ groups = []) {
319
+ super(name);
320
+ this.name = name;
321
+ this.groups = groups;
322
+ this._buttonColor = "#364249";
323
+ this._buttonBackground = "#CCCCCC";
324
+ this._headerColor = "black";
325
+ this._barColor = "white";
326
+ this._barHeight = "2px";
327
+ this._spacerHeight = "20px";
328
+ this._bars = new Array();
329
+ this._groups = groups;
330
+ this.thickness = 2;
331
+ this._panel = new StackPanel();
332
+ this._panel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
333
+ this._panel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
334
+ this._panel.top = 5;
335
+ this._panel.left = 5;
336
+ this._panel.width = 0.95;
380
337
  if (groups.length > 0) {
381
- for (var i = 0; i < groups.length - 1; i++) {
382
- _this._panel.addControl(groups[i].groupPanel);
383
- _this._addSpacer();
338
+ for (let i = 0; i < groups.length - 1; i++) {
339
+ this._panel.addControl(groups[i].groupPanel);
340
+ this._addSpacer();
384
341
  }
385
- _this._panel.addControl(groups[groups.length - 1].groupPanel);
342
+ this._panel.addControl(groups[groups.length - 1].groupPanel);
386
343
  }
387
- _this.addControl(_this._panel);
388
- return _this;
344
+ this.addControl(this._panel);
389
345
  }
390
- SelectionPanel.prototype._getTypeName = function () {
346
+ _getTypeName() {
391
347
  return "SelectionPanel";
392
- };
393
- Object.defineProperty(SelectionPanel.prototype, "panel", {
394
- /** Gets the (stack) panel of the SelectionPanel */
395
- get: function () {
396
- return this._panel;
397
- },
398
- enumerable: false,
399
- configurable: true
400
- });
401
- Object.defineProperty(SelectionPanel.prototype, "headerColor", {
402
- /** Gets or sets the headerColor */
403
- get: function () {
404
- return this._headerColor;
405
- },
406
- set: function (color) {
407
- if (this._headerColor === color) {
408
- return;
409
- }
410
- this._headerColor = color;
411
- this._setHeaderColor();
412
- },
413
- enumerable: false,
414
- configurable: true
415
- });
416
- SelectionPanel.prototype._setHeaderColor = function () {
417
- for (var i = 0; i < this._groups.length; i++) {
348
+ }
349
+ /** Gets the (stack) panel of the SelectionPanel */
350
+ get panel() {
351
+ return this._panel;
352
+ }
353
+ /** Gets or sets the headerColor */
354
+ get headerColor() {
355
+ return this._headerColor;
356
+ }
357
+ set headerColor(color) {
358
+ if (this._headerColor === color) {
359
+ return;
360
+ }
361
+ this._headerColor = color;
362
+ this._setHeaderColor();
363
+ }
364
+ _setHeaderColor() {
365
+ for (let i = 0; i < this._groups.length; i++) {
418
366
  this._groups[i].groupPanel.children[0].color = this._headerColor;
419
367
  }
420
- };
421
- Object.defineProperty(SelectionPanel.prototype, "buttonColor", {
422
- /** Gets or sets the button color */
423
- get: function () {
424
- return this._buttonColor;
425
- },
426
- set: function (color) {
427
- if (this._buttonColor === color) {
428
- return;
429
- }
430
- this._buttonColor = color;
431
- this._setbuttonColor();
432
- },
433
- enumerable: false,
434
- configurable: true
435
- });
436
- SelectionPanel.prototype._setbuttonColor = function () {
437
- for (var i = 0; i < this._groups.length; i++) {
438
- for (var j = 0; j < this._groups[i].selectors.length; j++) {
368
+ }
369
+ /** Gets or sets the button color */
370
+ get buttonColor() {
371
+ return this._buttonColor;
372
+ }
373
+ set buttonColor(color) {
374
+ if (this._buttonColor === color) {
375
+ return;
376
+ }
377
+ this._buttonColor = color;
378
+ this._setbuttonColor();
379
+ }
380
+ _setbuttonColor() {
381
+ for (let i = 0; i < this._groups.length; i++) {
382
+ for (let j = 0; j < this._groups[i].selectors.length; j++) {
439
383
  this._groups[i]._setSelectorButtonColor(j, this._buttonColor);
440
384
  }
441
385
  }
442
- };
443
- Object.defineProperty(SelectionPanel.prototype, "labelColor", {
444
- /** Gets or sets the label color */
445
- get: function () {
446
- return this._labelColor;
447
- },
448
- set: function (color) {
449
- if (this._labelColor === color) {
450
- return;
451
- }
452
- this._labelColor = color;
453
- this._setLabelColor();
454
- },
455
- enumerable: false,
456
- configurable: true
457
- });
458
- SelectionPanel.prototype._setLabelColor = function () {
459
- for (var i = 0; i < this._groups.length; i++) {
460
- for (var j = 0; j < this._groups[i].selectors.length; j++) {
386
+ }
387
+ /** Gets or sets the label color */
388
+ get labelColor() {
389
+ return this._labelColor;
390
+ }
391
+ set labelColor(color) {
392
+ if (this._labelColor === color) {
393
+ return;
394
+ }
395
+ this._labelColor = color;
396
+ this._setLabelColor();
397
+ }
398
+ _setLabelColor() {
399
+ for (let i = 0; i < this._groups.length; i++) {
400
+ for (let j = 0; j < this._groups[i].selectors.length; j++) {
461
401
  this._groups[i]._setSelectorLabelColor(j, this._labelColor);
462
402
  }
463
403
  }
464
- };
465
- Object.defineProperty(SelectionPanel.prototype, "buttonBackground", {
466
- /** Gets or sets the button background */
467
- get: function () {
468
- return this._buttonBackground;
469
- },
470
- set: function (color) {
471
- if (this._buttonBackground === color) {
472
- return;
473
- }
474
- this._buttonBackground = color;
475
- this._setButtonBackground();
476
- },
477
- enumerable: false,
478
- configurable: true
479
- });
480
- SelectionPanel.prototype._setButtonBackground = function () {
481
- for (var i = 0; i < this._groups.length; i++) {
482
- for (var j = 0; j < this._groups[i].selectors.length; j++) {
404
+ }
405
+ /** Gets or sets the button background */
406
+ get buttonBackground() {
407
+ return this._buttonBackground;
408
+ }
409
+ set buttonBackground(color) {
410
+ if (this._buttonBackground === color) {
411
+ return;
412
+ }
413
+ this._buttonBackground = color;
414
+ this._setButtonBackground();
415
+ }
416
+ _setButtonBackground() {
417
+ for (let i = 0; i < this._groups.length; i++) {
418
+ for (let j = 0; j < this._groups[i].selectors.length; j++) {
483
419
  this._groups[i]._setSelectorButtonBackground(j, this._buttonBackground);
484
420
  }
485
421
  }
486
- };
487
- Object.defineProperty(SelectionPanel.prototype, "barColor", {
488
- /** Gets or sets the color of separator bar */
489
- get: function () {
490
- return this._barColor;
491
- },
492
- set: function (color) {
493
- if (this._barColor === color) {
494
- return;
495
- }
496
- this._barColor = color;
497
- this._setBarColor();
498
- },
499
- enumerable: false,
500
- configurable: true
501
- });
502
- SelectionPanel.prototype._setBarColor = function () {
503
- for (var i = 0; i < this._bars.length; i++) {
422
+ }
423
+ /** Gets or sets the color of separator bar */
424
+ get barColor() {
425
+ return this._barColor;
426
+ }
427
+ set barColor(color) {
428
+ if (this._barColor === color) {
429
+ return;
430
+ }
431
+ this._barColor = color;
432
+ this._setBarColor();
433
+ }
434
+ _setBarColor() {
435
+ for (let i = 0; i < this._bars.length; i++) {
504
436
  this._bars[i].children[0].background = this._barColor;
505
437
  }
506
- };
507
- Object.defineProperty(SelectionPanel.prototype, "barHeight", {
508
- /** Gets or sets the height of separator bar */
509
- get: function () {
510
- return this._barHeight;
511
- },
512
- set: function (value) {
513
- if (this._barHeight === value) {
514
- return;
515
- }
516
- this._barHeight = value;
517
- this._setBarHeight();
518
- },
519
- enumerable: false,
520
- configurable: true
521
- });
522
- SelectionPanel.prototype._setBarHeight = function () {
523
- for (var i = 0; i < this._bars.length; i++) {
438
+ }
439
+ /** Gets or sets the height of separator bar */
440
+ get barHeight() {
441
+ return this._barHeight;
442
+ }
443
+ set barHeight(value) {
444
+ if (this._barHeight === value) {
445
+ return;
446
+ }
447
+ this._barHeight = value;
448
+ this._setBarHeight();
449
+ }
450
+ _setBarHeight() {
451
+ for (let i = 0; i < this._bars.length; i++) {
524
452
  this._bars[i].children[0].height = this._barHeight;
525
453
  }
526
- };
527
- Object.defineProperty(SelectionPanel.prototype, "spacerHeight", {
528
- /** Gets or sets the height of spacers*/
529
- get: function () {
530
- return this._spacerHeight;
531
- },
532
- set: function (value) {
533
- if (this._spacerHeight === value) {
534
- return;
535
- }
536
- this._spacerHeight = value;
537
- this._setSpacerHeight();
538
- },
539
- enumerable: false,
540
- configurable: true
541
- });
542
- SelectionPanel.prototype._setSpacerHeight = function () {
543
- for (var i = 0; i < this._bars.length; i++) {
454
+ }
455
+ /** Gets or sets the height of spacers*/
456
+ get spacerHeight() {
457
+ return this._spacerHeight;
458
+ }
459
+ set spacerHeight(value) {
460
+ if (this._spacerHeight === value) {
461
+ return;
462
+ }
463
+ this._spacerHeight = value;
464
+ this._setSpacerHeight();
465
+ }
466
+ _setSpacerHeight() {
467
+ for (let i = 0; i < this._bars.length; i++) {
544
468
  this._bars[i].height = this._spacerHeight;
545
469
  }
546
- };
470
+ }
547
471
  /** Adds a bar between groups */
548
- SelectionPanel.prototype._addSpacer = function () {
549
- var separator = new Container();
472
+ _addSpacer() {
473
+ const separator = new Container();
550
474
  separator.width = 1;
551
475
  separator.height = this._spacerHeight;
552
476
  separator.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
553
- var bar = new Rectangle();
477
+ const bar = new Rectangle();
554
478
  bar.width = 1;
555
479
  bar.height = this._barHeight;
556
480
  bar.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
@@ -560,107 +484,103 @@ var SelectionPanel = /** @class */ (function (_super) {
560
484
  separator.addControl(bar);
561
485
  this._panel.addControl(separator);
562
486
  this._bars.push(separator);
563
- };
487
+ }
564
488
  /** Add a group to the selection panel
565
489
  * @param group is the selector group to add
566
490
  */
567
- SelectionPanel.prototype.addGroup = function (group) {
491
+ addGroup(group) {
568
492
  if (this._groups.length > 0) {
569
493
  this._addSpacer();
570
494
  }
571
495
  this._panel.addControl(group.groupPanel);
572
496
  this._groups.push(group);
573
497
  group.groupPanel.children[0].color = this._headerColor;
574
- for (var j = 0; j < group.selectors.length; j++) {
498
+ for (let j = 0; j < group.selectors.length; j++) {
575
499
  group._setSelectorButtonColor(j, this._buttonColor);
576
500
  group._setSelectorButtonBackground(j, this._buttonBackground);
577
501
  }
578
- };
502
+ }
579
503
  /** Remove the group from the given position
580
504
  * @param groupNb is the position of the group in the list
581
505
  */
582
- SelectionPanel.prototype.removeGroup = function (groupNb) {
506
+ removeGroup(groupNb) {
583
507
  if (groupNb < 0 || groupNb >= this._groups.length) {
584
508
  return;
585
509
  }
586
- var group = this._groups[groupNb];
510
+ const group = this._groups[groupNb];
587
511
  this._panel.removeControl(group.groupPanel);
588
512
  this._groups.splice(groupNb, 1);
589
513
  if (groupNb < this._bars.length) {
590
514
  this._panel.removeControl(this._bars[groupNb]);
591
515
  this._bars.splice(groupNb, 1);
592
516
  }
593
- };
517
+ }
594
518
  /** Change a group header label
595
519
  * @param label is the new group header label
596
520
  * @param groupNb is the number of the group to relabel
597
521
  * */
598
- SelectionPanel.prototype.setHeaderName = function (label, groupNb) {
522
+ setHeaderName(label, groupNb) {
599
523
  if (groupNb < 0 || groupNb >= this._groups.length) {
600
524
  return;
601
525
  }
602
- var group = this._groups[groupNb];
526
+ const group = this._groups[groupNb];
603
527
  group.groupPanel.children[0].text = label;
604
- };
528
+ }
605
529
  /** Change selector label to the one given
606
530
  * @param label is the new selector label
607
531
  * @param groupNb is the number of the groupcontaining the selector
608
532
  * @param selectorNb is the number of the selector within a group to relabel
609
533
  * */
610
- SelectionPanel.prototype.relabel = function (label, groupNb, selectorNb) {
534
+ relabel(label, groupNb, selectorNb) {
611
535
  if (groupNb < 0 || groupNb >= this._groups.length) {
612
536
  return;
613
537
  }
614
- var group = this._groups[groupNb];
538
+ const group = this._groups[groupNb];
615
539
  if (selectorNb < 0 || selectorNb >= group.selectors.length) {
616
540
  return;
617
541
  }
618
542
  group._setSelectorLabel(selectorNb, label);
619
- };
543
+ }
620
544
  /** For a given group position remove the selector at the given position
621
545
  * @param groupNb is the number of the group to remove the selector from
622
546
  * @param selectorNb is the number of the selector within the group
623
547
  */
624
- SelectionPanel.prototype.removeFromGroupSelector = function (groupNb, selectorNb) {
548
+ removeFromGroupSelector(groupNb, selectorNb) {
625
549
  if (groupNb < 0 || groupNb >= this._groups.length) {
626
550
  return;
627
551
  }
628
- var group = this._groups[groupNb];
552
+ const group = this._groups[groupNb];
629
553
  if (selectorNb < 0 || selectorNb >= group.selectors.length) {
630
554
  return;
631
555
  }
632
556
  group.removeSelector(selectorNb);
633
- };
557
+ }
634
558
  /** For a given group position of correct type add a checkbox button
635
559
  * @param groupNb is the number of the group to remove the selector from
636
560
  * @param label is the label for the selector
637
561
  * @param func is the function called when the Selector is checked
638
562
  * @param checked is true when Selector is checked
639
563
  */
640
- SelectionPanel.prototype.addToGroupCheckbox = function (groupNb, label, func, checked) {
641
- if (func === void 0) { func = function () { }; }
642
- if (checked === void 0) { checked = false; }
564
+ addToGroupCheckbox(groupNb, label, func = () => { }, checked = false) {
643
565
  if (groupNb < 0 || groupNb >= this._groups.length) {
644
566
  return;
645
567
  }
646
- var group = this._groups[groupNb];
568
+ const group = this._groups[groupNb];
647
569
  group.addCheckbox(label, func, checked);
648
- };
570
+ }
649
571
  /** For a given group position of correct type add a radio button
650
572
  * @param groupNb is the number of the group to remove the selector from
651
573
  * @param label is the label for the selector
652
574
  * @param func is the function called when the Selector is checked
653
575
  * @param checked is true when Selector is checked
654
576
  */
655
- SelectionPanel.prototype.addToGroupRadio = function (groupNb, label, func, checked) {
656
- if (func === void 0) { func = function () { }; }
657
- if (checked === void 0) { checked = false; }
577
+ addToGroupRadio(groupNb, label, func = () => { }, checked = false) {
658
578
  if (groupNb < 0 || groupNb >= this._groups.length) {
659
579
  return;
660
580
  }
661
- var group = this._groups[groupNb];
581
+ const group = this._groups[groupNb];
662
582
  group.addRadio(label, func, checked);
663
- };
583
+ }
664
584
  /**
665
585
  * For a given slider group add a slider
666
586
  * @param groupNb is the number of the group to add the slider to
@@ -672,22 +592,14 @@ var SelectionPanel = /** @class */ (function (_super) {
672
592
  * @param value is the start value for the Slider between min and max
673
593
  * @param onVal is the function used to format the value displayed, eg radians to degrees
674
594
  */
675
- SelectionPanel.prototype.addToGroupSlider = function (groupNb, label, func, unit, min, max, value, onVal) {
676
- if (func === void 0) { func = function () { }; }
677
- if (unit === void 0) { unit = "Units"; }
678
- if (min === void 0) { min = 0; }
679
- if (max === void 0) { max = 0; }
680
- if (value === void 0) { value = 0; }
681
- if (onVal === void 0) { onVal = function (v) {
682
- return v | 0;
683
- }; }
595
+ addToGroupSlider(groupNb, label, func = () => { }, unit = "Units", min = 0, max = 0, value = 0, onVal = (v) => {
596
+ return v | 0;
597
+ }) {
684
598
  if (groupNb < 0 || groupNb >= this._groups.length) {
685
599
  return;
686
600
  }
687
- var group = this._groups[groupNb];
601
+ const group = this._groups[groupNb];
688
602
  group.addSlider(label, func, unit, min, max, value, onVal);
689
- };
690
- return SelectionPanel;
691
- }(Rectangle));
692
- export { SelectionPanel };
603
+ }
604
+ }
693
605
  //# sourceMappingURL=selector.js.map