@babylonjs/gui 9.14.0 → 9.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/2D/advancedDynamicTexture.d.ts +2 -2
  2. package/2D/advancedDynamicTexture.js +2 -2
  3. package/2D/advancedDynamicTexture.js.map +1 -1
  4. package/2D/controls/checkbox.pure.js +164 -153
  5. package/2D/controls/checkbox.pure.js.map +1 -1
  6. package/2D/controls/colorpicker.pure.js +1300 -1289
  7. package/2D/controls/colorpicker.pure.js.map +1 -1
  8. package/2D/controls/container.pure.js +597 -582
  9. package/2D/controls/container.pure.js.map +1 -1
  10. package/2D/controls/control.pure.js +2474 -2434
  11. package/2D/controls/control.pure.js.map +1 -1
  12. package/2D/controls/displayGrid.pure.js +201 -190
  13. package/2D/controls/displayGrid.pure.js.map +1 -1
  14. package/2D/controls/ellipse.pure.js +96 -85
  15. package/2D/controls/ellipse.pure.js.map +1 -1
  16. package/2D/controls/grid.pure.js +511 -500
  17. package/2D/controls/grid.pure.js.map +1 -1
  18. package/2D/controls/image.pure.js +888 -877
  19. package/2D/controls/image.pure.js.map +1 -1
  20. package/2D/controls/inputText.pure.js +988 -973
  21. package/2D/controls/inputText.pure.js.map +1 -1
  22. package/2D/controls/inputTextArea.pure.js +955 -944
  23. package/2D/controls/inputTextArea.pure.js.map +1 -1
  24. package/2D/controls/line.pure.js +237 -226
  25. package/2D/controls/line.pure.js.map +1 -1
  26. package/2D/controls/multiLine.pure.js +233 -222
  27. package/2D/controls/multiLine.pure.js.map +1 -1
  28. package/2D/controls/radioButton.pure.js +182 -169
  29. package/2D/controls/radioButton.pure.js.map +1 -1
  30. package/2D/controls/rectangle.pure.js +211 -200
  31. package/2D/controls/rectangle.pure.js.map +1 -1
  32. package/2D/controls/scrollViewers/scrollViewer.pure.js +579 -567
  33. package/2D/controls/scrollViewers/scrollViewer.pure.js.map +1 -1
  34. package/2D/controls/scrollViewers/scrollViewerWindow.d.ts +1 -1
  35. package/2D/controls/scrollViewers/scrollViewerWindow.js +2 -2
  36. package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
  37. package/2D/controls/selector.d.ts +2 -2
  38. package/2D/controls/selector.js +8 -8
  39. package/2D/controls/selector.js.map +1 -1
  40. package/2D/controls/sliders/baseSlider.d.ts +1 -1
  41. package/2D/controls/sliders/baseSlider.js +292 -281
  42. package/2D/controls/sliders/baseSlider.js.map +1 -1
  43. package/2D/controls/sliders/imageBasedSlider.pure.js +158 -147
  44. package/2D/controls/sliders/imageBasedSlider.pure.js.map +1 -1
  45. package/2D/controls/sliders/imageScrollBar.js +237 -223
  46. package/2D/controls/sliders/imageScrollBar.js.map +1 -1
  47. package/2D/controls/sliders/scrollBar.pure.js +169 -158
  48. package/2D/controls/sliders/scrollBar.pure.js.map +1 -1
  49. package/2D/controls/sliders/slider.pure.js +251 -240
  50. package/2D/controls/sliders/slider.pure.js.map +1 -1
  51. package/2D/controls/stackPanel.pure.js +236 -221
  52. package/2D/controls/stackPanel.pure.js.map +1 -1
  53. package/2D/controls/textBlock.pure.js +637 -626
  54. package/2D/controls/textBlock.pure.js.map +1 -1
  55. package/2D/math2D.d.ts +1 -1
  56. package/2D/math2D.js +1 -1
  57. package/2D/math2D.js.map +1 -1
  58. package/2D/measure.js +1 -1
  59. package/2D/measure.js.map +1 -1
  60. package/3D/controls/MRTK3/touchHolographicButton.d.ts +4 -4
  61. package/3D/controls/MRTK3/touchHolographicButton.js +10 -10
  62. package/3D/controls/MRTK3/touchHolographicButton.js.map +1 -1
  63. package/3D/controls/holographicBackplate.d.ts +1 -1
  64. package/3D/controls/holographicBackplate.js +1 -1
  65. package/3D/controls/holographicBackplate.js.map +1 -1
  66. package/3D/controls/holographicButton.d.ts +1 -1
  67. package/3D/controls/holographicButton.js +4 -4
  68. package/3D/controls/holographicButton.js.map +1 -1
  69. package/3D/controls/holographicSlate.js +4 -4
  70. package/3D/controls/holographicSlate.js.map +1 -1
  71. package/3D/controls/slider3D.d.ts +3 -3
  72. package/3D/controls/slider3D.js +3 -3
  73. package/3D/controls/slider3D.js.map +1 -1
  74. package/3D/controls/touchHolographicButton.d.ts +2 -2
  75. package/3D/controls/touchHolographicButton.js +5 -5
  76. package/3D/controls/touchHolographicButton.js.map +1 -1
  77. package/3D/controls/touchHolographicMenu.js +1 -1
  78. package/3D/controls/touchHolographicMenu.js.map +1 -1
  79. package/3D/gizmos/gizmoHandle.d.ts +1 -1
  80. package/3D/gizmos/gizmoHandle.js +1 -1
  81. package/3D/gizmos/gizmoHandle.js.map +1 -1
  82. package/3D/materials/fluent/fluentMaterial.pure.d.ts +4 -4
  83. package/3D/materials/fluent/fluentMaterial.pure.js +322 -270
  84. package/3D/materials/fluent/fluentMaterial.pure.js.map +1 -1
  85. package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.js +510 -451
  86. package/3D/materials/fluentBackplate/fluentBackplateMaterial.pure.js.map +1 -1
  87. package/3D/materials/fluentButton/fluentButtonMaterial.pure.js +612 -526
  88. package/3D/materials/fluentButton/fluentButtonMaterial.pure.js.map +1 -1
  89. package/3D/materials/fluentMaterial.d.ts +1 -1
  90. package/3D/materials/fluentMaterial.js +1 -1
  91. package/3D/materials/fluentMaterial.js.map +1 -1
  92. package/3D/materials/handle/handleMaterial.pure.js +3 -1
  93. package/3D/materials/handle/handleMaterial.pure.js.map +1 -1
  94. package/3D/materials/mrdl/mrdlBackglowMaterial.pure.js +313 -271
  95. package/3D/materials/mrdl/mrdlBackglowMaterial.pure.js.map +1 -1
  96. package/3D/materials/mrdl/mrdlBackplateMaterial.pure.js +462 -402
  97. package/3D/materials/mrdl/mrdlBackplateMaterial.pure.js.map +1 -1
  98. package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.js +583 -498
  99. package/3D/materials/mrdl/mrdlFrontplateMaterial.pure.js.map +1 -1
  100. package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.js +226 -200
  101. package/3D/materials/mrdl/mrdlInnerquadMaterial.pure.js.map +1 -1
  102. package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.js +961 -822
  103. package/3D/materials/mrdl/mrdlSliderBarMaterial.pure.js.map +1 -1
  104. package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.js +961 -822
  105. package/3D/materials/mrdl/mrdlSliderThumbMaterial.pure.js.map +1 -1
  106. package/package.json +2 -2
