@babylonjs/gui 5.20.0 → 5.22.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 (178) hide show
  1. package/2D/adtInstrumentation.js +70 -90
  2. package/2D/adtInstrumentation.js.map +1 -1
  3. package/2D/advancedDynamicTexture.d.ts +14 -0
  4. package/2D/advancedDynamicTexture.js +574 -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 +60 -72
  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.js +148 -178
  51. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  52. package/2D/controls/sliders/scrollBar.js +64 -80
  53. package/2D/controls/sliders/scrollBar.js.map +1 -1
  54. package/2D/controls/sliders/slider.js +91 -115
  55. package/2D/controls/sliders/slider.js.map +1 -1
  56. package/2D/controls/stackPanel.js +114 -135
  57. package/2D/controls/stackPanel.js.map +1 -1
  58. package/2D/controls/statics.js +5 -5
  59. package/2D/controls/statics.js.map +1 -1
  60. package/2D/controls/textBlock.js +322 -384
  61. package/2D/controls/textBlock.js.map +1 -1
  62. package/2D/controls/textWrapper.js +27 -41
  63. package/2D/controls/textWrapper.js.map +1 -1
  64. package/2D/controls/toggleButton.js +105 -121
  65. package/2D/controls/toggleButton.js.map +1 -1
  66. package/2D/controls/virtualKeyboard.js +101 -123
  67. package/2D/controls/virtualKeyboard.js.map +1 -1
  68. package/2D/math2D.js +62 -70
  69. package/2D/math2D.js.map +1 -1
  70. package/2D/measure.js +30 -32
  71. package/2D/measure.js.map +1 -1
  72. package/2D/multiLinePoint.js +71 -89
  73. package/2D/multiLinePoint.js.map +1 -1
  74. package/2D/style.js +55 -73
  75. package/2D/style.js.map +1 -1
  76. package/2D/valueAndUnit.js +71 -104
  77. package/2D/valueAndUnit.js.map +1 -1
  78. package/2D/xmlLoader.js +70 -84
  79. package/2D/xmlLoader.js.map +1 -1
  80. package/3D/behaviors/defaultBehavior.js +40 -59
  81. package/3D/behaviors/defaultBehavior.js.map +1 -1
  82. package/3D/controls/abstractButton3D.js +8 -12
  83. package/3D/controls/abstractButton3D.js.map +1 -1
  84. package/3D/controls/button3D.js +30 -35
  85. package/3D/controls/button3D.js.map +1 -1
  86. package/3D/controls/container3D.js +57 -71
  87. package/3D/controls/container3D.js.map +1 -1
  88. package/3D/controls/contentDisplay3D.js +47 -60
  89. package/3D/controls/contentDisplay3D.js.map +1 -1
  90. package/3D/controls/control3D.js +123 -158
  91. package/3D/controls/control3D.js.map +1 -1
  92. package/3D/controls/cylinderPanel.js +28 -38
  93. package/3D/controls/cylinderPanel.js.map +1 -1
  94. package/3D/controls/handMenu.js +20 -29
  95. package/3D/controls/handMenu.js.map +1 -1
  96. package/3D/controls/holographicBackplate.js +52 -72
  97. package/3D/controls/holographicBackplate.js.map +1 -1
  98. package/3D/controls/holographicButton.js +160 -200
  99. package/3D/controls/holographicButton.js.map +1 -1
  100. package/3D/controls/holographicSlate.js +176 -206
  101. package/3D/controls/holographicSlate.js.map +1 -1
  102. package/3D/controls/meshButton3D.js +24 -30
  103. package/3D/controls/meshButton3D.js.map +1 -1
  104. package/3D/controls/nearMenu.js +57 -71
  105. package/3D/controls/nearMenu.js.map +1 -1
  106. package/3D/controls/planePanel.js +6 -13
  107. package/3D/controls/planePanel.js.map +1 -1
  108. package/3D/controls/scatterPanel.js +43 -54
  109. package/3D/controls/scatterPanel.js.map +1 -1
  110. package/3D/controls/slider3D.js +168 -222
  111. package/3D/controls/slider3D.js.map +1 -1
  112. package/3D/controls/spherePanel.js +29 -39
  113. package/3D/controls/spherePanel.js.map +1 -1
  114. package/3D/controls/stackPanel3D.js +36 -49
  115. package/3D/controls/stackPanel3D.js.map +1 -1
  116. package/3D/controls/touchButton3D.js +126 -154
  117. package/3D/controls/touchButton3D.js.map +1 -1
  118. package/3D/controls/touchHolographicButton.js +223 -272
  119. package/3D/controls/touchHolographicButton.js.map +1 -1
  120. package/3D/controls/touchHolographicMenu.js +55 -66
  121. package/3D/controls/touchHolographicMenu.js.map +1 -1
  122. package/3D/controls/touchMeshButton3D.js +24 -30
  123. package/3D/controls/touchMeshButton3D.js.map +1 -1
  124. package/3D/controls/volumeBasedPanel.js +85 -107
  125. package/3D/controls/volumeBasedPanel.js.map +1 -1
  126. package/3D/gizmos/gizmoHandle.js +68 -103
  127. package/3D/gizmos/gizmoHandle.js.map +1 -1
  128. package/3D/gizmos/slateGizmo.js +165 -182
  129. package/3D/gizmos/slateGizmo.js.map +1 -1
  130. package/3D/gui3DManager.js +76 -101
  131. package/3D/gui3DManager.js.map +1 -1
  132. package/3D/materials/fluent/fluentMaterial.js +110 -119
  133. package/3D/materials/fluent/fluentMaterial.js.map +1 -1
  134. package/3D/materials/fluent/shaders/fluent.fragment.js +20 -3
  135. package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -1
  136. package/3D/materials/fluent/shaders/fluent.vertex.js +11 -3
  137. package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -1
  138. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +168 -177
  139. package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
  140. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +9 -3
  141. package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -1
  142. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +15 -3
  143. package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -1
  144. package/3D/materials/fluentButton/fluentButtonMaterial.js +205 -213
  145. package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
  146. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +6 -3
  147. package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -1
  148. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +6 -3
  149. package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -1
  150. package/3D/materials/handle/handleMaterial.js +56 -69
  151. package/3D/materials/handle/handleMaterial.js.map +1 -1
  152. package/3D/materials/handle/shaders/handle.fragment.js +3 -3
  153. package/3D/materials/handle/shaders/handle.fragment.js.map +1 -1
  154. package/3D/materials/handle/shaders/handle.vertex.js +3 -3
  155. package/3D/materials/handle/shaders/handle.vertex.js.map +1 -1
  156. package/3D/materials/mrdl/mrdlBackplateMaterial.js +158 -166
  157. package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
  158. package/3D/materials/mrdl/mrdlSliderBarMaterial.js +322 -330
  159. package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
  160. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +322 -330
  161. package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
  162. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +9 -3
  163. package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -1
  164. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +6 -3
  165. package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -1
  166. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +24 -3
  167. package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -1
  168. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +12 -3
  169. package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -1
  170. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +24 -3
  171. package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -1
  172. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +12 -3
  173. package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -1
  174. package/3D/vector3WithInfo.js +6 -12
  175. package/3D/vector3WithInfo.js.map +1 -1
  176. package/legacy/legacy.js +1 -1
  177. package/legacy/legacy.js.map +1 -1
  178. package/package.json +3 -6
