@babylonjs/gui 5.21.0 → 5.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/2D/adtInstrumentation.js +70 -90
- package/2D/adtInstrumentation.js.map +1 -1
- package/2D/advancedDynamicTexture.d.ts +6 -0
- package/2D/advancedDynamicTexture.js +554 -622
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/button.js +76 -90
- package/2D/controls/button.js.map +1 -1
- package/2D/controls/checkbox.js +86 -106
- package/2D/controls/checkbox.js.map +1 -1
- package/2D/controls/colorpicker.js +395 -415
- package/2D/controls/colorpicker.js.map +1 -1
- package/2D/controls/container.js +187 -230
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.js +1067 -1353
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/displayGrid.js +152 -196
- package/2D/controls/displayGrid.js.map +1 -1
- package/2D/controls/ellipse.js +32 -40
- package/2D/controls/ellipse.js.map +1 -1
- package/2D/controls/focusableButton.js +30 -35
- package/2D/controls/focusableButton.js.map +1 -1
- package/2D/controls/grid.js +172 -212
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/image.js +489 -592
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputPassword.js +9 -16
- package/2D/controls/inputPassword.js.map +1 -1
- package/2D/controls/inputText.js +380 -467
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js +234 -273
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/line.js +147 -198
- package/2D/controls/line.js.map +1 -1
- package/2D/controls/multiLine.js +87 -113
- package/2D/controls/multiLine.js.map +1 -1
- package/2D/controls/radioButton.js +106 -127
- package/2D/controls/radioButton.js.map +1 -1
- package/2D/controls/rectangle.js +60 -72
- package/2D/controls/rectangle.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewer.js +439 -543
- package/2D/controls/scrollViewers/scrollViewer.js.map +1 -1
- package/2D/controls/scrollViewers/scrollViewerWindow.js +99 -118
- package/2D/controls/scrollViewers/scrollViewerWindow.js.map +1 -1
- package/2D/controls/selector.js +241 -329
- package/2D/controls/selector.js.map +1 -1
- package/2D/controls/sliders/baseSlider.js +182 -230
- package/2D/controls/sliders/baseSlider.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js +86 -109
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/sliders/imageScrollBar.js +148 -178
- package/2D/controls/sliders/imageScrollBar.js.map +1 -1
- package/2D/controls/sliders/scrollBar.js +64 -80
- package/2D/controls/sliders/scrollBar.js.map +1 -1
- package/2D/controls/sliders/slider.js +91 -115
- package/2D/controls/sliders/slider.js.map +1 -1
- package/2D/controls/stackPanel.js +114 -135
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/statics.js +5 -5
- package/2D/controls/statics.js.map +1 -1
- package/2D/controls/textBlock.js +322 -384
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/controls/textWrapper.js +27 -41
- package/2D/controls/textWrapper.js.map +1 -1
- package/2D/controls/toggleButton.js +105 -121
- package/2D/controls/toggleButton.js.map +1 -1
- package/2D/controls/virtualKeyboard.js +101 -123
- package/2D/controls/virtualKeyboard.js.map +1 -1
- package/2D/math2D.js +62 -70
- package/2D/math2D.js.map +1 -1
- package/2D/measure.js +30 -32
- package/2D/measure.js.map +1 -1
- package/2D/multiLinePoint.js +71 -89
- package/2D/multiLinePoint.js.map +1 -1
- package/2D/style.js +55 -73
- package/2D/style.js.map +1 -1
- package/2D/valueAndUnit.js +71 -104
- package/2D/valueAndUnit.js.map +1 -1
- package/2D/xmlLoader.js +70 -84
- package/2D/xmlLoader.js.map +1 -1
- package/3D/behaviors/defaultBehavior.js +40 -59
- package/3D/behaviors/defaultBehavior.js.map +1 -1
- package/3D/controls/abstractButton3D.js +8 -12
- package/3D/controls/abstractButton3D.js.map +1 -1
- package/3D/controls/button3D.js +30 -35
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/container3D.js +57 -71
- package/3D/controls/container3D.js.map +1 -1
- package/3D/controls/contentDisplay3D.js +47 -60
- package/3D/controls/contentDisplay3D.js.map +1 -1
- package/3D/controls/control3D.js +123 -158
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/cylinderPanel.js +28 -38
- package/3D/controls/cylinderPanel.js.map +1 -1
- package/3D/controls/handMenu.js +20 -29
- package/3D/controls/handMenu.js.map +1 -1
- package/3D/controls/holographicBackplate.js +52 -72
- package/3D/controls/holographicBackplate.js.map +1 -1
- package/3D/controls/holographicButton.js +160 -200
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js +176 -206
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/meshButton3D.js +24 -30
- package/3D/controls/meshButton3D.js.map +1 -1
- package/3D/controls/nearMenu.js +57 -71
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/planePanel.js +6 -13
- package/3D/controls/planePanel.js.map +1 -1
- package/3D/controls/scatterPanel.js +43 -54
- package/3D/controls/scatterPanel.js.map +1 -1
- package/3D/controls/slider3D.js +168 -222
- package/3D/controls/slider3D.js.map +1 -1
- package/3D/controls/spherePanel.js +29 -39
- package/3D/controls/spherePanel.js.map +1 -1
- package/3D/controls/stackPanel3D.js +36 -49
- package/3D/controls/stackPanel3D.js.map +1 -1
- package/3D/controls/touchButton3D.js +126 -154
- package/3D/controls/touchButton3D.js.map +1 -1
- package/3D/controls/touchHolographicButton.js +223 -272
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js +55 -66
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/controls/touchMeshButton3D.js +24 -30
- package/3D/controls/touchMeshButton3D.js.map +1 -1
- package/3D/controls/volumeBasedPanel.js +85 -107
- package/3D/controls/volumeBasedPanel.js.map +1 -1
- package/3D/gizmos/gizmoHandle.js +68 -103
- package/3D/gizmos/gizmoHandle.js.map +1 -1
- package/3D/gizmos/slateGizmo.js +165 -182
- package/3D/gizmos/slateGizmo.js.map +1 -1
- package/3D/gui3DManager.js +76 -101
- package/3D/gui3DManager.js.map +1 -1
- package/3D/materials/fluent/fluentMaterial.js +110 -119
- package/3D/materials/fluent/fluentMaterial.js.map +1 -1
- package/3D/materials/fluent/shaders/fluent.fragment.js +20 -3
- package/3D/materials/fluent/shaders/fluent.fragment.js.map +1 -1
- package/3D/materials/fluent/shaders/fluent.vertex.js +11 -3
- package/3D/materials/fluent/shaders/fluent.vertex.js.map +1 -1
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js +168 -177
- package/3D/materials/fluentBackplate/fluentBackplateMaterial.js.map +1 -1
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js +9 -3
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment.js.map +1 -1
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js +15 -3
- package/3D/materials/fluentBackplate/shaders/fluentBackplate.vertex.js.map +1 -1
- package/3D/materials/fluentButton/fluentButtonMaterial.js +205 -213
- package/3D/materials/fluentButton/fluentButtonMaterial.js.map +1 -1
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.js +6 -3
- package/3D/materials/fluentButton/shaders/fluentButton.fragment.js.map +1 -1
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.js +6 -3
- package/3D/materials/fluentButton/shaders/fluentButton.vertex.js.map +1 -1
- package/3D/materials/handle/handleMaterial.js +56 -69
- package/3D/materials/handle/handleMaterial.js.map +1 -1
- package/3D/materials/handle/shaders/handle.fragment.js +3 -3
- package/3D/materials/handle/shaders/handle.fragment.js.map +1 -1
- package/3D/materials/handle/shaders/handle.vertex.js +3 -3
- package/3D/materials/handle/shaders/handle.vertex.js.map +1 -1
- package/3D/materials/mrdl/mrdlBackplateMaterial.js +158 -166
- package/3D/materials/mrdl/mrdlBackplateMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js +322 -330
- package/3D/materials/mrdl/mrdlSliderBarMaterial.js.map +1 -1
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js +322 -330
- package/3D/materials/mrdl/mrdlSliderThumbMaterial.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js +9 -3
- package/3D/materials/mrdl/shaders/mrdlBackplate.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js +6 -3
- package/3D/materials/mrdl/shaders/mrdlBackplate.vertex.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js +24 -3
- package/3D/materials/mrdl/shaders/mrdlSliderBar.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js +12 -3
- package/3D/materials/mrdl/shaders/mrdlSliderBar.vertex.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js +24 -3
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.fragment.js.map +1 -1
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js +12 -3
- package/3D/materials/mrdl/shaders/mrdlSliderThumb.vertex.js.map +1 -1
- package/3D/vector3WithInfo.js +6 -12
- package/3D/vector3WithInfo.js.map +1 -1
- package/legacy/legacy.js +1 -1
- package/legacy/legacy.js.map +1 -1
- package/package.json +2 -5
package/2D/controls/container.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __decorate
|
|
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
|
-
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
constructor(name) {
|
|
20
|
+
super(name);
|
|
21
|
+
this.name = name;
|
|
23
22
|
/** @hidden */
|
|
24
|
-
|
|
23
|
+
this._children = new Array();
|
|
25
24
|
/** @hidden */
|
|
26
|
-
|
|
25
|
+
this._measureForChildren = Measure.Empty();
|
|
27
26
|
/** @hidden */
|
|
28
|
-
|
|
27
|
+
this._background = "";
|
|
29
28
|
/** @hidden */
|
|
30
|
-
|
|
29
|
+
this._adaptWidthToChildren = false;
|
|
31
30
|
/** @hidden */
|
|
32
|
-
|
|
31
|
+
this._adaptHeightToChildren = false;
|
|
33
32
|
/** @hidden */
|
|
34
|
-
|
|
33
|
+
this._renderToIntermediateTexture = false;
|
|
35
34
|
/** @hidden */
|
|
36
|
-
|
|
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
|
-
|
|
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
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
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
|
-
|
|
139
|
-
for (
|
|
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
|
-
|
|
151
|
-
for (
|
|
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
|
-
|
|
166
|
-
for (
|
|
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
|
-
|
|
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
|
-
|
|
157
|
+
addControl(control) {
|
|
188
158
|
if (!control) {
|
|
189
159
|
return this;
|
|
190
160
|
}
|
|
191
|
-
|
|
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
|
-
|
|
206
|
-
|
|
207
|
-
for (
|
|
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
|
-
|
|
219
|
-
|
|
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
|
-
|
|
236
|
-
|
|
204
|
+
_reOrderControl(control) {
|
|
205
|
+
const linkedMesh = control.linkedMesh;
|
|
237
206
|
this.removeControl(control);
|
|
238
|
-
|
|
239
|
-
for (
|
|
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
|
-
|
|
260
|
-
|
|
261
|
-
for (
|
|
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
|
-
|
|
271
|
-
|
|
272
|
-
for (
|
|
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
|
-
|
|
279
|
-
|
|
280
|
-
for (
|
|
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
|
-
|
|
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
|
-
|
|
307
|
-
|
|
308
|
-
for (
|
|
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
|
-
|
|
280
|
+
_beforeLayout() {
|
|
315
281
|
// Do nothing
|
|
316
|
-
}
|
|
282
|
+
}
|
|
317
283
|
/**
|
|
318
284
|
* @param parentMeasure
|
|
319
285
|
* @param context
|
|
320
286
|
* @hidden
|
|
321
287
|
*/
|
|
322
|
-
|
|
288
|
+
_processMeasures(parentMeasure, context) {
|
|
323
289
|
if (this._isDirty || !this._cachedParentMeasure.isEqualsTo(parentMeasure)) {
|
|
324
|
-
|
|
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
|
-
|
|
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
|
-
|
|
320
|
+
let rebuildCount = 0;
|
|
356
321
|
context.save();
|
|
357
322
|
this._applyStates(context);
|
|
358
323
|
this._beforeLayout();
|
|
359
324
|
do {
|
|
360
|
-
|
|
361
|
-
|
|
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 (
|
|
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
|
-
|
|
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
|
-
|
|
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(
|
|
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
|
-
|
|
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
|
-
|
|
420
|
-
|
|
421
|
-
|
|
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 (
|
|
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
|
-
|
|
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 (
|
|
462
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
494
|
-
|
|
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
|
-
|
|
516
|
-
|
|
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
|
-
|
|
524
|
-
|
|
485
|
+
serialize(serializationObject) {
|
|
486
|
+
super.serialize(serializationObject);
|
|
525
487
|
if (!this.children.length) {
|
|
526
488
|
return;
|
|
527
489
|
}
|
|
528
490
|
serializationObject.children = [];
|
|
529
|
-
for (
|
|
530
|
-
|
|
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
|
-
|
|
538
|
-
|
|
539
|
-
|
|
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
|
-
|
|
544
|
-
}
|
|
503
|
+
this._intermediateTexture?.dispose();
|
|
504
|
+
}
|
|
545
505
|
/**
|
|
546
506
|
* @param serializedObject
|
|
547
507
|
* @param host
|
|
548
508
|
* @hidden
|
|
549
509
|
*/
|
|
550
|
-
|
|
551
|
-
|
|
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 (
|
|
557
|
-
var childData = _a[_i];
|
|
516
|
+
for (const childData of serializedObject.children) {
|
|
558
517
|
this.addControl(Control.Parse(childData, host));
|
|
559
518
|
}
|
|
560
|
-
}
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
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
|