@babylonjs/gui 5.21.0 → 5.23.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (178) hide show
  1. package/2D/adtInstrumentation.js +70 -90
  2. package/2D/adtInstrumentation.js.map +1 -1
  3. package/2D/advancedDynamicTexture.d.ts +12 -0
  4. package/2D/advancedDynamicTexture.js +569 -622
  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 +1067 -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,4 @@
1
- import { __decorate, __extends } from "tslib";
1
+ import { __decorate } from "@babylonjs/core/tslib.es6.js";
2
2
  import { Logger } from "@babylonjs/core/Misc/logger.js";
3
3
  import { Control } from "./control.js";
4
4
  import { Measure } from "../measure.js";
@@ -11,184 +11,154 @@ import { Constants } from "@babylonjs/core/Engines/constants.js";
11
11
  * Root class for 2D containers
12
12
  * @see https://doc.babylonjs.com/how_to/gui#containers
13
13
  */
14
- var Container = /** @class */ (function (_super) {
15
- __extends(Container, _super);
14
+ export class Container extends Control {
16
15
  /**
17
16
  * Creates a new Container
18
17
  * @param name defines the name of the container
19
18
  */
20
- function Container(name) {
21
- var _this = _super.call(this, name) || this;
22
- _this.name = name;
19
+ constructor(name) {
20
+ super(name);
21
+ this.name = name;
23
22
  /** @hidden */
24
- _this._children = new Array();
23
+ this._children = new Array();
25
24
  /** @hidden */
26
- _this._measureForChildren = Measure.Empty();
25
+ this._measureForChildren = Measure.Empty();
27
26
  /** @hidden */
28
- _this._background = "";
27
+ this._background = "";
29
28
  /** @hidden */
30
- _this._adaptWidthToChildren = false;
29
+ this._adaptWidthToChildren = false;
31
30
  /** @hidden */
32
- _this._adaptHeightToChildren = false;
31
+ this._adaptHeightToChildren = false;
33
32
  /** @hidden */
34
- _this._renderToIntermediateTexture = false;
33
+ this._renderToIntermediateTexture = false;
35
34
  /** @hidden */
36
- _this._intermediateTexture = null;
35
+ this._intermediateTexture = null;
37
36
  /**
38
37
  * Gets or sets a boolean indicating that layout cycle errors should be displayed on the console
39
38
  */
40
- _this.logLayoutCycleErrors = false;
39
+ this.logLayoutCycleErrors = false;
41
40
  /**
42
41
  * Gets or sets the number of layout cycles (a change involved by a control while evaluating the layout) allowed
43
42
  */
44
- _this.maxLayoutCycle = 3;
45
- return _this;
46
- }
47
- Object.defineProperty(Container.prototype, "renderToIntermediateTexture", {
48
- /** Gets or sets boolean indicating if children should be rendered to an intermediate texture rather than directly to host, useful for alpha blending */
49
- get: function () {
50
- return this._renderToIntermediateTexture;
51
- },
52
- set: function (value) {
53
- if (this._renderToIntermediateTexture === value) {
54
- return;
55
- }
56
- this._renderToIntermediateTexture = value;
57
- this._markAsDirty();
58
- },
59
- enumerable: false,
60
- configurable: true
61
- });
62
- Object.defineProperty(Container.prototype, "adaptHeightToChildren", {
63
- /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
64
- get: function () {
65
- return this._adaptHeightToChildren;
66
- },
67
- set: function (value) {
68
- if (this._adaptHeightToChildren === value) {
69
- return;
70
- }
71
- this._adaptHeightToChildren = value;
72
- if (value) {
73
- this.height = "100%";
74
- }
75
- this._markAsDirty();
76
- },
77
- enumerable: false,
78
- configurable: true
79
- });
80
- Object.defineProperty(Container.prototype, "adaptWidthToChildren", {
81
- /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
82
- get: function () {
83
- return this._adaptWidthToChildren;
84
- },
85
- set: function (value) {
86
- if (this._adaptWidthToChildren === value) {
87
- return;
88
- }
89
- this._adaptWidthToChildren = value;
90
- if (value) {
91
- this.width = "100%";
92
- }
93
- this._markAsDirty();
94
- },
95
- enumerable: false,
96
- configurable: true
97
- });
98
- Object.defineProperty(Container.prototype, "background", {
99
- /** Gets or sets background color */
100
- get: function () {
101
- return this._background;
102
- },
103
- set: function (value) {
104
- if (this._background === value) {
105
- return;
106
- }
107
- this._background = value;
108
- this._markAsDirty();
109
- },
110
- enumerable: false,
111
- configurable: true
112
- });
113
- Object.defineProperty(Container.prototype, "children", {
114
- /** Gets the list of children */
115
- get: function () {
116
- return this._children;
117
- },
118
- enumerable: false,
119
- configurable: true
120
- });
121
- Object.defineProperty(Container.prototype, "isReadOnly", {
122
- get: function () {
123
- return this._isReadOnly;
124
- },
125
- set: function (value) {
126
- this._isReadOnly = value;
127
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
128
- var child = _a[_i];
129
- child.isReadOnly = value;
130
- }
131
- },
132
- enumerable: false,
133
- configurable: true
134
- });
135
- Container.prototype._getTypeName = function () {
43
+ this.maxLayoutCycle = 3;
44
+ }
45
+ /** Gets or sets boolean indicating if children should be rendered to an intermediate texture rather than directly to host, useful for alpha blending */
46
+ get renderToIntermediateTexture() {
47
+ return this._renderToIntermediateTexture;
48
+ }
49
+ set renderToIntermediateTexture(value) {
50
+ if (this._renderToIntermediateTexture === value) {
51
+ return;
52
+ }
53
+ this._renderToIntermediateTexture = value;
54
+ this._markAsDirty();
55
+ }
56
+ /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
57
+ get adaptHeightToChildren() {
58
+ return this._adaptHeightToChildren;
59
+ }
60
+ set adaptHeightToChildren(value) {
61
+ if (this._adaptHeightToChildren === value) {
62
+ return;
63
+ }
64
+ this._adaptHeightToChildren = value;
65
+ if (value) {
66
+ this.height = "100%";
67
+ }
68
+ this._markAsDirty();
69
+ }
70
+ /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
71
+ get adaptWidthToChildren() {
72
+ return this._adaptWidthToChildren;
73
+ }
74
+ set adaptWidthToChildren(value) {
75
+ if (this._adaptWidthToChildren === value) {
76
+ return;
77
+ }
78
+ this._adaptWidthToChildren = value;
79
+ if (value) {
80
+ this.width = "100%";
81
+ }
82
+ this._markAsDirty();
83
+ }
84
+ /** Gets or sets background color */
85
+ get background() {
86
+ return this._background;
87
+ }
88
+ set background(value) {
89
+ if (this._background === value) {
90
+ return;
91
+ }
92
+ this._background = value;
93
+ this._markAsDirty();
94
+ }
95
+ /** Gets the list of children */
96
+ get children() {
97
+ return this._children;
98
+ }
99
+ get isReadOnly() {
100
+ return this._isReadOnly;
101
+ }
102
+ set isReadOnly(value) {
103
+ this._isReadOnly = value;
104
+ for (const child of this._children) {
105
+ child.isReadOnly = value;
106
+ }
107
+ }
108
+ _getTypeName() {
136
109
  return "Container";
137
- };
138
- Container.prototype._flagDescendantsAsMatrixDirty = function () {
139
- for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
140
- var child = _a[_i];
110
+ }
111
+ _flagDescendantsAsMatrixDirty() {
112
+ for (const child of this.children) {
141
113
  child._isClipped = false;
142
114
  child._markMatrixAsDirty();
143
115
  }
144
- };
116
+ }
145
117
  /**
146
118
  * Gets a child using its name
147
119
  * @param name defines the child name to look for
148
120
  * @returns the child control if found
149
121
  */
150
- Container.prototype.getChildByName = function (name) {
151
- for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
152
- var child = _a[_i];
122
+ getChildByName(name) {
123
+ for (const child of this.children) {
153
124
  if (child.name === name) {
154
125
  return child;
155
126
  }
156
127
  }
157
128
  return null;
158
- };
129
+ }
159
130
  /**
160
131
  * Gets a child using its type and its name
161
132
  * @param name defines the child name to look for
162
133
  * @param type defines the child type to look for
163
134
  * @returns the child control if found
164
135
  */
165
- Container.prototype.getChildByType = function (name, type) {
166
- for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
167
- var child = _a[_i];
136
+ getChildByType(name, type) {
137
+ for (const child of this.children) {
168
138
  if (child.typeName === type) {
169
139
  return child;
170
140
  }
171
141
  }
172
142
  return null;
173
- };
143
+ }
174
144
  /**
175
145
  * Search for a specific control in children
176
146
  * @param control defines the control to look for
177
147
  * @returns true if the control is in child list
178
148
  */
179
- Container.prototype.containsControl = function (control) {
149
+ containsControl(control) {
180
150
  return this.children.indexOf(control) !== -1;
181
- };
151
+ }
182
152
  /**
183
153
  * Adds a new control to the current container
184
154
  * @param control defines the control to add
185
155
  * @returns the current container
186
156
  */
187
- Container.prototype.addControl = function (control) {
157
+ addControl(control) {
188
158
  if (!control) {
189
159
  return this;
190
160
  }
191
- var index = this._children.indexOf(control);
161
+ const index = this._children.indexOf(control);
192
162
  if (index !== -1) {
193
163
  return this;
194
164
  }
@@ -197,26 +167,25 @@ var Container = /** @class */ (function (_super) {
197
167
  this._reOrderControl(control);
198
168
  this._markAsDirty();
199
169
  return this;
200
- };
170
+ }
201
171
  /**
202
172
  * Removes all controls from the current container
203
173
  * @returns the current container
204
174
  */
205
- Container.prototype.clearControls = function () {
206
- var children = this.children.slice();
207
- for (var _i = 0, children_1 = children; _i < children_1.length; _i++) {
208
- var child = children_1[_i];
175
+ clearControls() {
176
+ const children = this.children.slice();
177
+ for (const child of children) {
209
178
  this.removeControl(child);
210
179
  }
211
180
  return this;
212
- };
181
+ }
213
182
  /**
214
183
  * Removes a control from the current container
215
184
  * @param control defines the control to remove
216
185
  * @returns the current container
217
186
  */
218
- Container.prototype.removeControl = function (control) {
219
- var index = this._children.indexOf(control);
187
+ removeControl(control) {
188
+ const index = this._children.indexOf(control);
220
189
  if (index !== -1) {
221
190
  this._children.splice(index, 1);
222
191
  control.parent = null;
@@ -227,16 +196,16 @@ var Container = /** @class */ (function (_super) {
227
196
  }
228
197
  this._markAsDirty();
229
198
  return this;
230
- };
199
+ }
231
200
  /**
232
201
  * @param control
233
202
  * @hidden
234
203
  */
235
- Container.prototype._reOrderControl = function (control) {
236
- var linkedMesh = control.linkedMesh;
204
+ _reOrderControl(control) {
205
+ const linkedMesh = control.linkedMesh;
237
206
  this.removeControl(control);
238
- var wasAdded = false;
239
- for (var index = 0; index < this._children.length; index++) {
207
+ let wasAdded = false;
208
+ for (let index = 0; index < this._children.length; index++) {
240
209
  if (this._children[index].zIndex > control.zIndex) {
241
210
  this._children.splice(index, 0, control);
242
211
  wasAdded = true;
@@ -251,41 +220,39 @@ var Container = /** @class */ (function (_super) {
251
220
  control.linkWithMesh(linkedMesh);
252
221
  }
253
222
  this._markAsDirty();
254
- };
223
+ }
255
224
  /**
256
225
  * @param offset
257
226
  * @hidden
258
227
  */
259
- Container.prototype._offsetLeft = function (offset) {
260
- _super.prototype._offsetLeft.call(this, offset);
261
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
262
- var child = _a[_i];
228
+ _offsetLeft(offset) {
229
+ super._offsetLeft(offset);
230
+ for (const child of this._children) {
263
231
  child._offsetLeft(offset);
264
232
  }
265
- };
233
+ }
266
234
  /**
267
235
  * @param offset
268
236
  * @hidden
269
237
  */
270
- Container.prototype._offsetTop = function (offset) {
271
- _super.prototype._offsetTop.call(this, offset);
272
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
273
- var child = _a[_i];
238
+ _offsetTop(offset) {
239
+ super._offsetTop(offset);
240
+ for (const child of this._children) {
274
241
  child._offsetTop(offset);
275
242
  }
276
- };
243
+ }
277
244
  /** @hidden */
278
- Container.prototype._markAllAsDirty = function () {
279
- _super.prototype._markAllAsDirty.call(this);
280
- for (var index = 0; index < this._children.length; index++) {
245
+ _markAllAsDirty() {
246
+ super._markAllAsDirty();
247
+ for (let index = 0; index < this._children.length; index++) {
281
248
  this._children[index]._markAllAsDirty();
282
249
  }
283
- };
250
+ }
284
251
  /**
285
252
  * @param context
286
253
  * @hidden
287
254
  */
288
- Container.prototype._localDraw = function (context) {
255
+ _localDraw(context) {
289
256
  if (this._background) {
290
257
  context.save();
291
258
  if (this.shadowBlur || this.shadowOffsetX || this.shadowOffsetY) {
@@ -298,30 +265,29 @@ var Container = /** @class */ (function (_super) {
298
265
  context.fillRect(this._currentMeasure.left, this._currentMeasure.top, this._currentMeasure.width, this._currentMeasure.height);
299
266
  context.restore();
300
267
  }
301
- };
268
+ }
302
269
  /**
303
270
  * @param host
304
271
  * @hidden
305
272
  */
306
- Container.prototype._link = function (host) {
307
- _super.prototype._link.call(this, host);
308
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
309
- var child = _a[_i];
273
+ _link(host) {
274
+ super._link(host);
275
+ for (const child of this._children) {
310
276
  child._link(host);
311
277
  }
312
- };
278
+ }
313
279
  /** @hidden */
314
- Container.prototype._beforeLayout = function () {
280
+ _beforeLayout() {
315
281
  // Do nothing
316
- };
282
+ }
317
283
  /**
318
284
  * @param parentMeasure
319
285
  * @param context
320
286
  * @hidden
321
287
  */
322
- Container.prototype._processMeasures = function (parentMeasure, context) {
288
+ _processMeasures(parentMeasure, context) {
323
289
  if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
324
- _super.prototype._processMeasures.call(this, parentMeasure, context);
290
+ super._processMeasures(parentMeasure, context);
325
291
  this._evaluateClippingState(parentMeasure);
326
292
  if (this._renderToIntermediateTexture) {
327
293
  if (this._intermediateTexture && this._host.getScene() != this._intermediateTexture.getScene()) {
@@ -337,14 +303,13 @@ var Container = /** @class */ (function (_super) {
337
303
  }
338
304
  }
339
305
  }
340
- };
306
+ }
341
307
  /**
342
308
  * @param parentMeasure
343
309
  * @param context
344
310
  * @hidden
345
311
  */
346
- Container.prototype._layout = function (parentMeasure, context) {
347
- var _a, _b;
312
+ _layout(parentMeasure, context) {
348
313
  if (!this.isDirty && (!this.isVisible || this.notRenderable)) {
349
314
  return false;
350
315
  }
@@ -352,18 +317,17 @@ var Container = /** @class */ (function (_super) {
352
317
  if (this._isDirty) {
353
318
  this._currentMeasure.transformToRef(this._transformMatrix, this._prevCurrentMeasureTransformedIntoGlobalSpace);
354
319
  }
355
- var rebuildCount = 0;
320
+ let rebuildCount = 0;
356
321
  context.save();
357
322
  this._applyStates(context);
358
323
  this._beforeLayout();
359
324
  do {
360
- var computedWidth = -1;
361
- var computedHeight = -1;
325
+ let computedWidth = -1;
326
+ let computedHeight = -1;
362
327
  this._rebuildLayout = false;
363
328
  this._processMeasures(parentMeasure, context);
364
329
  if (!this._isClipped) {
365
- for (var _i = 0, _c = this._children; _i < _c.length; _i++) {
366
- var child = _c[_i];
330
+ for (const child of this._children) {
367
331
  child._tempParentMeasure.copyFrom(this._measureForChildren);
368
332
  if (child._layout(this._measureForChildren, context)) {
369
333
  if (child.isVisible && !child.notRenderable) {
@@ -379,7 +343,7 @@ var Container = /** @class */ (function (_super) {
379
343
  if (this.adaptWidthToChildren && computedWidth >= 0) {
380
344
  computedWidth += this.paddingLeftInPixels + this.paddingRightInPixels;
381
345
  if (this.width !== computedWidth + "px") {
382
- (_a = this.parent) === null || _a === void 0 ? void 0 : _a._markAsDirty();
346
+ this.parent?._markAsDirty();
383
347
  this.width = computedWidth + "px";
384
348
  this._width.ignoreAdaptiveScaling = true;
385
349
  this._rebuildLayout = true;
@@ -388,7 +352,7 @@ var Container = /** @class */ (function (_super) {
388
352
  if (this.adaptHeightToChildren && computedHeight >= 0) {
389
353
  computedHeight += this.paddingTopInPixels + this.paddingBottomInPixels;
390
354
  if (this.height !== computedHeight + "px") {
391
- (_b = this.parent) === null || _b === void 0 ? void 0 : _b._markAsDirty();
355
+ this.parent?._markAsDirty();
392
356
  this.height = computedHeight + "px";
393
357
  this._height.ignoreAdaptiveScaling = true;
394
358
  this._rebuildLayout = true;
@@ -399,7 +363,7 @@ var Container = /** @class */ (function (_super) {
399
363
  rebuildCount++;
400
364
  } while (this._rebuildLayout && rebuildCount < this.maxLayoutCycle);
401
365
  if (rebuildCount >= 3 && this.logLayoutCycleErrors) {
402
- Logger.Error("Layout cycle detected in GUI (Container name=".concat(this.name, ", uniqueId=").concat(this.uniqueId, ")"));
366
+ Logger.Error(`Layout cycle detected in GUI (Container name=${this.name}, uniqueId=${this.uniqueId})`);
403
367
  }
404
368
  context.restore();
405
369
  if (this._isDirty) {
@@ -407,18 +371,18 @@ var Container = /** @class */ (function (_super) {
407
371
  this._isDirty = false;
408
372
  }
409
373
  return true;
410
- };
411
- Container.prototype._postMeasure = function () {
374
+ }
375
+ _postMeasure() {
412
376
  // Do nothing by default
413
- };
377
+ }
414
378
  /**
415
379
  * @param context
416
380
  * @param invalidatedRectangle
417
381
  * @hidden
418
382
  */
419
- Container.prototype._draw = function (context, invalidatedRectangle) {
420
- var renderToIntermediateTextureThisDraw = this._renderToIntermediateTexture && this._intermediateTexture;
421
- var contextToDrawTo = renderToIntermediateTextureThisDraw ? this._intermediateTexture.getContext() : context;
383
+ _draw(context, invalidatedRectangle) {
384
+ const renderToIntermediateTextureThisDraw = this._renderToIntermediateTexture && this._intermediateTexture;
385
+ const contextToDrawTo = renderToIntermediateTextureThisDraw ? this._intermediateTexture.getContext() : context;
422
386
  if (renderToIntermediateTextureThisDraw) {
423
387
  contextToDrawTo.save();
424
388
  contextToDrawTo.translate(-this._currentMeasure.left, -this._currentMeasure.top);
@@ -434,8 +398,7 @@ var Container = /** @class */ (function (_super) {
434
398
  if (this.clipChildren) {
435
399
  this._clipForChildren(contextToDrawTo);
436
400
  }
437
- for (var _i = 0, _a = this._children; _i < _a.length; _i++) {
438
- var child = _a[_i];
401
+ for (const child of this._children) {
439
402
  // Only redraw parts of the screen that are invalidated
440
403
  if (invalidatedRectangle) {
441
404
  if (!child._intersectsRect(invalidatedRectangle)) {
@@ -452,14 +415,13 @@ var Container = /** @class */ (function (_super) {
452
415
  context.restore();
453
416
  }
454
417
  context.restore();
455
- };
456
- Container.prototype.getDescendantsToRef = function (results, directDescendantsOnly, predicate) {
457
- if (directDescendantsOnly === void 0) { directDescendantsOnly = false; }
418
+ }
419
+ getDescendantsToRef(results, directDescendantsOnly = false, predicate) {
458
420
  if (!this.children) {
459
421
  return;
460
422
  }
461
- for (var index = 0; index < this.children.length; index++) {
462
- var item = this.children[index];
423
+ for (let index = 0; index < this.children.length; index++) {
424
+ const item = this.children[index];
463
425
  if (!predicate || predicate(item)) {
464
426
  results.push(item);
465
427
  }
@@ -467,7 +429,7 @@ var Container = /** @class */ (function (_super) {
467
429
  item.getDescendantsToRef(results, false, predicate);
468
430
  }
469
431
  }
470
- };
432
+ }
471
433
  /**
472
434
  * @param x
473
435
  * @param y
@@ -479,19 +441,19 @@ var Container = /** @class */ (function (_super) {
479
441
  * @param deltaY
480
442
  * @hidden
481
443
  */
482
- Container.prototype._processPicking = function (x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {
444
+ _processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY) {
483
445
  if (!this._isEnabled || !this.isVisible || this.notRenderable) {
484
446
  return false;
485
447
  }
486
448
  // checks if the picking position is within the container
487
- var contains = _super.prototype.contains.call(this, x, y);
449
+ const contains = super.contains(x, y);
488
450
  // if clipChildren is off, we should still pass picking events to children even if we don't contain the pointer
489
451
  if (!contains && this.clipChildren) {
490
452
  return false;
491
453
  }
492
454
  // Checking backwards to pick closest first
493
- for (var index = this._children.length - 1; index >= 0; index--) {
494
- var child = this._children[index];
455
+ for (let index = this._children.length - 1; index >= 0; index--) {
456
+ const child = this._children[index];
495
457
  if (child._processPicking(x, y, pi, type, pointerId, buttonIndex, deltaX, deltaY)) {
496
458
  if (child.hoverCursor) {
497
459
  this._host._changeCursor(child.hoverCursor);
@@ -506,75 +468,70 @@ var Container = /** @class */ (function (_super) {
506
468
  return false;
507
469
  }
508
470
  return this._processObservables(type, x, y, pi, pointerId, buttonIndex, deltaX, deltaY);
509
- };
471
+ }
510
472
  /**
511
473
  * @param parentMeasure
512
474
  * @param context
513
475
  * @hidden
514
476
  */
515
- Container.prototype._additionalProcessing = function (parentMeasure, context) {
516
- _super.prototype._additionalProcessing.call(this, parentMeasure, context);
477
+ _additionalProcessing(parentMeasure, context) {
478
+ super._additionalProcessing(parentMeasure, context);
517
479
  this._measureForChildren.copyFrom(this._currentMeasure);
518
- };
480
+ }
519
481
  /**
520
482
  * Serializes the current control
521
483
  * @param serializationObject defined the JSON serialized object
522
484
  */
523
- Container.prototype.serialize = function (serializationObject) {
524
- _super.prototype.serialize.call(this, serializationObject);
485
+ serialize(serializationObject) {
486
+ super.serialize(serializationObject);
525
487
  if (!this.children.length) {
526
488
  return;
527
489
  }
528
490
  serializationObject.children = [];
529
- for (var _i = 0, _a = this.children; _i < _a.length; _i++) {
530
- var child = _a[_i];
531
- var childSerializationObject = {};
491
+ for (const child of this.children) {
492
+ const childSerializationObject = {};
532
493
  child.serialize(childSerializationObject);
533
494
  serializationObject.children.push(childSerializationObject);
534
495
  }
535
- };
496
+ }
536
497
  /** Releases associated resources */
537
- Container.prototype.dispose = function () {
538
- var _a;
539
- _super.prototype.dispose.call(this);
540
- for (var index = this.children.length - 1; index >= 0; index--) {
498
+ dispose() {
499
+ super.dispose();
500
+ for (let index = this.children.length - 1; index >= 0; index--) {
541
501
  this.children[index].dispose();
542
502
  }
543
- (_a = this._intermediateTexture) === null || _a === void 0 ? void 0 : _a.dispose();
544
- };
503
+ this._intermediateTexture?.dispose();
504
+ }
545
505
  /**
546
506
  * @param serializedObject
547
507
  * @param host
548
508
  * @hidden
549
509
  */
550
- Container.prototype._parseFromContent = function (serializedObject, host) {
551
- _super.prototype._parseFromContent.call(this, serializedObject, host);
510
+ _parseFromContent(serializedObject, host) {
511
+ super._parseFromContent(serializedObject, host);
552
512
  this._link(host);
553
513
  if (!serializedObject.children) {
554
514
  return;
555
515
  }
556
- for (var _i = 0, _a = serializedObject.children; _i < _a.length; _i++) {
557
- var childData = _a[_i];
516
+ for (const childData of serializedObject.children) {
558
517
  this.addControl(Control.Parse(childData, host));
559
518
  }
560
- };
561
- __decorate([
562
- serialize()
563
- ], Container.prototype, "renderToIntermediateTexture", null);
564
- __decorate([
565
- serialize()
566
- ], Container.prototype, "maxLayoutCycle", void 0);
567
- __decorate([
568
- serialize()
569
- ], Container.prototype, "adaptHeightToChildren", null);
570
- __decorate([
571
- serialize()
572
- ], Container.prototype, "adaptWidthToChildren", null);
573
- __decorate([
574
- serialize()
575
- ], Container.prototype, "background", null);
576
- return Container;
577
- }(Control));
578
- export { Container };
519
+ }
520
+ }
521
+ __decorate([
522
+ serialize()
523
+ ], Container.prototype, "renderToIntermediateTexture", null);
524
+ __decorate([
525
+ serialize()
526
+ ], Container.prototype, "maxLayoutCycle", void 0);
527
+ __decorate([
528
+ serialize()
529
+ ], Container.prototype, "adaptHeightToChildren", null);
530
+ __decorate([
531
+ serialize()
532
+ ], Container.prototype, "adaptWidthToChildren", null);
533
+ __decorate([
534
+ serialize()
535
+ ], Container.prototype, "background", null);
579
536
  RegisterClass("BABYLON.GUI.Container", Container);
580
537
  //# sourceMappingURL=container.js.map