@@ -1,4 +1,3 @@
1
- import { __extends } from "tslib";
2
1
  import { Container } from "./container.js";
3
2
  import { ValueAndUnit } from "../valueAndUnit.js";
4
3
  import { Control } from "./control.js";
@@ -7,109 +6,87 @@ import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
7
6
  /**
8
7
  * Class used to create a 2D grid container
9
8
  */
10
- var Grid = /** @class */ (function (_super) {
11
- __extends(Grid, _super);
9
+ export class Grid extends Container {
12
10
  /**
13
11
  * Creates a new Grid
14
12
  * @param name defines control name
15
13
  */
16
- function Grid(name) {
17
- var _this = _super.call(this, name) || this;
18
- _this.name = name;
19
- _this._rowDefinitions = new Array();
20
- _this._rowDefinitionObservers = [];
21
- _this._columnDefinitions = new Array();
22
- _this._columnDefinitionObservers = [];
23
- _this._cells = {};
24
- _this._childControls = new Array();
25
- return _this;
14
+ constructor(name) {
15
+ super(name);
16
+ this.name = name;
17
+ this._rowDefinitions = new Array();
18
+ this._rowDefinitionObservers = [];
19
+ this._columnDefinitions = new Array();
20
+ this._columnDefinitionObservers = [];
21
+ this._cells = {};
22
+ this._childControls = new Array();
23
+ }
24
+ /**
25
+ * Gets the number of columns
26
+ */
27
+ get columnCount() {
28
+ return this._columnDefinitions.length;
29
+ }
30
+ /**
31
+ * Gets the number of rows
32
+ */
33
+ get rowCount() {
34
+ return this._rowDefinitions.length;
35
+ }
36
+ /** Gets the list of children */
37
+ get children() {
38
+ return this._childControls;
39
+ }
40
+ /** Gets the list of cells (e.g. the containers) */
41
+ get cells() {
42
+ return this._cells;
26
43
  }
27
- Object.defineProperty(Grid.prototype, "columnCount", {
28
- /**
29
- * Gets the number of columns
30
- */
31
- get: function () {
32
- return this._columnDefinitions.length;
33
- },
34
- enumerable: false,
35
- configurable: true
36
- });
37
- Object.defineProperty(Grid.prototype, "rowCount", {
38
- /**
39
- * Gets the number of rows
40
- */
41
- get: function () {
42
- return this._rowDefinitions.length;
43
- },
44
- enumerable: false,
45
- configurable: true
46
- });
47
- Object.defineProperty(Grid.prototype, "children", {
48
- /** Gets the list of children */
49
- get: function () {
50
- return this._childControls;
51
- },
52
- enumerable: false,
53
- configurable: true
54
- });
55
- Object.defineProperty(Grid.prototype, "cells", {
56
- /** Gets the list of cells (e.g. the containers) */
57
- get: function () {
58
- return this._cells;
59
- },
60
- enumerable: false,
61
- configurable: true
62
- });
63
44
  /**
64
45
  * Gets the definition of a specific row
65
46
  * @param index defines the index of the row
66
47
  * @returns the row definition
67
48
  */
68
- Grid.prototype.getRowDefinition = function (index) {
49
+ getRowDefinition(index) {
69
50
  if (index < 0 || index >= this._rowDefinitions.length) {
70
51
  return null;
71
52
  }
72
53
  return this._rowDefinitions[index];
73
- };
54
+ }
74
55
  /**
75
56
  * Gets the definition of a specific column
76
57
  * @param index defines the index of the column
77
58
  * @returns the column definition
78
59
  */
79
- Grid.prototype.getColumnDefinition = function (index) {
60
+ getColumnDefinition(index) {
80
61
  if (index < 0 || index >= this._columnDefinitions.length) {
81
62
  return null;
82
63
  }
83
64
  return this._columnDefinitions[index];
84
- };
65
+ }
85
66
  /**
86
67
  * Adds a new row to the grid
87
68
  * @param height defines the height of the row (either in pixel or a value between 0 and 1)
88
69
  * @param isPixel defines if the height is expressed in pixel (or in percentage)
89
70
  * @returns the current grid
90
71
  */
91
- Grid.prototype.addRowDefinition = function (height, isPixel) {
92
- var _this = this;
93
- if (isPixel === void 0) { isPixel = false; }
72
+ addRowDefinition(height, isPixel = false) {
94
73
  this._rowDefinitions.push(new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));
95
- this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount - 1].onChangedObservable.add(function () { return _this._markAsDirty(); }));
74
+ this._rowDefinitionObservers.push(this._rowDefinitions[this.rowCount - 1].onChangedObservable.add(() => this._markAsDirty()));
96
75
  this._markAsDirty();
97
76
  return this;
98
- };
77
+ }
99
78
  /**
100
79
  * Adds a new column to the grid
101
80
  * @param width defines the width of the column (either in pixel or a value between 0 and 1)
102
81
  * @param isPixel defines if the width is expressed in pixel (or in percentage)
103
82
  * @returns the current grid
104
83
  */
105
- Grid.prototype.addColumnDefinition = function (width, isPixel) {
106
- var _this = this;
107
- if (isPixel === void 0) { isPixel = false; }
84
+ addColumnDefinition(width, isPixel = false) {
108
85
  this._columnDefinitions.push(new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE));
109
- this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount - 1].onChangedObservable.add(function () { return _this._markAsDirty(); }));
86
+ this._columnDefinitionObservers.push(this._columnDefinitions[this.columnCount - 1].onChangedObservable.add(() => this._markAsDirty()));
110
87
  this._markAsDirty();
