@babylonjs/gui 5.0.0-rc.7 → 5.0.1

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 (277) hide show
  1. package/2D/adtInstrumentation.d.ts +52 -52
  2. package/2D/adtInstrumentation.js +126 -126
  3. package/2D/adtInstrumentation.js.map +1 -1
  4. package/2D/advancedDynamicTexture.d.ts +449 -448
  5. package/2D/advancedDynamicTexture.js +1318 -1318
  6. package/2D/advancedDynamicTexture.js.map +1 -1
  7. package/2D/controls/button.d.ts +135 -135
  8. package/2D/controls/button.js +276 -276
  9. package/2D/controls/button.js.map +1 -1
  10. package/2D/controls/checkbox.d.ts +59 -59
  11. package/2D/controls/checkbox.js +188 -188
  12. package/2D/controls/checkbox.js.map +1 -1
  13. package/2D/controls/colorpicker.d.ts +103 -103
  14. package/2D/controls/colorpicker.js +1417 -1417
  15. package/2D/controls/colorpicker.js.map +1 -1
  16. package/2D/controls/container.d.ts +175 -175
  17. package/2D/controls/container.js +570 -570
  18. package/2D/controls/container.js.map +1 -1
  19. package/2D/controls/control.d.ts +866 -866
  20. package/2D/controls/control.js +2433 -2433
  21. package/2D/controls/control.js.map +1 -1
  22. package/2D/controls/displayGrid.d.ts +53 -53
  23. package/2D/controls/displayGrid.js +245 -245
  24. package/2D/controls/displayGrid.js.map +1 -1
  25. package/2D/controls/ellipse.d.ts +21 -21
  26. package/2D/controls/ellipse.js +85 -85
  27. package/2D/controls/ellipse.js.map +1 -1
  28. package/2D/controls/focusableButton.d.ts +59 -59
  29. package/2D/controls/focusableButton.js +99 -99
  30. package/2D/controls/focusableButton.js.map +1 -1
  31. package/2D/controls/focusableControl.d.ts +34 -34
  32. package/2D/controls/focusableControl.js +1 -1
  33. package/2D/controls/focusableControl.js.map +1 -1
  34. package/2D/controls/grid.d.ts +139 -139
  35. package/2D/controls/grid.js +529 -529
  36. package/2D/controls/grid.js.map +1 -1
  37. package/2D/controls/image.d.ts +204 -204
  38. package/2D/controls/image.js +887 -887
  39. package/2D/controls/image.js.map +1 -1
  40. package/2D/controls/index.d.ts +29 -29
  41. package/2D/controls/index.js +29 -29
  42. package/2D/controls/inputPassword.d.ts +9 -8
  43. package/2D/controls/inputPassword.js +28 -25
  44. package/2D/controls/inputPassword.js.map +1 -1
  45. package/2D/controls/inputText.d.ts +201 -201
  46. package/2D/controls/inputText.js +1119 -1119
  47. package/2D/controls/inputText.js.map +1 -1
  48. package/2D/controls/line.d.ts +66 -66
  49. package/2D/controls/line.js +271 -271
  50. package/2D/controls/line.js.map +1 -1
  51. package/2D/controls/multiLine.d.ts +75 -75
  52. package/2D/controls/multiLine.js +262 -262
  53. package/2D/controls/multiLine.js.map +1 -1
  54. package/2D/controls/radioButton.d.ts +49 -49
  55. package/2D/controls/radioButton.js +205 -205
  56. package/2D/controls/radioButton.js.map +1 -1
  57. package/2D/controls/rectangle.d.ts +29 -29
  58. package/2D/controls/rectangle.js +150 -150
  59. package/2D/controls/rectangle.js.map +1 -1
  60. package/2D/controls/scrollViewers/scrollViewer.d.ts +182 -182
  61. package/2D/controls/scrollViewers/scrollViewer.js +677 -677
  62. package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
  63. package/2D/controls/scrollViewers/scrollViewerWindow.d.ts +57 -57
  64. package/2D/controls/scrollViewers/scrollViewerWindow.js +278 -278
  65. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  66. package/2D/controls/selector.d.ts +263 -263
  67. package/2D/controls/selector.js +692 -692
  68. package/2D/controls/sliders/baseSlider.d.ts +82 -82
  69. package/2D/controls/sliders/baseSlider.js +347 -347
  70. package/2D/controls/sliders/baseSlider.js.map +1 -1
  71. package/2D/controls/sliders/imageBasedSlider.d.ts +49 -49
  72. package/2D/controls/sliders/imageBasedSlider.js +192 -192
  73. package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
  74. package/2D/controls/sliders/imageScrollBar.d.ts +65 -65
  75. package/2D/controls/sliders/imageScrollBar.js +263 -263
  76. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  77. package/2D/controls/sliders/scrollBar.d.ts +38 -38
  78. package/2D/controls/sliders/scrollBar.js +143 -143
  79. package/2D/controls/sliders/scrollBar.js.map +1 -1
  80. package/2D/controls/sliders/slider.d.ts +35 -35
  81. package/2D/controls/sliders/slider.js +271 -271
  82. package/2D/controls/sliders/slider.js.map +1 -1
  83. package/2D/controls/stackPanel.d.ts +64 -64
  84. package/2D/controls/stackPanel.js +246 -246
  85. package/2D/controls/stackPanel.js.map +1 -1
  86. package/2D/controls/statics.d.ts +6 -6
  87. package/2D/controls/statics.js +49 -49
  88. package/2D/controls/textBlock.d.ts +175 -175
  89. package/2D/controls/textBlock.js +603 -603
  90. package/2D/controls/textBlock.js.map +1 -1
  91. package/2D/controls/textWrapper.d.ts +13 -13
  92. package/2D/controls/textWrapper.js +101 -101
  93. package/2D/controls/toggleButton.d.ts +117 -117
  94. package/2D/controls/toggleButton.js +268 -268
  95. package/2D/controls/toggleButton.js.map +1 -1
  96. package/2D/controls/virtualKeyboard.d.ts +96 -96
  97. package/2D/controls/virtualKeyboard.js +256 -256
  98. package/2D/controls/virtualKeyboard.js.map +1 -1
  99. package/2D/index.d.ts +9 -9
  100. package/2D/index.js +10 -9
  101. package/2D/index.js.map +1 -1
  102. package/2D/math2D.d.ts +117 -117
  103. package/2D/math2D.js +221 -221
  104. package/2D/math2D.js.map +1 -1
  105. package/2D/measure.d.ts +77 -77
  106. package/2D/measure.js +139 -139
  107. package/2D/measure.js.map +1 -1
  108. package/2D/multiLinePoint.d.ts +47 -47
  109. package/2D/multiLinePoint.js +127 -127
  110. package/2D/multiLinePoint.js.map +1 -1
  111. package/2D/style.d.ts +46 -46
  112. package/2D/style.js +97 -97
  113. package/2D/style.js.map +1 -1
  114. package/2D/valueAndUnit.d.ts +89 -89
  115. package/2D/valueAndUnit.js +226 -226
  116. package/2D/valueAndUnit.js.map +1 -1
  117. package/2D/xmlLoader.d.ts +60 -60
  118. package/2D/xmlLoader.js +348 -348
  119. package/2D/xmlLoader.js.map +1 -1
  120. package/3D/behaviors/defaultBehavior.d.ts +73 -73
  121. package/3D/behaviors/defaultBehavior.js +121 -121
  122. package/3D/behaviors/defaultBehavior.js.map +1 -1
  123. package/3D/controls/abstractButton3D.d.ts +15 -15
  124. package/3D/controls/abstractButton3D.js +25 -25
  125. package/3D/controls/abstractButton3D.js.map +1 -1
  126. package/3D/controls/button3D.d.ts +30 -30
  127. package/3D/controls/button3D.js +93 -93
  128. package/3D/controls/button3D.js.map +1 -1
  129. package/3D/controls/container3D.d.ts +72 -72
  130. package/3D/controls/container3D.js +139 -139
  131. package/3D/controls/container3D.js.map +1 -1
  132. package/3D/controls/contentDisplay3D.d.ts +30 -30
  133. package/3D/controls/contentDisplay3D.js +79 -79
  134. package/3D/controls/contentDisplay3D.js.map +1 -1
  135. package/3D/controls/control3D.d.ts +201 -201
  136. package/3D/controls/control3D.js +445 -445
  137. package/3D/controls/control3D.js.map +1 -1
  138. package/3D/controls/cylinderPanel.d.ts +17 -17
  139. package/3D/controls/cylinderPanel.js +66 -66
  140. package/3D/controls/cylinderPanel.js.map +1 -1
  141. package/3D/controls/handMenu.d.ts +28 -28
  142. package/3D/controls/handMenu.js +47 -47
  143. package/3D/controls/handMenu.js.map +1 -1
  144. package/3D/controls/holographicBackplate.d.ts +49 -49
  145. package/3D/controls/holographicBackplate.js +120 -120
  146. package/3D/controls/holographicBackplate.js.map +1 -1
  147. package/3D/controls/holographicButton.d.ts +84 -84
  148. package/3D/controls/holographicButton.js +339 -339
  149. package/3D/controls/holographicButton.js.map +1 -1
  150. package/3D/controls/holographicSlate.d.ts +131 -131
  151. package/3D/controls/holographicSlate.js +431 -431
  152. package/3D/controls/holographicSlate.js.map +1 -1
  153. package/3D/controls/index.d.ts +21 -21
  154. package/3D/controls/index.js +21 -21
  155. package/3D/controls/meshButton3D.d.ts +21 -21
  156. package/3D/controls/meshButton3D.js +62 -62
  157. package/3D/controls/meshButton3D.js.map +1 -1
  158. package/3D/controls/nearMenu.d.ts +44 -44
  159. package/3D/controls/nearMenu.js +114 -114
  160. package/3D/controls/nearMenu.js.map +1 -1
  161. package/3D/controls/planePanel.d.ts +9 -9
  162. package/3D/controls/planePanel.js +36 -36
  163. package/3D/controls/planePanel.js.map +1 -1
  164. package/3D/controls/scatterPanel.d.ts +18 -18
  165. package/3D/controls/scatterPanel.js +108 -108
  166. package/3D/controls/scatterPanel.js.map +1 -1
  167. package/3D/controls/slider3D.d.ts +81 -81
  168. package/3D/controls/slider3D.js +268 -268
  169. package/3D/controls/slider3D.js.map +1 -1
  170. package/3D/controls/spherePanel.d.ts +17 -17
  171. package/3D/controls/spherePanel.js +67 -67
  172. package/3D/controls/spherePanel.js.map +1 -1
  173. package/3D/controls/stackPanel3D.d.ts +22 -22
  174. package/3D/controls/stackPanel3D.js +107 -107
  175. package/3D/controls/touchButton3D.d.ts +80 -80
  176. package/3D/controls/touchButton3D.js +233 -233
  177. package/3D/controls/touchButton3D.js.map +1 -1
  178. package/3D/controls/touchHolographicButton.d.ts +110 -110
  179. package/3D/controls/touchHolographicButton.js +445 -445
  180. package/3D/controls/touchHolographicButton.js.map +1 -1
  181. package/3D/controls/touchHolographicMenu.d.ts +61 -61
  182. package/3D/controls/touchHolographicMenu.js +149 -149
  183. package/3D/controls/touchHolographicMenu.js.map +1 -1
  184. package/3D/controls/touchMeshButton3D.d.ts +21 -21
  185. package/3D/controls/touchMeshButton3D.js +62 -62
  186. package/3D/controls/touchMeshButton3D.js.map +1 -1
  187. package/3D/controls/volumeBasedPanel.d.ts +53 -53
  188. package/3D/controls/volumeBasedPanel.js +174 -174
  189. package/3D/controls/volumeBasedPanel.js.map +1 -1
  190. package/3D/gizmos/gizmoHandle.d.ts +108 -108
  191. package/3D/gizmos/gizmoHandle.js +209 -209
  192. package/3D/gizmos/gizmoHandle.js.map +1 -1
  193. package/3D/gizmos/index.d.ts +2 -2
  194. package/3D/gizmos/index.js +2 -2
  195. package/3D/gizmos/slateGizmo.d.ts +57 -57
  196. package/3D/gizmos/slateGizmo.js +369 -369
  197. package/3D/gizmos/slateGizmo.js.map +1 -1
  198. package/3D/gui3DManager.d.ts +94 -94
  199. package/3D/gui3DManager.js +257 -257
  200. package/3D/gui3DManager.js.map +1 -1
  201. package/3D/index.d.ts +5 -5
  202. package/3D/index.js +6 -5
  203. package/3D/index.js.map +1 -1
  204. package/3D/materials/fluent/fluentMaterial.d.ts +91 -90
  205. package/3D/materials/fluent/fluentMaterial.js +292 -292
  206. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  207. package/3D/materials/fluent/index.d.ts +1 -1
  208. package/3D/materials/fluent/index.js +1 -1
  209. package/3D/materials/fluent/shaders/fluent.fragment.d.ts +5 -5
  210. package/3D/materials/fluent/shaders/fluent.fragment.js +8 -8
  211. package/3D/materials/fluent/shaders/fluent.vertex.d.ts +5 -5
  212. package/3D/materials/fluent/shaders/fluent.vertex.js +8 -8
  213. package/3D/materials/fluentBackplate/fluentBackplateMaterial.d.ts +155 -154
  214. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +469 -469
  215. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  216. package/3D/materials/fluentBackplate/index.d.ts +1 -1
  217. package/3D/materials/fluentBackplate/index.js +1 -1
  218. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.d.ts +5 -5
  219. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +8 -8
  220. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.d.ts +5 -5
  221. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +8 -8
  222. package/3D/materials/fluentButton/fluentButtonMaterial.d.ts +190 -189
  223. package/3D/materials/fluentButton/fluentButtonMaterial.js +539 -539
  224. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  225. package/3D/materials/fluentButton/index.d.ts +1 -1
  226. package/3D/materials/fluentButton/index.js +1 -1
  227. package/3D/materials/fluentButton/shaders/fluentButton.fragment.d.ts +5 -5
  228. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +8 -8
  229. package/3D/materials/fluentButton/shaders/fluentButton.vertex.d.ts +5 -5
  230. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +8 -8
  231. package/3D/materials/fluentMaterial.d.ts +4 -4
  232. package/3D/materials/fluentMaterial.js +4 -4
  233. package/3D/materials/handle/handleMaterial.d.ts +68 -68
  234. package/3D/materials/handle/handleMaterial.js +126 -126
  235. package/3D/materials/handle/handleMaterial.js.map +1 -1
  236. package/3D/materials/handle/index.d.ts +1 -1
  237. package/3D/materials/handle/index.js +1 -1
  238. package/3D/materials/handle/shaders/handle.fragment.d.ts +5 -5
  239. package/3D/materials/handle/shaders/handle.fragment.js +8 -8
  240. package/3D/materials/handle/shaders/handle.vertex.d.ts +5 -5
  241. package/3D/materials/handle/shaders/handle.vertex.js +8 -8
  242. package/3D/materials/index.d.ts +5 -5
  243. package/3D/materials/index.js +6 -5
  244. package/3D/materials/index.js.map +1 -1
  245. package/3D/materials/mrdl/index.d.ts +3 -3
  246. package/3D/materials/mrdl/index.js +3 -3
  247. package/3D/materials/mrdl/mrdlBackplateMaterial.d.ts +148 -147
  248. package/3D/materials/mrdl/mrdlBackplateMaterial.js +436 -436
  249. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  250. package/3D/materials/mrdl/mrdlSliderBarMaterial.d.ts +334 -333
  251. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +851 -851
  252. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  253. package/3D/materials/mrdl/mrdlSliderThumbMaterial.d.ts +334 -333
  254. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +851 -851
  255. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  256. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.d.ts +5 -5
  257. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +8 -8
  258. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.d.ts +5 -5
  259. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +8 -8
  260. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.d.ts +5 -5
  261. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +8 -8
  262. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.d.ts +5 -5
  263. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +8 -8
  264. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.d.ts +5 -5
  265. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +8 -8
  266. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.d.ts +5 -5
  267. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +8 -8
  268. package/3D/vector3WithInfo.d.ts +16 -16
  269. package/3D/vector3WithInfo.js +23 -23
  270. package/index.d.ts +2 -2
  271. package/index.js +3 -2
  272. package/index.js.map +1 -1
  273. package/legacy/legacy.d.ts +1 -1
  274. package/legacy/legacy.js +14 -13
  275. package/legacy/legacy.js.map +1 -1
  276. package/license.md +71 -0
  277. package/package.json +24 -5