@@ -1,4 +1,4 @@
1
- import { __decorate } from "@babylonjs/core/tslib.es6.js";
1
+ import { __esDecorate, __runInitializers } from "@babylonjs/core/tslib.es6.js";
2
2
  import { Container } from "./container.pure.js";
3
3
  import { Control } from "./control.pure.js";
4
4
  import { RegisterClass } from "@babylonjs/core/Misc/typeStore.js";
@@ -7,241 +7,256 @@ import { Logger } from "@babylonjs/core/Misc/logger.js";
7
7
  /**
8
8
  * Class used to create a 2D stack panel container
9
9
  */
10
- export class StackPanel extends Container {
11
- /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
12
- get isVertical() {
13
- return this._isVertical;
14
- }
15
- set isVertical(value) {
16
- if (this._isVertical === value) {
17
- return;
18
- }
19
- this._isVertical = value;
20
- this._markAsDirty();
21
- }
22
- /**
23
- * Gets or sets the spacing (in pixels) between each child.
24
- */
25
- get spacing() {
26
- return this._spacing;
27
- }
28
- set spacing(value) {
29
- if (this._spacing === value) {
30
- return;
31
- }
32
- this._spacing = value;
33
- this._markAsDirty();
34
- }
35
- /**
36
- * Gets or sets panel width.
37
- * This value should not be set when in horizontal mode as it will be computed automatically
38
- */
39
- set width(value) {
40
- if (!this._doNotTrackManualChanges) {
41
- this._manualWidth = true;
42
- }
43
- if (this._width.toString(this._host) === value) {
44
- return;
45
- }
46
- if (this._width.fromString(value)) {
47
- this._markAsDirty();
48
- }
49
- }
50
- get width() {
51
- return this._width.toString(this._host);
52
- }
53
- /**
54
- * Gets or sets panel height.
55
- * This value should not be set when in vertical mode as it will be computed automatically
56
- */
57
- set height(value) {
58
- if (!this._doNotTrackManualChanges) {
59
- this._manualHeight = true;
60
- }
61
- if (this._height.toString(this._host) === value) {
62
- return;
63
- }
64
- if (this._height.fromString(value)) {
65
- this._markAsDirty();
66
- }
67
- }
68
- get height() {
69
- return this._height.toString(this._host);
70
- }
71
- /**
72
- * Creates a new StackPanel
73
- * @param name defines control name
74
- */
75
- constructor(name) {
76
- super(name);
77
- this.name = name;
78
- this._isVertical = true;
79
- this._manualWidth = false;
80
- this._manualHeight = false;
81
- this._doNotTrackManualChanges = false;
82
- this._spacing = 0;
83
- /**
84
- * Gets or sets a boolean indicating that layout warnings should be ignored
85
- */
86
- this.ignoreLayoutWarnings = false;
87
- }
88
- _getTypeName() {
89
- return "StackPanel";
90
- }
91
- /**
92
- * @internal
93
- */
94
- _preMeasure(parentMeasure, context) {
95
- for (const child of this._children) {
96
- if (this._isVertical) {
97
- child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
10
+ let StackPanel = (() => {
11
+ var _a;
12
+ let _classSuper = Container;
13
+ let _instanceExtraInitializers = [];
14
+ let _ignoreLayoutWarnings_decorators;
15
+ let _ignoreLayoutWarnings_initializers = [];
16
+ let _ignoreLayoutWarnings_extraInitializers = [];
17
+ let _get_isVertical_decorators;
18
+ let _get_spacing_decorators;
19
+ let _set_width_decorators;
20
+ let _set_height_decorators;
21
+ return _a = class StackPanel extends _classSuper {
22
+ /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
23
+ get isVertical() {
24
+ return this._isVertical;
98
25
  }
99
- else {
100
- child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
26
+ set isVertical(value) {
27
+ if (this._isVertical === value) {
28
+ return;
29
+ }
30
+ this._isVertical = value;
31
+ this._markAsDirty();
101
32
  }
102
- }
103
- super._preMeasure(parentMeasure, context);
104
- }
105
- _additionalProcessing(parentMeasure, context) {
106
- super._additionalProcessing(parentMeasure, context);
107
- this._measureForChildren.copyFrom(parentMeasure);
108
- this._measureForChildren.left = this._currentMeasure.left;
109
- this._measureForChildren.top = this._currentMeasure.top;
110
- if (!this.isVertical || this._manualWidth) {
111
- this._measureForChildren.width = this._currentMeasure.width;
112
- }
113
- if (this.isVertical || this._manualHeight) {
114
- this._measureForChildren.height = this._currentMeasure.height;
115
- }
116
- }
117
- _postMeasure() {
118
- let stackWidth = 0;
119
- let stackHeight = 0;
120
- const childrenCount = this._children.length;
121
- // Calculate scaled spacing using idealRatio (same pattern as shadowOffset)
122
- const scaledSpacing = this._spacing * this._host.idealRatio;
123
- for (let index = 0; index < childrenCount; index++) {
124
- const child = this._children[index];
125
- if (!child.isVisible || child.notRenderable) {
126
- continue;
33
+ /**
34
+ * Gets or sets the spacing (in pixels) between each child.
35
+ */
36
+ get spacing() {
37
+ return this._spacing;
127
38
  }
128
- if (this._isVertical) {
129
- const top = stackHeight + "px";
130
- if (child.top !== top) {
131
- child.top = top;
132
- this._rebuildLayout = true;
133
- child._top.ignoreAdaptiveScaling = true;
39
+ set spacing(value) {
40
+ if (this._spacing === value) {
41
+ return;
42
+ }
43
+ this._spacing = value;
44
+ this._markAsDirty();
45
+ }
46
+ /**
47
+ * Gets or sets panel width.
48
+ * This value should not be set when in horizontal mode as it will be computed automatically
49
+ */
50
+ set width(value) {
51
+ if (!this._doNotTrackManualChanges) {
52
+ this._manualWidth = true;
134
53
  }
135
- if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined("height")) {
136
- Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using height in percentage mode inside a vertical StackPanel`, 1);
54
+ if (this._width.toString(this._host) === value) {
55
+ return;
137
56
  }
138
- else {
139
- stackHeight += child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels + (index < childrenCount - 1 ? scaledSpacing : 0);
57
+ if (this._width.fromString(value)) {
58
+ this._markAsDirty();
140
59
  }
141
60
  }
142
- else {
143
- const left = stackWidth + "px";
144
- if (child.left !== left) {
145
- child.left = left;
61
+ get width() {
62
+ return this._width.toString(this._host);
63
+ }
64
+ /**
65
+ * Gets or sets panel height.
66
+ * This value should not be set when in vertical mode as it will be computed automatically
67
+ */
68
+ set height(value) {
69
+ if (!this._doNotTrackManualChanges) {
70
+ this._manualHeight = true;
71
+ }
72
+ if (this._height.toString(this._host) === value) {
73
+ return;
74
+ }
75
+ if (this._height.fromString(value)) {
76
+ this._markAsDirty();
77
+ }
78
+ }
79
+ get height() {
80
+ return this._height.toString(this._host);
81
+ }
82
+ /**
83
+ * Creates a new StackPanel
84
+ * @param name defines control name
85
+ */
86
+ constructor(name) {
87
+ super(name);
88
+ this.name = (__runInitializers(this, _instanceExtraInitializers), name);
89
+ this._isVertical = true;
90
+ this._manualWidth = false;
91
+ this._manualHeight = false;
92
+ this._doNotTrackManualChanges = false;
93
+ this._spacing = 0;
94
+ /**
95
+ * Gets or sets a boolean indicating that layout warnings should be ignored
96
+ */
97
+ this.ignoreLayoutWarnings = __runInitializers(this, _ignoreLayoutWarnings_initializers, false);
98
+ __runInitializers(this, _ignoreLayoutWarnings_extraInitializers);
99
+ this.name = name;
100
+ }
101
+ _getTypeName() {
102
+ return "StackPanel";
103
+ }
104
+ /**
105
+ * @internal
106
+ */
107
+ _preMeasure(parentMeasure, context) {
108
+ for (const child of this._children) {
109
+ if (this._isVertical) {
110
+ child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;
111
+ }
112
+ else {
113
+ child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;
114
+ }
115
+ }
116
+ super._preMeasure(parentMeasure, context);
117
+ }
118
+ _additionalProcessing(parentMeasure, context) {
119
+ super._additionalProcessing(parentMeasure, context);
120
+ this._measureForChildren.copyFrom(parentMeasure);
121
+ this._measureForChildren.left = this._currentMeasure.left;
122
+ this._measureForChildren.top = this._currentMeasure.top;
123
+ if (!this.isVertical || this._manualWidth) {
124
+ this._measureForChildren.width = this._currentMeasure.width;
125
+ }
126
+ if (this.isVertical || this._manualHeight) {
127
+ this._measureForChildren.height = this._currentMeasure.height;
128
+ }
129
+ }
130
+ _postMeasure() {
131
+ let stackWidth = 0;
132
+ let stackHeight = 0;
133
+ const childrenCount = this._children.length;
134
+ // Calculate scaled spacing using idealRatio (same pattern as shadowOffset)
135
+ const scaledSpacing = this._spacing * this._host.idealRatio;
136
+ for (let index = 0; index < childrenCount; index++) {
137
+ const child = this._children[index];
138
+ if (!child.isVisible || child.notRenderable) {
139
+ continue;
140
+ }
141
+ if (this._isVertical) {
142
+ const top = stackHeight + "px";
143
+ if (child.top !== top) {
144
+ child.top = top;
145
+ this._rebuildLayout = true;
146
+ child._top.ignoreAdaptiveScaling = true;
147
+ }
148
+ if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined("height")) {
149
+ Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using height in percentage mode inside a vertical StackPanel`, 1);
150
+ }
151
+ else {
152
+ stackHeight += child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels + (index < childrenCount - 1 ? scaledSpacing : 0);
153
+ }
154
+ }
155
+ else {
156
+ const left = stackWidth + "px";
157
+ if (child.left !== left) {
158
+ child.left = left;
159
+ this._rebuildLayout = true;
160
+ child._left.ignoreAdaptiveScaling = true;
161
+ }
162
+ if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined("width")) {
163
+ Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using width in percentage mode inside a horizontal StackPanel`, 1);
164
+ }
165
+ else {
166
+ stackWidth += child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels + (index < childrenCount - 1 ? scaledSpacing : 0);
167
+ }
168
+ }
169
+ }
170
+ stackWidth += this._paddingLeftInPixels + this._paddingRightInPixels;
171
+ stackHeight += this._paddingTopInPixels + this._paddingBottomInPixels;
172
+ this._doNotTrackManualChanges = true;
173
+ // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.
174
+ // User can now define their own height and width for stack panel.
175
+ let panelWidthChanged = false;
176
+ let panelHeightChanged = false;
177
+ if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {
178
+ // do not specify height if strictly defined by user
179
+ const previousHeight = this.height;
180
+ this.height = stackHeight + "px";
181
+ panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;
182
+ }
183
+ if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {
184
+ // do not specify width if strictly defined by user
185
+ const previousWidth = this.width;
186
+ this.width = stackWidth + "px";
187
+ panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;
188
+ }
189
+ if (panelHeightChanged) {
190
+ this._height.ignoreAdaptiveScaling = true;
191
+ }
192
+ if (panelWidthChanged) {
193
+ this._width.ignoreAdaptiveScaling = true;
194
+ }
195
+ this._doNotTrackManualChanges = false;
196
+ if (panelWidthChanged || panelHeightChanged) {
146
197
  this._rebuildLayout = true;
147
- child._left.ignoreAdaptiveScaling = true;
148
198
  }
149
- if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined("width")) {
150
- Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using width in percentage mode inside a horizontal StackPanel`, 1);
199
+ super._postMeasure();
200
+ }
201
+ _getManualDim(dim) {
202
+ if (dim === "width") {
203
+ return this._manualWidth;
151
204
  }
152
205
  else {
153
- stackWidth += child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels + (index < childrenCount - 1 ? scaledSpacing : 0);
206
+ return this._manualHeight;
154
207
  }
155
208
  }
156
- }
157
- stackWidth += this._paddingLeftInPixels + this._paddingRightInPixels;
158
- stackHeight += this._paddingTopInPixels + this._paddingBottomInPixels;
159
- this._doNotTrackManualChanges = true;
160
- // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.
161
- // User can now define their own height and width for stack panel.
162
- let panelWidthChanged = false;
163
- let panelHeightChanged = false;
164
- if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {
165
- // do not specify height if strictly defined by user
166
- const previousHeight = this.height;
167
- this.height = stackHeight + "px";
168
- panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;
169
- }
170
- if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {
171
- // do not specify width if strictly defined by user
172
- const previousWidth = this.width;
173
- this.width = stackWidth + "px";
174
- panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;
175
- }
176
- if (panelHeightChanged) {
177
- this._height.ignoreAdaptiveScaling = true;
178
- }
179
- if (panelWidthChanged) {
180
- this._width.ignoreAdaptiveScaling = true;
181
- }
182
- this._doNotTrackManualChanges = false;
183
- if (panelWidthChanged || panelHeightChanged) {
184
- this._rebuildLayout = true;
185
- }
186
- super._postMeasure();
187
- }
188
- _getManualDim(dim) {
189
- if (dim === "width") {
190
- return this._manualWidth;
191
- }
192
- else {
193
- return this._manualHeight;
194
- }
195
- }
196
- isDimensionFullyDefined(dim) {
197
- if (dim === "height" ? this.isVertical : !this.isVertical && !this._getManualDim(dim)) {
198
- for (const child of this._children) {
199
- if (!child.isDimensionFullyDefined(dim)) {
200
- return false;
209
+ isDimensionFullyDefined(dim) {
210
+ if (dim === "height" ? this.isVertical : !this.isVertical && !this._getManualDim(dim)) {
211
+ for (const child of this._children) {
212
+ if (!child.isDimensionFullyDefined(dim)) {
213
+ return false;
214
+ }
215
+ }
216
+ return true;
201
217
  }
218
+ return this.getDimension(dim).isPixel || this._getAdaptDimTo(dim);
202
219
  }
203
- return true;
204
- }
205
- return this.getDimension(dim).isPixel || this._getAdaptDimTo(dim);
206
- }
207
- /**
208
- * Serializes the current control
209
- * @param serializationObject defined the JSON serialized object
210
- * @param force force serialization even if isSerializable === false
211
- * @param allowCanvas defines if the control is allowed to use a Canvas2D object to serialize
212
- */
213
- serialize(serializationObject, force, allowCanvas) {
214
- super.serialize(serializationObject, force, allowCanvas);
215
- if (!this.isSerializable && !force) {
216
- return;
217
- }
218
- serializationObject.manualWidth = this._manualWidth;
219
- serializationObject.manualHeight = this._manualHeight;
220
- }
221
- /**
222
- * @internal
223
- */
224
- _parseFromContent(serializedObject, host) {
225
- this._manualWidth = serializedObject.manualWidth;
226
- this._manualHeight = serializedObject.manualHeight;
227
- super._parseFromContent(serializedObject, host);
228
- }
229
- }
230
- __decorate([
231
- serialize()
232
- ], StackPanel.prototype, "ignoreLayoutWarnings", void 0);
233
- __decorate([
234
- serialize()
235
- ], StackPanel.prototype, "isVertical", null);
236
- __decorate([
237
- serialize()
238
- ], StackPanel.prototype, "spacing", null);
239
- __decorate([
240
- serialize()
241
- ], StackPanel.prototype, "width", null);
242
- __decorate([
243
- serialize()
244
- ], StackPanel.prototype, "height", null);
220
+ /**
221
+ * Serializes the current control
222
+ * @param serializationObject defined the JSON serialized object
223
+ * @param force force serialization even if isSerializable === false
224
+ * @param allowCanvas defines if the control is allowed to use a Canvas2D object to serialize
225
+ */
226
+ serialize(serializationObject, force, allowCanvas) {
227
+ super.serialize(serializationObject, force, allowCanvas);
228
+ if (!this.isSerializable && !force) {
229
+ return;
230
+ }
231
+ serializationObject.manualWidth = this._manualWidth;
232
+ serializationObject.manualHeight = this._manualHeight;
233
+ }
234
+ /**
235
+ * @internal
236
+ */
237
+ _parseFromContent(serializedObject, host) {
238
+ this._manualWidth = serializedObject.manualWidth;
239
+ this._manualHeight = serializedObject.manualHeight;
240
+ super._parseFromContent(serializedObject, host);
241
+ }
242
+ },
243
+ (() => {
244
+ const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
245
+ _ignoreLayoutWarnings_decorators = [serialize()];
246
+ _get_isVertical_decorators = [serialize()];
247
+ _get_spacing_decorators = [serialize()];
248
+ _set_width_decorators = [serialize()];
249
+ _set_height_decorators = [serialize()];
250
+ __esDecorate(_a, null, _get_isVertical_decorators, { kind: "getter", name: "isVertical", static: false, private: false, access: { has: obj => "isVertical" in obj, get: obj => obj.isVertical }, metadata: _metadata }, null, _instanceExtraInitializers);
251
+ __esDecorate(_a, null, _get_spacing_decorators, { kind: "getter", name: "spacing", static: false, private: false, access: { has: obj => "spacing" in obj, get: obj => obj.spacing }, metadata: _metadata }, null, _instanceExtraInitializers);
252
+ __esDecorate(_a, null, _set_width_decorators, { kind: "setter", name: "width", static: false, private: false, access: { has: obj => "width" in obj, set: (obj, value) => { obj.width = value; } }, metadata: _metadata }, null, _instanceExtraInitializers);
253
+ __esDecorate(_a, null, _set_height_decorators, { kind: "setter", name: "height", static: false, private: false, access: { has: obj => "height" in obj, set: (obj, value) => { obj.height = value; } }, metadata: _metadata }, null, _instanceExtraInitializers);
254
+ __esDecorate(null, null, _ignoreLayoutWarnings_decorators, { kind: "field", name: "ignoreLayoutWarnings", static: false, private: false, access: { has: obj => "ignoreLayoutWarnings" in obj, get: obj => obj.ignoreLayoutWarnings, set: (obj, value) => { obj.ignoreLayoutWarnings = value; } }, metadata: _metadata }, _ignoreLayoutWarnings_initializers, _ignoreLayoutWarnings_extraInitializers);
255
+ if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
256
+ })(),
257
+ _a;
258
+ })();
259
+ export { StackPanel };
245
260
  let _Registered = false;
246
261
  /**
247
262
  * Registers the StackPanel class with the type store for serialization support.
@@ -1 +1 @@
1
- {"version":3,"file":"stackPanel.pure.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/stackPanel.pure.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,SAAS;IAarC,oFAAoF;IAEpF,IAAW,UAAU;QACjB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAED,IAAW,U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AAI,CAAC,aAAa,CAAC;IAC1D,CAAC;IAED;;OAEG;IACa,iBAAiB,CAAC,gBAAqB,EAAE,IAA4B;QACjF,IAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC;QACjD,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,YAAY,CAAC;QAEnD,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;IACpD,CAAC;CACJ;AA7PU;IADN,SAAS,EAAE;wDACwB;AAIpC;IADC,SAAS,EAAE;4CAGX;AAeD;IADC,SAAS,EAAE;yCAGX;AAgBD;IADC,SAAS,EAAE;uCAaX;AAWD;IADC,SAAS,EAAE;wCAaX;AAqLL,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAC9B,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { Container } from \"./container.pure\";\r\nimport { type Measure } from \"../measure\";\r\nimport { Control } from \"./control.pure\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { type AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport { type ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Class used to create a 2D stack panel container\r\n */\r\nexport class StackPanel extends Container {\r\n private _isVertical = true;\r\n private _manualWidth = false;\r\n private _manualHeight = false;\r\n private _doNotTrackManualChanges = false;\r\n private _spacing = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that layout warnings should be ignored\r\n */\r\n @serialize()\r\n public ignoreLayoutWarnings = false;\r\n\r\n /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/\r\n @serialize()\r\n public get isVertical(): boolean {\r\n return this._isVertical;\r\n }\r\n\r\n public set isVertical(value: boolean) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the spacing (in pixels) between each child.\r\n */\r\n @serialize()\r\n public get spacing(): number {\r\n return this._spacing;\r\n }\r\n\r\n public set spacing(value: number) {\r\n if (this._spacing === value) {\r\n return;\r\n }\r\n\r\n this._spacing = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets panel width.\r\n * This value should not be set when in horizontal mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public override set width(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualWidth = true;\r\n }\r\n\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public override get width(): string | number {\r\n return this._width.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets panel height.\r\n * This value should not be set when in vertical mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public override set height(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualHeight = true;\r\n }\r\n\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public override get height(): string | number {\r\n return this._height.toString(this._host);\r\n }\r\n\r\n /**\r\n * Creates a new StackPanel\r\n * @param name defines control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"StackPanel\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected override _preMeasure(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n for (const child of this._children) {\r\n if (this._isVertical) {\r\n child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n } else {\r\n child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n }\r\n }\r\n\r\n super._preMeasure(parentMeasure, context);\r\n }\r\n\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.copyFrom(parentMeasure);\r\n\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n\r\n if (!this.isVertical || this._manualWidth) {\r\n this._measureForChildren.width = this._currentMeasure.width;\r\n }\r\n\r\n if (this.isVertical || this._manualHeight) {\r\n this._measureForChildren.height = this._currentMeasure.height;\r\n }\r\n }\r\n\r\n protected override _postMeasure(): void {\r\n let stackWidth = 0;\r\n let stackHeight = 0;\r\n const childrenCount = this._children.length;\r\n\r\n // Calculate scaled spacing using idealRatio (same pattern as shadowOffset)\r\n const scaledSpacing = this._spacing * this._host.idealRatio;\r\n\r\n for (let index = 0; index < childrenCount; index++) {\r\n const child = this._children[index];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n\r\n if (this._isVertical) {\r\n const top = stackHeight + \"px\";\r\n if (child.top !== top) {\r\n child.top = top;\r\n this._rebuildLayout = true;\r\n child._top.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"height\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using height in percentage mode inside a vertical StackPanel`, 1);\r\n } else {\r\n stackHeight += child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels + (index < childrenCount - 1 ? scaledSpacing : 0);\r\n }\r\n } else {\r\n const left = stackWidth + \"px\";\r\n if (child.left !== left) {\r\n child.left = left;\r\n this._rebuildLayout = true;\r\n child._left.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"width\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using width in percentage mode inside a horizontal StackPanel`, 1);\r\n } else {\r\n stackWidth += child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels + (index < childrenCount - 1 ? scaledSpacing : 0);\r\n }\r\n }\r\n }\r\n\r\n stackWidth += this._paddingLeftInPixels + this._paddingRightInPixels;\r\n stackHeight += this._paddingTopInPixels + this._paddingBottomInPixels;\r\n\r\n this._doNotTrackManualChanges = true;\r\n\r\n // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.\r\n // User can now define their own height and width for stack panel.\r\n\r\n let panelWidthChanged = false;\r\n let panelHeightChanged = false;\r\n\r\n if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {\r\n // do not specify height if strictly defined by user\r\n const previousHeight = this.height;\r\n this.height = stackHeight + \"px\";\r\n panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;\r\n }\r\n if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {\r\n // do not specify width if strictly defined by user\r\n const previousWidth = this.width;\r\n this.width = stackWidth + \"px\";\r\n panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;\r\n }\r\n\r\n if (panelHeightChanged) {\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (panelWidthChanged) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._doNotTrackManualChanges = false;\r\n\r\n if (panelWidthChanged || panelHeightChanged) {\r\n this._rebuildLayout = true;\r\n }\r\n\r\n super._postMeasure();\r\n }\r\n\r\n private _getManualDim(dim: \"width\" | \"height\") {\r\n if (dim === \"width\") {\r\n return this._manualWidth;\r\n } else {\r\n return this._manualHeight;\r\n }\r\n }\r\n\r\n public override isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (dim === \"height\" ? this.isVertical : !this.isVertical && !this._getManualDim(dim)) {\r\n for (const child of this._children) {\r\n if (!child.isDimensionFullyDefined(dim)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n return this.getDimension(dim).isPixel || this._getAdaptDimTo(dim);\r\n }\r\n\r\n /**\r\n * Serializes the current control\r\n * @param serializationObject defined the JSON serialized object\r\n * @param force force serialization even if isSerializable === false\r\n * @param allowCanvas defines if the control is allowed to use a Canvas2D object to serialize\r\n */\r\n public override serialize(serializationObject: any, force: boolean, allowCanvas: boolean) {\r\n super.serialize(serializationObject, force, allowCanvas);\r\n if (!this.isSerializable && !force) {\r\n return;\r\n }\r\n serializationObject.manualWidth = this._manualWidth;\r\n serializationObject.manualHeight = this._manualHeight;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n this._manualWidth = serializedObject.manualWidth;\r\n this._manualHeight = serializedObject.manualHeight;\r\n\r\n super._parseFromContent(serializedObject, host);\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Registers the StackPanel class with the type store for serialization support.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterStackPanel(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.GUI.StackPanel\", StackPanel);\r\n}\r\n"]}
1
+ {"version":3,"file":"stackPanel.pure.js","sourceRoot":"","sources":["../../../../../dev/gui/src/2D/controls/stackPanel.pure.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAE7C,OAAO,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAGjD,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C;;GAEG;IACU,UAAU;;sBAAS,SAAS;;;;;;;;;sBAA5B,UAAW,SAAQ,WAAS;YAarC,oFAAoF;YAEpF,IAAW,UAAU;gBACjB,OAAO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S,CAAC,mBAAmB,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC;gBACzD,IAAI,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,KAAK,EAAE,CAAC;oBACjC,OAAO;gBACX,CAAC;gBACD,mBAAmB,CAAC,WAAW,GAAG,IAAI,CAAC,YAAY,CAAC;gBACpD,mBAAmB,CAAC,YAAY,GAAG,IAAI,CAAC,aAAa,CAAC;YAC1D,CAAC;YAED;;eAEG;YACa,iBAAiB,CAAC,gBAAqB,EAAE,IAA4B;gBACjF,IAAI,CAAC,YAAY,GAAG,gBAAgB,CAAC,WAAW,CAAC;gBACjD,IAAI,CAAC,aAAa,GAAG,gBAAgB,CAAC,YAAY,CAAC;gBAEnD,KAAK,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;YACpD,CAAC;;;;gDA7PA,SAAS,EAAE;0CAIX,SAAS,EAAE;uCAiBX,SAAS,EAAE;qCAkBX,SAAS,EAAE;sCAuBX,SAAS,EAAE;YAzDZ,mLAAW,UAAU,6DAEpB;YAeD,0KAAW,OAAO,6DAEjB;YAgBD,+KAAoB,KAAK,wEAYxB;YAWD,kLAAoB,MAAM,wEAYzB;YA1ED,8MAAO,oBAAoB,6BAApB,oBAAoB,mHAAS;;;;;SAX3B,UAAU;AA0QvB,IAAI,WAAW,GAAG,KAAK,CAAC;AACxB;;;GAGG;AACH,MAAM,UAAU,kBAAkB;IAC9B,IAAI,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;IACD,WAAW,GAAG,IAAI,CAAC;IAEnB,aAAa,CAAC,wBAAwB,EAAE,UAAU,CAAC,CAAC;AACxD,CAAC","sourcesContent":["import { Container } from \"./container.pure\";\r\nimport { type Measure } from \"../measure\";\r\nimport { Control } from \"./control.pure\";\r\nimport { RegisterClass } from \"core/Misc/typeStore\";\r\nimport { serialize } from \"core/Misc/decorators\";\r\nimport { type AdvancedDynamicTexture } from \"../advancedDynamicTexture\";\r\nimport { type ICanvasRenderingContext } from \"core/Engines/ICanvas\";\r\nimport { Logger } from \"core/Misc/logger\";\r\n\r\n/**\r\n * Class used to create a 2D stack panel container\r\n */\r\nexport class StackPanel extends Container {\r\n private _isVertical = true;\r\n private _manualWidth = false;\r\n private _manualHeight = false;\r\n private _doNotTrackManualChanges = false;\r\n private _spacing = 0;\r\n\r\n /**\r\n * Gets or sets a boolean indicating that layout warnings should be ignored\r\n */\r\n @serialize()\r\n public ignoreLayoutWarnings = false;\r\n\r\n /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/\r\n @serialize()\r\n public get isVertical(): boolean {\r\n return this._isVertical;\r\n }\r\n\r\n public set isVertical(value: boolean) {\r\n if (this._isVertical === value) {\r\n return;\r\n }\r\n\r\n this._isVertical = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets the spacing (in pixels) between each child.\r\n */\r\n @serialize()\r\n public get spacing(): number {\r\n return this._spacing;\r\n }\r\n\r\n public set spacing(value: number) {\r\n if (this._spacing === value) {\r\n return;\r\n }\r\n\r\n this._spacing = value;\r\n this._markAsDirty();\r\n }\r\n\r\n /**\r\n * Gets or sets panel width.\r\n * This value should not be set when in horizontal mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public override set width(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualWidth = true;\r\n }\r\n\r\n if (this._width.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._width.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public override get width(): string | number {\r\n return this._width.toString(this._host);\r\n }\r\n\r\n /**\r\n * Gets or sets panel height.\r\n * This value should not be set when in vertical mode as it will be computed automatically\r\n */\r\n @serialize()\r\n public override set height(value: string | number) {\r\n if (!this._doNotTrackManualChanges) {\r\n this._manualHeight = true;\r\n }\r\n\r\n if (this._height.toString(this._host) === value) {\r\n return;\r\n }\r\n\r\n if (this._height.fromString(value)) {\r\n this._markAsDirty();\r\n }\r\n }\r\n\r\n public override get height(): string | number {\r\n return this._height.toString(this._host);\r\n }\r\n\r\n /**\r\n * Creates a new StackPanel\r\n * @param name defines control name\r\n */\r\n constructor(public override name?: string) {\r\n super(name);\r\n }\r\n\r\n protected override _getTypeName(): string {\r\n return \"StackPanel\";\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n protected override _preMeasure(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n for (const child of this._children) {\r\n if (this._isVertical) {\r\n child.verticalAlignment = Control.VERTICAL_ALIGNMENT_TOP;\r\n } else {\r\n child.horizontalAlignment = Control.HORIZONTAL_ALIGNMENT_LEFT;\r\n }\r\n }\r\n\r\n super._preMeasure(parentMeasure, context);\r\n }\r\n\r\n protected override _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void {\r\n super._additionalProcessing(parentMeasure, context);\r\n\r\n this._measureForChildren.copyFrom(parentMeasure);\r\n\r\n this._measureForChildren.left = this._currentMeasure.left;\r\n this._measureForChildren.top = this._currentMeasure.top;\r\n\r\n if (!this.isVertical || this._manualWidth) {\r\n this._measureForChildren.width = this._currentMeasure.width;\r\n }\r\n\r\n if (this.isVertical || this._manualHeight) {\r\n this._measureForChildren.height = this._currentMeasure.height;\r\n }\r\n }\r\n\r\n protected override _postMeasure(): void {\r\n let stackWidth = 0;\r\n let stackHeight = 0;\r\n const childrenCount = this._children.length;\r\n\r\n // Calculate scaled spacing using idealRatio (same pattern as shadowOffset)\r\n const scaledSpacing = this._spacing * this._host.idealRatio;\r\n\r\n for (let index = 0; index < childrenCount; index++) {\r\n const child = this._children[index];\r\n if (!child.isVisible || child.notRenderable) {\r\n continue;\r\n }\r\n\r\n if (this._isVertical) {\r\n const top = stackHeight + \"px\";\r\n if (child.top !== top) {\r\n child.top = top;\r\n this._rebuildLayout = true;\r\n child._top.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"height\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using height in percentage mode inside a vertical StackPanel`, 1);\r\n } else {\r\n stackHeight += child._currentMeasure.height + child._paddingTopInPixels + child._paddingBottomInPixels + (index < childrenCount - 1 ? scaledSpacing : 0);\r\n }\r\n } else {\r\n const left = stackWidth + \"px\";\r\n if (child.left !== left) {\r\n child.left = left;\r\n this._rebuildLayout = true;\r\n child._left.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (!this.ignoreLayoutWarnings && !child.isDimensionFullyDefined(\"width\")) {\r\n Logger.Warn(`Control (Name:${child.name}, UniqueId:${child.uniqueId}) is using width in percentage mode inside a horizontal StackPanel`, 1);\r\n } else {\r\n stackWidth += child._currentMeasure.width + child._paddingLeftInPixels + child._paddingRightInPixels + (index < childrenCount - 1 ? scaledSpacing : 0);\r\n }\r\n }\r\n }\r\n\r\n stackWidth += this._paddingLeftInPixels + this._paddingRightInPixels;\r\n stackHeight += this._paddingTopInPixels + this._paddingBottomInPixels;\r\n\r\n this._doNotTrackManualChanges = true;\r\n\r\n // Let stack panel width or height default to stackHeight and stackWidth if dimensions are not specified.\r\n // User can now define their own height and width for stack panel.\r\n\r\n let panelWidthChanged = false;\r\n let panelHeightChanged = false;\r\n\r\n if ((!this._manualHeight || this.adaptHeightToChildren) && this._isVertical) {\r\n // do not specify height if strictly defined by user\r\n const previousHeight = this.height;\r\n this.height = stackHeight + \"px\";\r\n panelHeightChanged = previousHeight !== this.height || !this._height.ignoreAdaptiveScaling;\r\n }\r\n if ((!this._manualWidth || this.adaptWidthToChildren) && !this._isVertical) {\r\n // do not specify width if strictly defined by user\r\n const previousWidth = this.width;\r\n this.width = stackWidth + \"px\";\r\n panelWidthChanged = previousWidth !== this.width || !this._width.ignoreAdaptiveScaling;\r\n }\r\n\r\n if (panelHeightChanged) {\r\n this._height.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n if (panelWidthChanged) {\r\n this._width.ignoreAdaptiveScaling = true;\r\n }\r\n\r\n this._doNotTrackManualChanges = false;\r\n\r\n if (panelWidthChanged || panelHeightChanged) {\r\n this._rebuildLayout = true;\r\n }\r\n\r\n super._postMeasure();\r\n }\r\n\r\n private _getManualDim(dim: \"width\" | \"height\") {\r\n if (dim === \"width\") {\r\n return this._manualWidth;\r\n } else {\r\n return this._manualHeight;\r\n }\r\n }\r\n\r\n public override isDimensionFullyDefined(dim: \"width\" | \"height\"): boolean {\r\n if (dim === \"height\" ? this.isVertical : !this.isVertical && !this._getManualDim(dim)) {\r\n for (const child of this._children) {\r\n if (!child.isDimensionFullyDefined(dim)) {\r\n return false;\r\n }\r\n }\r\n return true;\r\n }\r\n\r\n return this.getDimension(dim).isPixel || this._getAdaptDimTo(dim);\r\n }\r\n\r\n /**\r\n * Serializes the current control\r\n * @param serializationObject defined the JSON serialized object\r\n * @param force force serialization even if isSerializable === false\r\n * @param allowCanvas defines if the control is allowed to use a Canvas2D object to serialize\r\n */\r\n public override serialize(serializationObject: any, force: boolean, allowCanvas: boolean) {\r\n super.serialize(serializationObject, force, allowCanvas);\r\n if (!this.isSerializable && !force) {\r\n return;\r\n }\r\n serializationObject.manualWidth = this._manualWidth;\r\n serializationObject.manualHeight = this._manualHeight;\r\n }\r\n\r\n /**\r\n * @internal\r\n */\r\n public override _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture) {\r\n this._manualWidth = serializedObject.manualWidth;\r\n this._manualHeight = serializedObject.manualHeight;\r\n\r\n super._parseFromContent(serializedObject, host);\r\n }\r\n}\r\n\r\nlet _Registered = false;\r\n/**\r\n * Registers the StackPanel class with the type store for serialization support.\r\n * Safe to call multiple times; only the first call has an effect.\r\n */\r\nexport function RegisterStackPanel(): void {\r\n if (_Registered) {\r\n return;\r\n }\r\n _Registered = true;\r\n\r\n RegisterClass(\"BABYLON.GUI.StackPanel\", StackPanel);\r\n}\r\n"]}