111
88
  return this;
112
- };
89
+ }
113
90
  /**
114
91
  * Update a row definition
115
92
  * @param index defines the index of the row to update
@@ -117,22 +94,20 @@ var Grid = /** @class */ (function (_super) {
117
94
  * @param isPixel defines if the weight is expressed in pixel (or in percentage)
118
95
  * @returns the current grid
119
96
  */
120
- Grid.prototype.setRowDefinition = function (index, height, isPixel) {
121
- var _this = this;
122
- if (isPixel === void 0) { isPixel = false; }
97
+ setRowDefinition(index, height, isPixel = false) {
123
98
  if (index < 0 || index >= this._rowDefinitions.length) {
124
99
  return this;
125
100
  }
126
- var current = this._rowDefinitions[index];
101
+ const current = this._rowDefinitions[index];
127
102
  if (current && current.isPixel === isPixel && current.value === height) {
128
103
  return this;
129
104
  }
130
105
  this._rowDefinitions[index].onChangedObservable.remove(this._rowDefinitionObservers[index]);
131
106
  this._rowDefinitions[index] = new ValueAndUnit(height, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);
132
- this._rowDefinitionObservers[index] = this._rowDefinitions[index].onChangedObservable.add(function () { return _this._markAsDirty(); });
107
+ this._rowDefinitionObservers[index] = this._rowDefinitions[index].onChangedObservable.add(() => this._markAsDirty());
133
108
  this._markAsDirty();
134
109
  return this;
135
- };
110
+ }
136
111
  /**
137
112
  * Update a column definition
138
113
  * @param index defines the index of the column to update
@@ -140,86 +115,82 @@ var Grid = /** @class */ (function (_super) {
140
115
  * @param isPixel defines if the width is expressed in pixel (or in percentage)
141
116
  * @returns the current grid
142
117
  */
143
- Grid.prototype.setColumnDefinition = function (index, width, isPixel) {
144
- var _this = this;
145
- if (isPixel === void 0) { isPixel = false; }
118
+ setColumnDefinition(index, width, isPixel = false) {
146
119
  if (index < 0 || index >= this._columnDefinitions.length) {
147
120
  return this;
148
121
  }
149
- var current = this._columnDefinitions[index];
122
+ const current = this._columnDefinitions[index];
150
123
  if (current && current.isPixel === isPixel && current.value === width) {
151
124
  return this;
152
125
  }
153
126
  this._columnDefinitions[index].onChangedObservable.remove(this._columnDefinitionObservers[index]);
154
127
  this._columnDefinitions[index] = new ValueAndUnit(width, isPixel ? ValueAndUnit.UNITMODE_PIXEL : ValueAndUnit.UNITMODE_PERCENTAGE);
155
- this._columnDefinitionObservers[index] = this._columnDefinitions[index].onChangedObservable.add(function () { return _this._markAsDirty(); });
128
+ this._columnDefinitionObservers[index] = this._columnDefinitions[index].onChangedObservable.add(() => this._markAsDirty());
156
129
  this._markAsDirty();
157
130
  return this;
158
- };
131
+ }
159
132
  /**
160
133
  * Gets the list of children stored in a specific cell
161
134
  * @param row defines the row to check
162
135
  * @param column defines the column to check
163
136
  * @returns the list of controls
164
137
  */
165
- Grid.prototype.getChildrenAt = function (row, column) {
166
- var cell = this._cells["".concat(row, ":").concat(column)];
138
+ getChildrenAt(row, column) {
139
+ const cell = this._cells[`${row}:${column}`];
167
140
  if (!cell) {
168
141
  return null;
169
142
  }
170
143
  return cell.children;
171
- };
144
+ }
172
145
  /**
173
146
  * Gets a string representing the child cell info (row x column)
174
147
  * @param child defines the control to get info from
175
148
  * @returns a string containing the child cell info (row x column)
176
149
  */
177
- Grid.prototype.getChildCellInfo = function (child) {
150
+ getChildCellInfo(child) {
178
151
  return child._tag;
179
- };
180
- Grid.prototype._removeCell = function (cell, key) {
152
+ }
153
+ _removeCell(cell, key) {
181
154
  if (!cell) {
182
155
  return;
183
156
  }
184
- _super.prototype.removeControl.call(this, cell);
185
- for (var _i = 0, _a = cell.children; _i < _a.length; _i++) {
186
- var control = _a[_i];
187
- var childIndex = this._childControls.indexOf(control);
157
+ super.removeControl(cell);
158
+ for (const control of cell.children) {
159
+ const childIndex = this._childControls.indexOf(control);
188
160
  if (childIndex !== -1) {
189
161
  this._childControls.splice(childIndex, 1);
190
162
  }
191
163
  }
192
164
  delete this._cells[key];
193
- };
194
- Grid.prototype._offsetCell = function (previousKey, key) {
165
+ }
166
+ _offsetCell(previousKey, key) {
195
167
  if (!this._cells[key]) {
196
168
  return;
197
169
  }
198
170
  this._cells[previousKey] = this._cells[key];
199
- for (var _i = 0, _a = this._cells[previousKey].children; _i < _a.length; _i++) {
200
- var control = _a[_i];
171
+ for (const control of this._cells[previousKey].children) {
201
172
  control._tag = previousKey;
202
173
  }
203
174
  delete this._cells[key];
204
- };
175
+ }
205
176
  /**
206
177
  * Remove a column definition at specified index
207
178
  * @param index defines the index of the column to remove
208
179
  * @returns the current grid
209
180
  */
210
- Grid.prototype.removeColumnDefinition = function (index) {
181
+ removeColumnDefinition(index) {
211
182
  if (index < 0 || index >= this._columnDefinitions.length) {
212
183
  return this;
213
184
  }
214
- for (var x = 0; x < this._rowDefinitions.length; x++) {
215
- var key = "".concat(x, ":").concat(index);
216
- var cell = this._cells[key];
185
+ for (let x = 0; x < this._rowDefinitions.length; x++) {
186
+ const key = `${x}:${index}`;
187
+ const cell = this._cells[key];
217
188
  this._removeCell(cell, key);
218
189
  }
219
- for (var x = 0; x < this._rowDefinitions.length; x++) {
220
- for (var y = index + 1; y < this._columnDefinitions.length; y++) {
221
- var previousKey = "".concat(x, ":").concat(y - 1);
222
- var key = "".concat(x, ":").concat(y);
190
+ for (let x = 0; x < this._rowDefinitions.length; x++) {
191
+ for (let y = index + 1; y < this._columnDefinitions.length; y++) {
192
+ const previousKey = `${x}:${y - 1}`;
193
+ const key = `${x}:${y}`;
223
194
  this._offsetCell(previousKey, key);
224
195
  }
225
196
  }
@@ -228,25 +199,25 @@ var Grid = /** @class */ (function (_super) {
228
199
  this._columnDefinitionObservers.splice(index, 1);
229
200
  this._markAsDirty();
230
201
  return this;
231
- };
202
+ }
232
203
  /**
233
204
  * Remove a row definition at specified index
234
205
  * @param index defines the index of the row to remove
235
206
  * @returns the current grid
236
207
  */
237
- Grid.prototype.removeRowDefinition = function (index) {
208
+ removeRowDefinition(index) {
238
209
  if (index < 0 || index >= this._rowDefinitions.length) {
239
210
  return this;
240
211
  }
241
- for (var y = 0; y < this._columnDefinitions.length; y++) {
242
- var key = "".concat(index, ":").concat(y);
243
- var cell = this._cells[key];
212
+ for (let y = 0; y < this._columnDefinitions.length; y++) {
213
+ const key = `${index}:${y}`;
214
+ const cell = this._cells[key];
244
215
  this._removeCell(cell, key);
245
216
  }
246
- for (var y = 0; y < this._columnDefinitions.length; y++) {
247
- for (var x = index + 1; x < this._rowDefinitions.length; x++) {
248
- var previousKey = "".concat(x - 1, ":").concat(y);
249
- var key = "".concat(x, ":").concat(y);
217
+ for (let y = 0; y < this._columnDefinitions.length; y++) {
218
+ for (let x = index + 1; x < this._rowDefinitions.length; x++) {
219
+ const previousKey = `${x - 1}:${y}`;
220
+ const key = `${x}:${y}`;
250
221
  this._offsetCell(previousKey, key);
251
222
  }
252
223
  }
@@ -255,7 +226,7 @@ var Grid = /** @class */ (function (_super) {
255
226
  this._rowDefinitionObservers.splice(index, 1);
256
227
  this._markAsDirty();
257
228
  return this;
258
- };
229
+ }
259
230
  /**
260
231
  * Adds a new control to the current grid
261
232
  * @param control defines the control to add
@@ -263,9 +234,7 @@ var Grid = /** @class */ (function (_super) {
263
234
  * @param column defines the column where to add the control (0 by default)
264
235
  * @returns the current grid
265
236
  */
266
- Grid.prototype.addControl = function (control, row, column) {
267
- if (row === void 0) { row = 0; }
268
- if (column === void 0) { column = 0; }
237
+ addControl(control, row = 0, column = 0) {
269
238
  if (this._rowDefinitions.length === 0) {
270
239
  // Add default row definition
271
240
  this.addRowDefinition(1, false);
@@ -275,19 +244,19 @@ var Grid = /** @class */ (function (_super) {
275
244
  this.addColumnDefinition(1, false);
276
245
  }
277
246
  if (this._childControls.indexOf(control) !== -1) {
278
- Tools.Warn("Control (Name:".concat(control.name, ", UniqueId:").concat(control.uniqueId, ") is already associated with this grid. You must remove it before reattaching it"));
247
+ Tools.Warn(`Control (Name:${control.name}, UniqueId:${control.uniqueId}) is already associated with this grid. You must remove it before reattaching it`);
279
248
  return this;
280
249
  }
281
- var x = Math.min(row, this._rowDefinitions.length - 1);
282
- var y = Math.min(column, this._columnDefinitions.length - 1);
283
- var key = "".concat(x, ":").concat(y);
284
- var goodContainer = this._cells[key];
250
+ const x = Math.min(row, this._rowDefinitions.length - 1);
251
+ const y = Math.min(column, this._columnDefinitions.length - 1);
252
+ const key = `${x}:${y}`;
253
+ let goodContainer = this._cells[key];
285
254
  if (!goodContainer) {
286
255
  goodContainer = new Container(key);
287
256
  this._cells[key] = goodContainer;
288
257
  goodContainer.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
289
258
  goodContainer.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
290
- _super.prototype.addControl.call(this, goodContainer);
259
+ super.addControl(goodContainer);
291
260
  }
292
261
  goodContainer.addControl(control);
293
262
  this._childControls.push(control);
@@ -295,43 +264,42 @@ var Grid = /** @class */ (function (_super) {
295
264
  control.parent = this;
296
265
  this._markAsDirty();
297
266
  return this;
298
- };
267
+ }
299
268
  /**
300
269
  * Removes a control from the current container
301
270
  * @param control defines the control to remove
302
271
  * @returns the current container
303
272
  */
304
- Grid.prototype.removeControl = function (control) {
305
- var index = this._childControls.indexOf(control);
273
+ removeControl(control) {
274
+ const index = this._childControls.indexOf(control);
306
275
  if (index !== -1) {
307
276
  this._childControls.splice(index, 1);
308
277
  }
309
- var cell = this._cells[control._tag];
278
+ const cell = this._cells[control._tag];
310
279
  if (cell) {
311
280
  cell.removeControl(control);
312
281
  control._tag = null;
313
282
  }
314
283
  this._markAsDirty();
315
284
  return this;
316
- };
317
- Grid.prototype._getTypeName = function () {
285
+ }
286
+ _getTypeName() {
318
287
  return "Grid";
319
- };
320
- Grid.prototype._getGridDefinitions = function (definitionCallback) {
321
- var widths = [];
322
- var heights = [];
323
- var lefts = [];
324
- var tops = [];
325
- var availableWidth = this._currentMeasure.width;
326
- var globalWidthPercentage = 0;
327
- var availableHeight = this._currentMeasure.height;
328
- var globalHeightPercentage = 0;
288
+ }
289
+ _getGridDefinitions(definitionCallback) {
290
+ const widths = [];
291
+ const heights = [];
292
+ const lefts = [];
293
+ const tops = [];
294
+ let availableWidth = this._currentMeasure.width;
295
+ let globalWidthPercentage = 0;
296
+ let availableHeight = this._currentMeasure.height;
297
+ let globalHeightPercentage = 0;
329
298
  // Heights
330
- var index = 0;
331
- for (var _i = 0, _a = this._rowDefinitions; _i < _a.length; _i++) {
332
- var rowDefinition = _a[_i];
299
+ let index = 0;
300
+ for (const rowDefinition of this._rowDefinitions) {
333
301
  if (rowDefinition.isPixel) {
334
- var height = rowDefinition.getValue(this._host);
302
+ const height = rowDefinition.getValue(this._host);
335
303
  availableHeight -= height;
336
304
  heights[index] = height;
337
305
  }
@@ -340,13 +308,12 @@ var Grid = /** @class */ (function (_super) {
340
308
  }
341
309
  index++;
342
310
  }
343
- var top = 0;
311
+ let top = 0;
344
312
  index = 0;
345
- for (var _b = 0, _c = this._rowDefinitions; _b < _c.length; _b++) {
346
- var rowDefinition = _c[_b];
313
+ for (const rowDefinition of this._rowDefinitions) {
347
314
  tops.push(top);
348
315
  if (!rowDefinition.isPixel) {
349
- var height = (rowDefinition.value / globalHeightPercentage) * availableHeight;
316
+ const height = (rowDefinition.value / globalHeightPercentage) * availableHeight;
350
317
  top += height;
351
318
  heights[index] = height;
352
319
  }
@@ -357,10 +324,9 @@ var Grid = /** @class */ (function (_super) {
357
324
  }
358
325
  // Widths
359
326
  index = 0;
360
- for (var _d = 0, _e = this._columnDefinitions; _d < _e.length; _d++) {
361
- var columnDefinition = _e[_d];
327
+ for (const columnDefinition of this._columnDefinitions) {
362
328
  if (columnDefinition.isPixel) {
363
- var width = columnDefinition.getValue(this._host);
329
+ const width = columnDefinition.getValue(this._host);
364
330
  availableWidth -= width;
365
331
  widths[index] = width;
366
332
  }
@@ -369,13 +335,12 @@ var Grid = /** @class */ (function (_super) {
369
335
  }
370
336
  index++;
371
337
  }
372
- var left = 0;
338
+ let left = 0;
373
339
  index = 0;
374
- for (var _f = 0, _g = this._columnDefinitions; _f < _g.length; _f++) {
375
- var columnDefinition = _g[_f];
340
+ for (const columnDefinition of this._columnDefinitions) {
376
341
  lefts.push(left);
377
342
  if (!columnDefinition.isPixel) {
378
- var width = (columnDefinition.value / globalWidthPercentage) * availableWidth;
343
+ const width = (columnDefinition.value / globalWidthPercentage) * availableWidth;
379
344
  left += width;
380
345
  widths[index] = width;
381
346
  }
@@ -385,19 +350,18 @@ var Grid = /** @class */ (function (_super) {
385
350
  index++;
386
351
  }
387
352
  definitionCallback(lefts, tops, widths, heights);
388
- };
389
- Grid.prototype._additionalProcessing = function (parentMeasure, context) {
390
- var _this = this;
391
- this._getGridDefinitions(function (lefts, tops, widths, heights) {
353
+ }
354
+ _additionalProcessing(parentMeasure, context) {
355
+ this._getGridDefinitions((lefts, tops, widths, heights) => {
392
356
  // Setting child sizes
393
- for (var key in _this._cells) {
394
- if (!Object.prototype.hasOwnProperty.call(_this._cells, key)) {
357
+ for (const key in this._cells) {
358
+ if (!Object.prototype.hasOwnProperty.call(this._cells, key)) {
395
359
  continue;
396
360
  }
397
- var split = key.split(":");
398
- var x = parseInt(split[0]);
399
- var y = parseInt(split[1]);
400
- var cell = _this._cells[key];
361
+ const split = key.split(":");
362
+ const x = parseInt(split[0]);
363
+ const y = parseInt(split[1]);
364
+ const cell = this._cells[key];
401
365
  cell.left = lefts[y] + "px";
402
366
  cell.top = tops[x] + "px";
403
367
  cell.width = widths[y] + "px";
@@ -408,51 +372,49 @@ var Grid = /** @class */ (function (_super) {
408
372
  cell._height.ignoreAdaptiveScaling = true;
409
373
  }
410
374
  });
411
- _super.prototype._additionalProcessing.call(this, parentMeasure, context);
412
- };
413
- Grid.prototype._flagDescendantsAsMatrixDirty = function () {
414
- for (var key in this._cells) {
375
+ super._additionalProcessing(parentMeasure, context);
376
+ }
377
+ _flagDescendantsAsMatrixDirty() {
378
+ for (const key in this._cells) {
415
379
  if (!Object.prototype.hasOwnProperty.call(this._cells, key)) {
416
380
  continue;
417
381
  }
418
- var child = this._cells[key];
382
+ const child = this._cells[key];
419
383
  child._markMatrixAsDirty();
420
384
  }
421
- };
422
- Grid.prototype._renderHighlightSpecific = function (context) {
423
- var _this = this;
424
- _super.prototype._renderHighlightSpecific.call(this, context);
425
- this._getGridDefinitions(function (lefts, tops, widths, heights) {
385
+ }
386
+ _renderHighlightSpecific(context) {
387
+ super._renderHighlightSpecific(context);
388
+ this._getGridDefinitions((lefts, tops, widths, heights) => {
426
389
  // Columns
427
- for (var index = 0; index < lefts.length; index++) {
428
- var left = _this._currentMeasure.left + lefts[index] + widths[index];
390
+ for (let index = 0; index < lefts.length; index++) {
391
+ const left = this._currentMeasure.left + lefts[index] + widths[index];
429
392
  context.beginPath();
430
- context.moveTo(left, _this._currentMeasure.top);
431
- context.lineTo(left, _this._currentMeasure.top + _this._currentMeasure.height);
393
+ context.moveTo(left, this._currentMeasure.top);
394
+ context.lineTo(left, this._currentMeasure.top + this._currentMeasure.height);
432
395
  context.stroke();
433
396
  }
434
397
  // Rows
435
- for (var index = 0; index < tops.length; index++) {
436
- var top_1 = _this._currentMeasure.top + tops[index] + heights[index];
398
+ for (let index = 0; index < tops.length; index++) {
399
+ const top = this._currentMeasure.top + tops[index] + heights[index];
437
400
  context.beginPath();
438
- context.moveTo(_this._currentMeasure.left, top_1);
439
- context.lineTo(_this._currentMeasure.left + _this._currentMeasure.width, top_1);
401
+ context.moveTo(this._currentMeasure.left, top);
402
+ context.lineTo(this._currentMeasure.left + this._currentMeasure.width, top);
440
403
  context.stroke();
441
404
  }
442
405
  });
443
406
  context.restore();
444
- };
407
+ }
445
408
  /** Releases associated resources */
446
- Grid.prototype.dispose = function () {
447
- _super.prototype.dispose.call(this);
448
- for (var _i = 0, _a = this._childControls; _i < _a.length; _i++) {
449
- var control = _a[_i];
409
+ dispose() {
410
+ super.dispose();
411
+ for (const control of this._childControls) {
450
412
  control.dispose();
451
413
  }
452
- for (var index = 0; index < this._rowDefinitions.length; index++) {
414
+ for (let index = 0; index < this._rowDefinitions.length; index++) {
453
415
  this._rowDefinitions[index].onChangedObservable.remove(this._rowDefinitionObservers[index]);
454
416
  }
455
- for (var index = 0; index < this._columnDefinitions.length; index++) {
417
+ for (let index = 0; index < this._columnDefinitions.length; index++) {
456
418
  this._columnDefinitions[index].onChangedObservable.remove(this._columnDefinitionObservers[index]);
457
419
  }
458
420
  this._rowDefinitionObservers.length = 0;
@@ -461,70 +423,68 @@ var Grid = /** @class */ (function (_super) {
461
423
  this._columnDefinitions.length = 0;
462
424
  this._cells = {};
463
425
  this._childControls.length = 0;
464
- };
426
+ }
465
427
  /**
466
428
  * Serializes the current control
467
429
  * @param serializationObject defined the JSON serialized object
468
430
  */
469
- Grid.prototype.serialize = function (serializationObject) {
470
- _super.prototype.serialize.call(this, serializationObject);
431
+ serialize(serializationObject) {
432
+ super.serialize(serializationObject);
471
433
  serializationObject.columnCount = this.columnCount;
472
434
  serializationObject.rowCount = this.rowCount;
473
435
  serializationObject.columns = [];
474
436
  serializationObject.rows = [];
475
437
  serializationObject.tags = [];
476
- for (var i = 0; i < this.columnCount; ++i) {
477
- var cd = this.getColumnDefinition(i);
478
- var childSerializationObject = { value: cd === null || cd === void 0 ? void 0 : cd.getValue(this.host), unit: cd === null || cd === void 0 ? void 0 : cd.unit };
438
+ for (let i = 0; i < this.columnCount; ++i) {
439
+ const cd = this.getColumnDefinition(i);
440
+ const childSerializationObject = { value: cd?.getValue(this.host), unit: cd?.unit };
479
441
  serializationObject.columns.push(childSerializationObject);
480
442
  }
481
- for (var i = 0; i < this.rowCount; ++i) {
482
- var rd = this.getRowDefinition(i);
483
- var childSerializationObject = { value: rd === null || rd === void 0 ? void 0 : rd.getValue(this.host), unit: rd === null || rd === void 0 ? void 0 : rd.unit };
443
+ for (let i = 0; i < this.rowCount; ++i) {
444
+ const rd = this.getRowDefinition(i);
445
+ const childSerializationObject = { value: rd?.getValue(this.host), unit: rd?.unit };
484
446
  serializationObject.rows.push(childSerializationObject);
485
447
  }
486
- this.children.forEach(function (child) {
448
+ this.children.forEach((child) => {
487
449
  serializationObject.tags.push(child._tag);
488
450
  });
489
- };
451
+ }
490
452
  /**
491
453
  * @param serializedObject
492
454
  * @param host
493
455
  * @hidden
494
456
  */
495
- Grid.prototype._parseFromContent = function (serializedObject, host) {
496
- _super.prototype._parseFromContent.call(this, serializedObject, host);
497
- var children = [];
498
- this.children.forEach(function (child) {
457
+ _parseFromContent(serializedObject, host) {
458
+ super._parseFromContent(serializedObject, host);
459
+ const children = [];
460
+ this.children.forEach((child) => {
499
461
  children.push(child);
500
462
  });
501
463
  this.removeRowDefinition(0);
502
464
  this.removeColumnDefinition(0);
503
- for (var i = 0; i < serializedObject.columnCount; ++i) {
504
- var columnValue = serializedObject.columns[i].value;
505
- var unit = serializedObject.columns[i].unit;
465
+ for (let i = 0; i < serializedObject.columnCount; ++i) {
466
+ const columnValue = serializedObject.columns[i].value;
467
+ const unit = serializedObject.columns[i].unit;
506
468
  this.addColumnDefinition(columnValue, unit === 1 ? true : false);
507
469
  }
508
- for (var i = 0; i < serializedObject.rowCount; ++i) {
509
- var rowValue = serializedObject.rows[i].value;
510
- var unit = serializedObject.rows[i].unit;
470
+ for (let i = 0; i < serializedObject.rowCount; ++i) {
471
+ const rowValue = serializedObject.rows[i].value;
472
+ const unit = serializedObject.rows[i].unit;
511
473
  this.addRowDefinition(rowValue, unit === 1 ? true : false);
512
474
  }
513
- for (var i = 0; i < children.length; ++i) {
514
- var cellInfo = serializedObject.tags[i];
515
- var rowNumber = parseInt(cellInfo.substring(0, cellInfo.search(":")));
475
+ for (let i = 0; i < children.length; ++i) {
476
+ const cellInfo = serializedObject.tags[i];
477
+ let rowNumber = parseInt(cellInfo.substring(0, cellInfo.search(":")));
516
478
  if (isNaN(rowNumber)) {
517
479
  rowNumber = 0;
518
480
  }
519
- var columnNumber = parseInt(cellInfo.substring(cellInfo.search(":") + 1));
481
+ let columnNumber = parseInt(cellInfo.substring(cellInfo.search(":") + 1));
520
482
  if (isNaN(columnNumber)) {
521
483
  columnNumber = 0;
522
484
  }
523
485
  this.addControl(children[i], rowNumber, columnNumber);
524
486
  }
525
- };
526
- return Grid;
527
- }(Container));
528
- export { Grid };
487
+ }
488
+ }
529
489
  RegisterClass("BABYLON.GUI.Grid", Grid);
530
490
  //# sourceMappingURL=grid.js.map