@@ -1,693 +1,693 @@
1
- import { __extends } from "tslib";
2
- import { Rectangle } from "./rectangle.js";
3
- import { StackPanel } from "./stackPanel.js";
4
- import { Control } from "./control.js";
5
- import { TextBlock } from "./textBlock.js";
6
- import { Checkbox } from "./checkbox.js";
7
- import { RadioButton } from "./radioButton.js";
8
- import { Slider } from "./sliders/slider.js";
9
- import { Container } from "./container.js";
10
- /** Class used to create a RadioGroup
11
- * which contains groups of radio buttons
12
- */
13
- var SelectorGroup = /** @class */ (function () {
14
- /**
15
- * Creates a new SelectorGroup
16
- * @param name of group, used as a group heading
17
- */
18
- function SelectorGroup(
19
- /** name of SelectorGroup */
20
- name) {
21
- this.name = name;
22
- this._groupPanel = new StackPanel();
23
- this._selectors = new Array();
24
- this._groupPanel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
25
- this._groupPanel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
26
- this._groupHeader = this._addGroupHeader(name);
27
- }
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
- });
58
- /**
59
- * @param text
60
- * @hidden
61
- */
62
- SelectorGroup.prototype._addGroupHeader = function (text) {
63
- var groupHeading = new TextBlock("groupHead", text);
64
- groupHeading.width = 0.9;
65
- groupHeading.height = "30px";
66
- groupHeading.textWrapping = true;
67
- groupHeading.color = "black";
68
- groupHeading.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
69
- groupHeading.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
70
- groupHeading.left = "2px";
71
- this._groupPanel.addControl(groupHeading);
72
- return groupHeading;
73
- };
74
- /**
75
- * @param selectorNb
76
- * @hidden
77
- */
78
- SelectorGroup.prototype._getSelector = function (selectorNb) {
79
- if (selectorNb < 0 || selectorNb >= this._selectors.length) {
80
- return;
81
- }
82
- return this._selectors[selectorNb];
83
- };
84
- /** Removes the selector at the given position
85
- * @param selectorNb the position of the selector within the group
86
- */
87
- SelectorGroup.prototype.removeSelector = function (selectorNb) {
88
- if (selectorNb < 0 || selectorNb >= this._selectors.length) {
89
- return;
90
- }
91
- this._groupPanel.removeControl(this._selectors[selectorNb]);
92
- this._selectors.splice(selectorNb, 1);
93
- };
94
- return SelectorGroup;
95
- }());
96
- export { SelectorGroup };
97
- /** Class used to create a CheckboxGroup
98
- * which contains groups of checkbox buttons
99
- */
100
- var CheckboxGroup = /** @class */ (function (_super) {
101
- __extends(CheckboxGroup, _super);
102
- function CheckboxGroup() {
103
- return _super !== null && _super.apply(this, arguments) || this;
104
- }
105
- /** Adds a checkbox as a control
106
- * @param text is the label for the selector
107
- * @param func is the function called when the Selector is checked
108
- * @param checked is true when Selector is checked
109
- */
110
- // 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; }
114
- checked = checked || false;
115
- var button = new Checkbox();
116
- button.width = "20px";
117
- button.height = "20px";
118
- button.color = "#364249";
119
- button.background = "#CCCCCC";
120
- button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
121
- button.onIsCheckedChangedObservable.add(function (state) {
122
- func(state);
123
- });
124
- var _selector = Control.AddHeader(button, text, "200px", { isHorizontal: true, controlFirst: true });
125
- _selector.height = "30px";
126
- _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
127
- _selector.left = "4px";
128
- this.groupPanel.addControl(_selector);
129
- this.selectors.push(_selector);
130
- button.isChecked = checked;
131
- if (this.groupPanel.parent && this.groupPanel.parent.parent) {
132
- button.color = this.groupPanel.parent.parent.buttonColor;
133
- button.background = this.groupPanel.parent.parent.buttonBackground;
134
- }
135
- };
136
- /**
137
- * @param selectorNb
138
- * @param label
139
- * @hidden
140
- */
141
- CheckboxGroup.prototype._setSelectorLabel = function (selectorNb, label) {
142
- this.selectors[selectorNb].children[1].text = label;
143
- };
144
- /**
145
- * @param selectorNb
146
- * @param color
147
- * @hidden
148
- */
149
- CheckboxGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
150
- this.selectors[selectorNb].children[1].color = color;
151
- };
152
- /**
153
- * @param selectorNb
154
- * @param color
155
- * @hidden
156
- */
157
- CheckboxGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
158
- this.selectors[selectorNb].children[0].color = color;
159
- };
160
- /**
161
- * @param selectorNb
162
- * @param color
163
- * @hidden
164
- */
165
- CheckboxGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
166
- this.selectors[selectorNb].children[0].background = color;
167
- };
168
- return CheckboxGroup;
169
- }(SelectorGroup));
170
- export { CheckboxGroup };
171
- /** Class used to create a RadioGroup
172
- * which contains groups of radio buttons
173
- */
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;
180
- }
181
- /** Adds a radio button as a control
182
- * @param label is the label for the selector
183
- * @param func is the function called when the Selector is checked
184
- * @param checked is true when Selector is checked
185
- */
186
- // 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();
192
- button.name = label;
193
- button.width = "20px";
194
- button.height = "20px";
195
- button.color = "#364249";
196
- button.background = "#CCCCCC";
197
- button.group = this.name;
198
- button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
199
- button.onIsCheckedChangedObservable.add(function (state) {
200
- if (state) {
201
- func(nb);
202
- }
203
- });
204
- var _selector = Control.AddHeader(button, label, "200px", { isHorizontal: true, controlFirst: true });
205
- _selector.height = "30px";
206
- _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
207
- _selector.left = "4px";
208
- this.groupPanel.addControl(_selector);
209
- this.selectors.push(_selector);
210
- button.isChecked = checked;
211
- if (this.groupPanel.parent && this.groupPanel.parent.parent) {
212
- button.color = this.groupPanel.parent.parent.buttonColor;
213
- button.background = this.groupPanel.parent.parent.buttonBackground;
214
- }
215
- };
216
- /**
217
- * @param selectorNb
218
- * @param label
219
- * @hidden
220
- */
221
- RadioGroup.prototype._setSelectorLabel = function (selectorNb, label) {
222
- this.selectors[selectorNb].children[1].text = label;
223
- };
224
- /**
225
- * @param selectorNb
226
- * @param color
227
- * @hidden
228
- */
229
- RadioGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
230
- this.selectors[selectorNb].children[1].color = color;
231
- };
232
- /**
233
- * @param selectorNb
234
- * @param color
235
- * @hidden
236
- */
237
- RadioGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
238
- this.selectors[selectorNb].children[0].color = color;
239
- };
240
- /**
241
- * @param selectorNb
242
- * @param color
243
- * @hidden
244
- */
245
- RadioGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
246
- this.selectors[selectorNb].children[0].background = color;
247
- };
248
- return RadioGroup;
249
- }(SelectorGroup));
250
- export { RadioGroup };
251
- /** Class used to create a SliderGroup
252
- * which contains groups of slider buttons
253
- */
254
- var SliderGroup = /** @class */ (function (_super) {
255
- __extends(SliderGroup, _super);
256
- function SliderGroup() {
257
- return _super !== null && _super.apply(this, arguments) || this;
258
- }
259
- /**
260
- * Adds a slider to the SelectorGroup
261
- * @param label is the label for the SliderBar
262
- * @param func is the function called when the Slider moves
263
- * @param unit is a string describing the units used, eg degrees or metres
264
- * @param min is the minimum value for the Slider
265
- * @param max is the maximum value for the Slider
266
- * @param value is the start value for the Slider between min and max
267
- * @param onValueChange is the function used to format the value displayed, eg radians to degrees
268
- */
269
- SliderGroup.prototype.addSlider = function (label,
270
- // 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();
281
- button.name = unit;
282
- button.value = value;
283
- button.minimum = min;
284
- button.maximum = max;
285
- button.width = 0.9;
286
- button.height = "20px";
287
- button.color = "#364249";
288
- button.background = "#CCCCCC";
289
- button.borderColor = "black";
290
- button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
291
- button.left = "4px";
292
- button.paddingBottom = "4px";
293
- button.onValueChangedObservable.add(function (value) {
294
- button.parent.children[0].text = button.parent.children[0].name + ": " + onValueChange(value) + " " + button.name;
295
- func(value);
296
- });
297
- var _selector = Control.AddHeader(button, label + ": " + onValueChange(value) + " " + unit, "30px", { isHorizontal: false, controlFirst: false });
298
- _selector.height = "60px";
299
- _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
300
- _selector.left = "4px";
301
- _selector.children[0].name = label;
302
- this.groupPanel.addControl(_selector);
303
- this.selectors.push(_selector);
304
- if (this.groupPanel.parent && this.groupPanel.parent.parent) {
305
- button.color = this.groupPanel.parent.parent.buttonColor;
306
- button.background = this.groupPanel.parent.parent.buttonBackground;
307
- }
308
- };
309
- /**
310
- * @param selectorNb
311
- * @param label
312
- * @hidden
313
- */
314
- SliderGroup.prototype._setSelectorLabel = function (selectorNb, label) {
315
- this.selectors[selectorNb].children[0].name = label;
316
- this.selectors[selectorNb].children[0].text =
317
- label + ": " + this.selectors[selectorNb].children[1].value + " " + this.selectors[selectorNb].children[1].name;
318
- };
319
- /**
320
- * @param selectorNb
321
- * @param color
322
- * @hidden
323
- */
324
- SliderGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
325
- this.selectors[selectorNb].children[0].color = color;
326
- };
327
- /**
328
- * @param selectorNb
329
- * @param color
330
- * @hidden
331
- */
332
- SliderGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
333
- this.selectors[selectorNb].children[1].color = color;
334
- };
335
- /**
336
- * @param selectorNb
337
- * @param color
338
- * @hidden
339
- */
340
- SliderGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
341
- this.selectors[selectorNb].children[1].background = color;
342
- };
343
- return SliderGroup;
344
- }(SelectorGroup));
345
- export { SliderGroup };
346
- /** Class used to hold the controls for the checkboxes, radio buttons and sliders
347
- * @see https://doc.babylonjs.com/how_to/selector
348
- */
349
- var SelectionPanel = /** @class */ (function (_super) {
350
- __extends(SelectionPanel, _super);
351
- /**
352
- * Creates a new SelectionPanel
353
- * @param name of SelectionPanel
354
- * @param groups is an array of SelectionGroups
355
- */
356
- function SelectionPanel(
357
- /** name of SelectionPanel */
358
- name,
359
- /** 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;
380
- if (groups.length > 0) {
381
- for (var i = 0; i < groups.length - 1; i++) {
382
- _this._panel.addControl(groups[i].groupPanel);
383
- _this._addSpacer();
384
- }
385
- _this._panel.addControl(groups[groups.length - 1].groupPanel);
386
- }
387
- _this.addControl(_this._panel);
388
- return _this;
389
- }
390
- SelectionPanel.prototype._getTypeName = function () {
391
- 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++) {
418
- this._groups[i].groupPanel.children[0].color = this._headerColor;
419
- }
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++) {
439
- this._groups[i]._setSelectorButtonColor(j, this._buttonColor);
440
- }
441
- }
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++) {
461
- this._groups[i]._setSelectorLabelColor(j, this._labelColor);
462
- }
463
- }
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++) {
483
- this._groups[i]._setSelectorButtonBackground(j, this._buttonBackground);
484
- }
485
- }
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++) {
504
- this._bars[i].children[0].background = this._barColor;
505
- }
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++) {
524
- this._bars[i].children[0].height = this._barHeight;
525
- }
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++) {
544
- this._bars[i].height = this._spacerHeight;
545
- }
546
- };
547
- /** Adds a bar between groups */
548
- SelectionPanel.prototype._addSpacer = function () {
549
- var separator = new Container();
550
- separator.width = 1;
551
- separator.height = this._spacerHeight;
552
- separator.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
553
- var bar = new Rectangle();
554
- bar.width = 1;
555
- bar.height = this._barHeight;
556
- bar.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
557
- bar.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
558
- bar.background = this._barColor;
559
- bar.color = "transparent";
560
- separator.addControl(bar);
561
- this._panel.addControl(separator);
562
- this._bars.push(separator);
563
- };
564
- /** Add a group to the selection panel
565
- * @param group is the selector group to add
566
- */
567
- SelectionPanel.prototype.addGroup = function (group) {
568
- if (this._groups.length > 0) {
569
- this._addSpacer();
570
- }
571
- this._panel.addControl(group.groupPanel);
572
- this._groups.push(group);
573
- group.groupPanel.children[0].color = this._headerColor;
574
- for (var j = 0; j < group.selectors.length; j++) {
575
- group._setSelectorButtonColor(j, this._buttonColor);
576
- group._setSelectorButtonBackground(j, this._buttonBackground);
577
- }
578
- };
579
- /** Remove the group from the given position
580
- * @param groupNb is the position of the group in the list
581
- */
582
- SelectionPanel.prototype.removeGroup = function (groupNb) {
583
- if (groupNb < 0 || groupNb >= this._groups.length) {
584
- return;
585
- }
586
- var group = this._groups[groupNb];
587
- this._panel.removeControl(group.groupPanel);
588
- this._groups.splice(groupNb, 1);
589
- if (groupNb < this._bars.length) {
590
- this._panel.removeControl(this._bars[groupNb]);
591
- this._bars.splice(groupNb, 1);
592
- }
593
- };
594
- /** Change a group header label
595
- * @param label is the new group header label
596
- * @param groupNb is the number of the group to relabel
597
- * */
598
- SelectionPanel.prototype.setHeaderName = function (label, groupNb) {
599
- if (groupNb < 0 || groupNb >= this._groups.length) {
600
- return;
601
- }
602
- var group = this._groups[groupNb];
603
- group.groupPanel.children[0].text = label;
604
- };
605
- /** Change selector label to the one given
606
- * @param label is the new selector label
607
- * @param groupNb is the number of the groupcontaining the selector
608
- * @param selectorNb is the number of the selector within a group to relabel
609
- * */
610
- SelectionPanel.prototype.relabel = function (label, groupNb, selectorNb) {
611
- if (groupNb < 0 || groupNb >= this._groups.length) {
612
- return;
613
- }
614
- var group = this._groups[groupNb];
615
- if (selectorNb < 0 || selectorNb >= group.selectors.length) {
616
- return;
617
- }
618
- group._setSelectorLabel(selectorNb, label);
619
- };
620
- /** For a given group position remove the selector at the given position
621
- * @param groupNb is the number of the group to remove the selector from
622
- * @param selectorNb is the number of the selector within the group
623
- */
624
- SelectionPanel.prototype.removeFromGroupSelector = function (groupNb, selectorNb) {
625
- if (groupNb < 0 || groupNb >= this._groups.length) {
626
- return;
627
- }
628
- var group = this._groups[groupNb];
629
- if (selectorNb < 0 || selectorNb >= group.selectors.length) {
630
- return;
631
- }
632
- group.removeSelector(selectorNb);
633
- };
634
- /** For a given group position of correct type add a checkbox button
635
- * @param groupNb is the number of the group to remove the selector from
636
- * @param label is the label for the selector
637
- * @param func is the function called when the Selector is checked
638
- * @param checked is true when Selector is checked
639
- */
640
- SelectionPanel.prototype.addToGroupCheckbox = function (groupNb, label, func, checked) {
641
- if (func === void 0) { func = function () { }; }
642
- if (checked === void 0) { checked = false; }
643
- if (groupNb < 0 || groupNb >= this._groups.length) {
644
- return;
645
- }
646
- var group = this._groups[groupNb];
647
- group.addCheckbox(label, func, checked);
648
- };
649
- /** For a given group position of correct type add a radio button
650
- * @param groupNb is the number of the group to remove the selector from
651
- * @param label is the label for the selector
652
- * @param func is the function called when the Selector is checked
653
- * @param checked is true when Selector is checked
654
- */
655
- SelectionPanel.prototype.addToGroupRadio = function (groupNb, label, func, checked) {
656
- if (func === void 0) { func = function () { }; }
657
- if (checked === void 0) { checked = false; }
658
- if (groupNb < 0 || groupNb >= this._groups.length) {
659
- return;
660
- }
661
- var group = this._groups[groupNb];
662
- group.addRadio(label, func, checked);
663
- };
664
- /**
665
- * For a given slider group add a slider
666
- * @param groupNb is the number of the group to add the slider to
667
- * @param label is the label for the Slider
668
- * @param func is the function called when the Slider moves
669
- * @param unit is a string describing the units used, eg degrees or metres
670
- * @param min is the minimum value for the Slider
671
- * @param max is the maximum value for the Slider
672
- * @param value is the start value for the Slider between min and max
673
- * @param onVal is the function used to format the value displayed, eg radians to degrees
674
- */
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
- }; }
684
- if (groupNb < 0 || groupNb >= this._groups.length) {
685
- return;
686
- }
687
- var group = this._groups[groupNb];
688
- group.addSlider(label, func, unit, min, max, value, onVal);
689
- };
690
- return SelectionPanel;
691
- }(Rectangle));
692
- export { SelectionPanel };
1
+ import { __extends } from "tslib";
2
+ import { Rectangle } from "./rectangle.js";
3
+ import { StackPanel } from "./stackPanel.js";
4
+ import { Control } from "./control.js";
5
+ import { TextBlock } from "./textBlock.js";
6
+ import { Checkbox } from "./checkbox.js";
7
+ import { RadioButton } from "./radioButton.js";
8
+ import { Slider } from "./sliders/slider.js";
9
+ import { Container } from "./container.js";
10
+ /** Class used to create a RadioGroup
11
+ * which contains groups of radio buttons
12
+ */
13
+ var SelectorGroup = /** @class */ (function () {
14
+ /**
15
+ * Creates a new SelectorGroup
16
+ * @param name of group, used as a group heading
17
+ */
18
+ function SelectorGroup(
19
+ /** name of SelectorGroup */
20
+ name) {
21
+ this.name = name;
22
+ this._groupPanel = new StackPanel();
23
+ this._selectors = new Array();
24
+ this._groupPanel.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
25
+ this._groupPanel.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
26
+ this._groupHeader = this._addGroupHeader(name);
27
+ }
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
+ });
58
+ /**
59
+ * @param text
60
+ * @hidden
61
+ */
62
+ SelectorGroup.prototype._addGroupHeader = function (text) {
63
+ var groupHeading = new TextBlock("groupHead", text);
64
+ groupHeading.width = 0.9;
65
+ groupHeading.height = "30px";
66
+ groupHeading.textWrapping = true;
67
+ groupHeading.color = "black";
68
+ groupHeading.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
69
+ groupHeading.textHorizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
70
+ groupHeading.left = "2px";
71
+ this._groupPanel.addControl(groupHeading);
72
+ return groupHeading;
73
+ };
74
+ /**
75
+ * @param selectorNb
76
+ * @hidden
77
+ */
78
+ SelectorGroup.prototype._getSelector = function (selectorNb) {
79
+ if (selectorNb < 0 || selectorNb >= this._selectors.length) {
80
+ return;
81
+ }
82
+ return this._selectors[selectorNb];
83
+ };
84
+ /** Removes the selector at the given position
85
+ * @param selectorNb the position of the selector within the group
86
+ */
87
+ SelectorGroup.prototype.removeSelector = function (selectorNb) {
88
+ if (selectorNb < 0 || selectorNb >= this._selectors.length) {
89
+ return;
90
+ }
91
+ this._groupPanel.removeControl(this._selectors[selectorNb]);
92
+ this._selectors.splice(selectorNb, 1);
93
+ };
94
+ return SelectorGroup;
95
+ }());
96
+ export { SelectorGroup };
97
+ /** Class used to create a CheckboxGroup
98
+ * which contains groups of checkbox buttons
99
+ */
100
+ var CheckboxGroup = /** @class */ (function (_super) {
101
+ __extends(CheckboxGroup, _super);
102
+ function CheckboxGroup() {
103
+ return _super !== null && _super.apply(this, arguments) || this;
104
+ }
105
+ /** Adds a checkbox as a control
106
+ * @param text is the label for the selector
107
+ * @param func is the function called when the Selector is checked
108
+ * @param checked is true when Selector is checked
109
+ */
110
+ // 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; }
114
+ checked = checked || false;
115
+ var button = new Checkbox();
116
+ button.width = "20px";
117
+ button.height = "20px";
118
+ button.color = "#364249";
119
+ button.background = "#CCCCCC";
120
+ button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
121
+ button.onIsCheckedChangedObservable.add(function (state) {
122
+ func(state);
123
+ });
124
+ var _selector = Control.AddHeader(button, text, "200px", { isHorizontal: true, controlFirst: true });
125
+ _selector.height = "30px";
126
+ _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
127
+ _selector.left = "4px";
128
+ this.groupPanel.addControl(_selector);
129
+ this.selectors.push(_selector);
130
+ button.isChecked = checked;
131
+ if (this.groupPanel.parent && this.groupPanel.parent.parent) {
132
+ button.color = this.groupPanel.parent.parent.buttonColor;
133
+ button.background = this.groupPanel.parent.parent.buttonBackground;
134
+ }
135
+ };
136
+ /**
137
+ * @param selectorNb
138
+ * @param label
139
+ * @hidden
140
+ */
141
+ CheckboxGroup.prototype._setSelectorLabel = function (selectorNb, label) {
142
+ this.selectors[selectorNb].children[1].text = label;
143
+ };
144
+ /**
145
+ * @param selectorNb
146
+ * @param color
147
+ * @hidden
148
+ */
149
+ CheckboxGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
150
+ this.selectors[selectorNb].children[1].color = color;
151
+ };
152
+ /**
153
+ * @param selectorNb
154
+ * @param color
155
+ * @hidden
156
+ */
157
+ CheckboxGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
158
+ this.selectors[selectorNb].children[0].color = color;
159
+ };
160
+ /**
161
+ * @param selectorNb
162
+ * @param color
163
+ * @hidden
164
+ */
165
+ CheckboxGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
166
+ this.selectors[selectorNb].children[0].background = color;
167
+ };
168
+ return CheckboxGroup;
169
+ }(SelectorGroup));
170
+ export { CheckboxGroup };
171
+ /** Class used to create a RadioGroup
172
+ * which contains groups of radio buttons
173
+ */
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;
180
+ }
181
+ /** Adds a radio button as a control
182
+ * @param label is the label for the selector
183
+ * @param func is the function called when the Selector is checked
184
+ * @param checked is true when Selector is checked
185
+ */
186
+ // 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();
192
+ button.name = label;
193
+ button.width = "20px";
194
+ button.height = "20px";
195
+ button.color = "#364249";
196
+ button.background = "#CCCCCC";
197
+ button.group = this.name;
198
+ button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
199
+ button.onIsCheckedChangedObservable.add(function (state) {
200
+ if (state) {
201
+ func(nb);
202
+ }
203
+ });
204
+ var _selector = Control.AddHeader(button, label, "200px", { isHorizontal: true, controlFirst: true });
205
+ _selector.height = "30px";
206
+ _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
207
+ _selector.left = "4px";
208
+ this.groupPanel.addControl(_selector);
209
+ this.selectors.push(_selector);
210
+ button.isChecked = checked;
211
+ if (this.groupPanel.parent && this.groupPanel.parent.parent) {
212
+ button.color = this.groupPanel.parent.parent.buttonColor;
213
+ button.background = this.groupPanel.parent.parent.buttonBackground;
214
+ }
215
+ };
216
+ /**
217
+ * @param selectorNb
218
+ * @param label
219
+ * @hidden
220
+ */
221
+ RadioGroup.prototype._setSelectorLabel = function (selectorNb, label) {
222
+ this.selectors[selectorNb].children[1].text = label;
223
+ };
224
+ /**
225
+ * @param selectorNb
226
+ * @param color
227
+ * @hidden
228
+ */
229
+ RadioGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
230
+ this.selectors[selectorNb].children[1].color = color;
231
+ };
232
+ /**
233
+ * @param selectorNb
234
+ * @param color
235
+ * @hidden
236
+ */
237
+ RadioGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
238
+ this.selectors[selectorNb].children[0].color = color;
239
+ };
240
+ /**
241
+ * @param selectorNb
242
+ * @param color
243
+ * @hidden
244
+ */
245
+ RadioGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
246
+ this.selectors[selectorNb].children[0].background = color;
247
+ };
248
+ return RadioGroup;
249
+ }(SelectorGroup));
250
+ export { RadioGroup };
251
+ /** Class used to create a SliderGroup
252
+ * which contains groups of slider buttons
253
+ */
254
+ var SliderGroup = /** @class */ (function (_super) {
255
+ __extends(SliderGroup, _super);
256
+ function SliderGroup() {
257
+ return _super !== null && _super.apply(this, arguments) || this;
258
+ }
259
+ /**
260
+ * Adds a slider to the SelectorGroup
261
+ * @param label is the label for the SliderBar
262
+ * @param func is the function called when the Slider moves
263
+ * @param unit is a string describing the units used, eg degrees or metres
264
+ * @param min is the minimum value for the Slider
265
+ * @param max is the maximum value for the Slider
266
+ * @param value is the start value for the Slider between min and max
267
+ * @param onValueChange is the function used to format the value displayed, eg radians to degrees
268
+ */
269
+ SliderGroup.prototype.addSlider = function (label,
270
+ // 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();
281
+ button.name = unit;
282
+ button.value = value;
283
+ button.minimum = min;
284
+ button.maximum = max;
285
+ button.width = 0.9;
286
+ button.height = "20px";
287
+ button.color = "#364249";
288
+ button.background = "#CCCCCC";
289
+ button.borderColor = "black";
290
+ button.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
291
+ button.left = "4px";
292
+ button.paddingBottom = "4px";
293
+ button.onValueChangedObservable.add(function (value) {
294
+ button.parent.children[0].text = button.parent.children[0].name + ": " + onValueChange(value) + " " + button.name;
295
+ func(value);
296
+ });
297
+ var _selector = Control.AddHeader(button, label + ": " + onValueChange(value) + " " + unit, "30px", { isHorizontal: false, controlFirst: false });
298
+ _selector.height = "60px";
299
+ _selector.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
300
+ _selector.left = "4px";
301
+ _selector.children[0].name = label;
302
+ this.groupPanel.addControl(_selector);
303
+ this.selectors.push(_selector);
304
+ if (this.groupPanel.parent && this.groupPanel.parent.parent) {
305
+ button.color = this.groupPanel.parent.parent.buttonColor;
306
+ button.background = this.groupPanel.parent.parent.buttonBackground;
307
+ }
308
+ };
309
+ /**
310
+ * @param selectorNb
311
+ * @param label
312
+ * @hidden
313
+ */
314
+ SliderGroup.prototype._setSelectorLabel = function (selectorNb, label) {
315
+ this.selectors[selectorNb].children[0].name = label;
316
+ this.selectors[selectorNb].children[0].text =
317
+ label + ": " + this.selectors[selectorNb].children[1].value + " " + this.selectors[selectorNb].children[1].name;
318
+ };
319
+ /**
320
+ * @param selectorNb
321
+ * @param color
322
+ * @hidden
323
+ */
324
+ SliderGroup.prototype._setSelectorLabelColor = function (selectorNb, color) {
325
+ this.selectors[selectorNb].children[0].color = color;
326
+ };
327
+ /**
328
+ * @param selectorNb
329
+ * @param color
330
+ * @hidden
331
+ */
332
+ SliderGroup.prototype._setSelectorButtonColor = function (selectorNb, color) {
333
+ this.selectors[selectorNb].children[1].color = color;
334
+ };
335
+ /**
336
+ * @param selectorNb
337
+ * @param color
338
+ * @hidden
339
+ */
340
+ SliderGroup.prototype._setSelectorButtonBackground = function (selectorNb, color) {
341
+ this.selectors[selectorNb].children[1].background = color;
342
+ };
343
+ return SliderGroup;
344
+ }(SelectorGroup));
345
+ export { SliderGroup };
346
+ /** Class used to hold the controls for the checkboxes, radio buttons and sliders
347
+ * @see https://doc.babylonjs.com/how_to/selector
348
+ */
349
+ var SelectionPanel = /** @class */ (function (_super) {
350
+ __extends(SelectionPanel, _super);
351
+ /**
352
+ * Creates a new SelectionPanel
353
+ * @param name of SelectionPanel
354
+ * @param groups is an array of SelectionGroups
355
+ */
356
+ function SelectionPanel(
357
+ /** name of SelectionPanel */
358
+ name,
359
+ /** 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;
380
+ if (groups.length > 0) {
381
+ for (var i = 0; i < groups.length - 1; i++) {
382
+ _this._panel.addControl(groups[i].groupPanel);
383
+ _this._addSpacer();
384
+ }
385
+ _this._panel.addControl(groups[groups.length - 1].groupPanel);
386
+ }
387
+ _this.addControl(_this._panel);
388
+ return _this;
389
+ }
390
+ SelectionPanel.prototype._getTypeName = function () {
391
+ 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++) {
418
+ this._groups[i].groupPanel.children[0].color = this._headerColor;
419
+ }
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++) {
439
+ this._groups[i]._setSelectorButtonColor(j, this._buttonColor);
440
+ }
441
+ }
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++) {
461
+ this._groups[i]._setSelectorLabelColor(j, this._labelColor);
462
+ }
463
+ }
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++) {
483
+ this._groups[i]._setSelectorButtonBackground(j, this._buttonBackground);
484
+ }
485
+ }
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++) {
504
+ this._bars[i].children[0].background = this._barColor;
505
+ }
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++) {
524
+ this._bars[i].children[0].height = this._barHeight;
525
+ }
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++) {
544
+ this._bars[i].height = this._spacerHeight;
545
+ }
546
+ };
547
+ /** Adds a bar between groups */
548
+ SelectionPanel.prototype._addSpacer = function () {
549
+ var separator = new Container();
550
+ separator.width = 1;
551
+ separator.height = this._spacerHeight;
552
+ separator.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
553
+ var bar = new Rectangle();
554
+ bar.width = 1;
555
+ bar.height = this._barHeight;
556
+ bar.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
557
+ bar.verticalAlignment = Control.VERTICAL_ALIGNMENT_CENTER;
558
+ bar.background = this._barColor;
559
+ bar.color = "transparent";
560
+ separator.addControl(bar);
561
+ this._panel.addControl(separator);
562
+ this._bars.push(separator);
563
+ };
564
+ /** Add a group to the selection panel
565
+ * @param group is the selector group to add
566
+ */
567
+ SelectionPanel.prototype.addGroup = function (group) {
568
+ if (this._groups.length > 0) {
569
+ this._addSpacer();
570
+ }
571
+ this._panel.addControl(group.groupPanel);
572
+ this._groups.push(group);
573
+ group.groupPanel.children[0].color = this._headerColor;
574
+ for (var j = 0; j < group.selectors.length; j++) {
575
+ group._setSelectorButtonColor(j, this._buttonColor);
576
+ group._setSelectorButtonBackground(j, this._buttonBackground);
577
+ }
578
+ };
579
+ /** Remove the group from the given position
580
+ * @param groupNb is the position of the group in the list
581
+ */
582
+ SelectionPanel.prototype.removeGroup = function (groupNb) {
583
+ if (groupNb < 0 || groupNb >= this._groups.length) {
584
+ return;
585
+ }
586
+ var group = this._groups[groupNb];
587
+ this._panel.removeControl(group.groupPanel);
588
+ this._groups.splice(groupNb, 1);
589
+ if (groupNb < this._bars.length) {
590
+ this._panel.removeControl(this._bars[groupNb]);
591
+ this._bars.splice(groupNb, 1);
592
+ }
593
+ };
594
+ /** Change a group header label
595
+ * @param label is the new group header label
596
+ * @param groupNb is the number of the group to relabel
597
+ * */
598
+ SelectionPanel.prototype.setHeaderName = function (label, groupNb) {
599
+ if (groupNb < 0 || groupNb >= this._groups.length) {
600
+ return;
601
+ }
602
+ var group = this._groups[groupNb];
603
+ group.groupPanel.children[0].text = label;
604
+ };
605
+ /** Change selector label to the one given
606
+ * @param label is the new selector label
607
+ * @param groupNb is the number of the groupcontaining the selector
608
+ * @param selectorNb is the number of the selector within a group to relabel
609
+ * */
610
+ SelectionPanel.prototype.relabel = function (label, groupNb, selectorNb) {
611
+ if (groupNb < 0 || groupNb >= this._groups.length) {
612
+ return;
613
+ }
614
+ var group = this._groups[groupNb];
615
+ if (selectorNb < 0 || selectorNb >= group.selectors.length) {
616
+ return;
617
+ }
618
+ group._setSelectorLabel(selectorNb, label);
619
+ };
620
+ /** For a given group position remove the selector at the given position
621
+ * @param groupNb is the number of the group to remove the selector from
622
+ * @param selectorNb is the number of the selector within the group
623
+ */
624
+ SelectionPanel.prototype.removeFromGroupSelector = function (groupNb, selectorNb) {
625
+ if (groupNb < 0 || groupNb >= this._groups.length) {
626
+ return;
627
+ }
628
+ var group = this._groups[groupNb];
629
+ if (selectorNb < 0 || selectorNb >= group.selectors.length) {
630
+ return;
631
+ }
632
+ group.removeSelector(selectorNb);
633
+ };
634
+ /** For a given group position of correct type add a checkbox button
635
+ * @param groupNb is the number of the group to remove the selector from
636
+ * @param label is the label for the selector
637
+ * @param func is the function called when the Selector is checked
638
+ * @param checked is true when Selector is checked
639
+ */
640
+ SelectionPanel.prototype.addToGroupCheckbox = function (groupNb, label, func, checked) {
641
+ if (func === void 0) { func = function () { }; }
642
+ if (checked === void 0) { checked = false; }
643
+ if (groupNb < 0 || groupNb >= this._groups.length) {
644
+ return;
645
+ }
646
+ var group = this._groups[groupNb];
647
+ group.addCheckbox(label, func, checked);
648
+ };
649
+ /** For a given group position of correct type add a radio button
650
+ * @param groupNb is the number of the group to remove the selector from
651
+ * @param label is the label for the selector
652
+ * @param func is the function called when the Selector is checked
653
+ * @param checked is true when Selector is checked
654
+ */
655
+ SelectionPanel.prototype.addToGroupRadio = function (groupNb, label, func, checked) {
656
+ if (func === void 0) { func = function () { }; }
657
+ if (checked === void 0) { checked = false; }
658
+ if (groupNb < 0 || groupNb >= this._groups.length) {
659
+ return;
660
+ }
661
+ var group = this._groups[groupNb];
662
+ group.addRadio(label, func, checked);
663
+ };
664
+ /**
665
+ * For a given slider group add a slider
666
+ * @param groupNb is the number of the group to add the slider to
667
+ * @param label is the label for the Slider
668
+ * @param func is the function called when the Slider moves
669
+ * @param unit is a string describing the units used, eg degrees or metres
670
+ * @param min is the minimum value for the Slider
671
+ * @param max is the maximum value for the Slider
672
+ * @param value is the start value for the Slider between min and max
673
+ * @param onVal is the function used to format the value displayed, eg radians to degrees
674
+ */
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
+ }; }
684
+ if (groupNb < 0 || groupNb >= this._groups.length) {
685
+ return;
686
+ }
687
+ var group = this._groups[groupNb];
688
+ group.addSlider(label, func, unit, min, max, value, onVal);
689
+ };
690
+ return SelectionPanel;
691
+ }(Rectangle));
692
+ export { SelectionPanel };
693
693
  //# sourceMappingURL=selector.js.map