@babylonjs/gui 5.0.0-alpha.60 → 5.0.0-alpha.64
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/advancedDynamicTexture.d.ts +153 -135
- package/2D/advancedDynamicTexture.js +258 -157
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/container.js +2 -2
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +66 -32
- package/2D/controls/control.js +180 -76
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/grid.d.ts +5 -3
- package/2D/controls/grid.js +48 -21
- package/2D/controls/grid.js.map +1 -1
- package/2D/controls/inputText.js +1 -1
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/sliders/imageBasedSlider.js.map +1 -1
- package/2D/controls/stackPanel.d.ts +7 -1
- package/2D/controls/stackPanel.js +29 -7
- package/2D/controls/stackPanel.js.map +1 -1
- package/2D/controls/textBlock.js +5 -5
- package/2D/controls/textBlock.js.map +1 -1
- package/2D/math2D.d.ts +5 -0
- package/2D/math2D.js +12 -0
- package/2D/math2D.js.map +1 -1
- package/2D/valueAndUnit.d.ts +21 -6
- package/2D/valueAndUnit.js +57 -13
- package/2D/valueAndUnit.js.map +1 -1
- package/3D/controls/button3D.js +8 -1
- package/3D/controls/button3D.js.map +1 -1
- package/3D/controls/control3D.d.ts +2 -0
- package/3D/controls/control3D.js +3 -0
- package/3D/controls/control3D.js.map +1 -1
- package/3D/controls/holographicButton.js +9 -8
- package/3D/controls/holographicButton.js.map +1 -1
- package/3D/controls/holographicSlate.js +11 -6
- package/3D/controls/holographicSlate.js.map +1 -1
- package/3D/controls/nearMenu.js +1 -1
- package/3D/controls/nearMenu.js.map +1 -1
- package/3D/controls/touchHolographicButton.js +12 -12
- package/3D/controls/touchHolographicButton.js.map +1 -1
- package/3D/controls/touchHolographicMenu.js +13 -11
- package/3D/controls/touchHolographicMenu.js.map +1 -1
- package/3D/gui3DManager.d.ts +10 -0
- package/3D/gui3DManager.js +43 -0
- package/3D/gui3DManager.js.map +1 -1
- package/package.json +2 -2
|
@@ -8,16 +8,18 @@ import { Layer } from "@babylonjs/core/Layers/layer";
|
|
|
8
8
|
import { Scene } from "@babylonjs/core/scene";
|
|
9
9
|
import { Container } from "./controls/container";
|
|
10
10
|
import { Control } from "./controls/control";
|
|
11
|
-
import { IFocusableControl } from
|
|
11
|
+
import { IFocusableControl } from "./controls/focusableControl";
|
|
12
12
|
import { Style } from "./style";
|
|
13
|
-
import { Viewport } from
|
|
13
|
+
import { Viewport } from "@babylonjs/core/Maths/math.viewport";
|
|
14
14
|
/**
|
|
15
|
-
* Class used to create texture to support 2D GUI elements
|
|
16
|
-
* @see https://doc.babylonjs.com/how_to/gui
|
|
17
|
-
*/
|
|
15
|
+
* Class used to create texture to support 2D GUI elements
|
|
16
|
+
* @see https://doc.babylonjs.com/how_to/gui
|
|
17
|
+
*/
|
|
18
18
|
export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
19
19
|
/** Define the Uurl to load snippets */
|
|
20
20
|
static SnippetUrl: string;
|
|
21
|
+
/** Indicates if some optimizations can be performed in GUI GPU management (the downside is additional memory/GPU texture memory used) */
|
|
22
|
+
static AllowGPUOptimizations: boolean;
|
|
21
23
|
/** Snippet ID if the content was created from the snippet server */
|
|
22
24
|
snippetId: string;
|
|
23
25
|
private _isDirty;
|
|
@@ -72,152 +74,152 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
72
74
|
/** Gets the number of render calls made the last time the ADT has been rendered */
|
|
73
75
|
get numRenderCalls(): number;
|
|
74
76
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
* Define type to string to ensure compatibility across browsers
|
|
78
|
+
* Safari doesn't support DataTransfer constructor
|
|
79
|
+
*/
|
|
78
80
|
private _clipboardData;
|
|
79
81
|
/**
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
* Observable event triggered each time an clipboard event is received from the rendering canvas
|
|
83
|
+
*/
|
|
82
84
|
onClipboardObservable: Observable<ClipboardInfo>;
|
|
83
85
|
/**
|
|
84
|
-
|
|
85
|
-
|
|
86
|
+
* Observable event triggered each time a pointer down is intercepted by a control
|
|
87
|
+
*/
|
|
86
88
|
onControlPickedObservable: Observable<Control>;
|
|
87
89
|
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
+
* Observable event triggered before layout is evaluated
|
|
91
|
+
*/
|
|
90
92
|
onBeginLayoutObservable: Observable<AdvancedDynamicTexture>;
|
|
91
93
|
/**
|
|
92
|
-
|
|
93
|
-
|
|
94
|
+
* Observable event triggered after the layout was evaluated
|
|
95
|
+
*/
|
|
94
96
|
onEndLayoutObservable: Observable<AdvancedDynamicTexture>;
|
|
95
97
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
+
* Observable event triggered before the texture is rendered
|
|
99
|
+
*/
|
|
98
100
|
onBeginRenderObservable: Observable<AdvancedDynamicTexture>;
|
|
99
101
|
/**
|
|
100
|
-
|
|
101
|
-
|
|
102
|
+
* Observable event triggered after the texture was rendered
|
|
103
|
+
*/
|
|
102
104
|
onEndRenderObservable: Observable<AdvancedDynamicTexture>;
|
|
103
105
|
/**
|
|
104
|
-
|
|
105
|
-
|
|
106
|
+
* Gets or sets a boolean defining if alpha is stored as premultiplied
|
|
107
|
+
*/
|
|
106
108
|
premulAlpha: boolean;
|
|
107
109
|
/**
|
|
108
110
|
* Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
|
|
109
111
|
*/
|
|
110
112
|
applyYInversionOnUpdate: boolean;
|
|
111
113
|
/**
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
* Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
|
|
115
|
+
* Useful when you want more antialiasing
|
|
116
|
+
*/
|
|
115
117
|
get renderScale(): number;
|
|
116
118
|
set renderScale(value: number);
|
|
117
119
|
/** Gets or sets the background color */
|
|
118
120
|
get background(): string;
|
|
119
121
|
set background(value: string);
|
|
120
122
|
/**
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
123
|
+
* Gets or sets the ideal width used to design controls.
|
|
124
|
+
* The GUI will then rescale everything accordingly
|
|
125
|
+
* @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
|
|
126
|
+
*/
|
|
125
127
|
get idealWidth(): number;
|
|
126
128
|
set idealWidth(value: number);
|
|
127
129
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
* Gets or sets the ideal height used to design controls.
|
|
131
|
+
* The GUI will then rescale everything accordingly
|
|
132
|
+
* @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
|
|
133
|
+
*/
|
|
132
134
|
get idealHeight(): number;
|
|
133
135
|
set idealHeight(value: number);
|
|
134
136
|
/**
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
137
|
+
* Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
|
|
138
|
+
* @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
|
|
139
|
+
*/
|
|
138
140
|
get useSmallestIdeal(): boolean;
|
|
139
141
|
set useSmallestIdeal(value: boolean);
|
|
140
142
|
/**
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
143
|
+
* Gets or sets a boolean indicating if adaptive scaling must be used
|
|
144
|
+
* @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
|
|
145
|
+
*/
|
|
144
146
|
get renderAtIdealSize(): boolean;
|
|
145
147
|
set renderAtIdealSize(value: boolean);
|
|
146
148
|
/**
|
|
147
149
|
* Gets the ratio used when in "ideal mode"
|
|
148
|
-
|
|
150
|
+
* @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
|
|
149
151
|
* */
|
|
150
152
|
get idealRatio(): number;
|
|
151
153
|
/**
|
|
152
|
-
|
|
153
|
-
|
|
154
|
+
* Gets the underlying layer used to render the texture when in fullscreen mode
|
|
155
|
+
*/
|
|
154
156
|
get layer(): Nullable<Layer>;
|
|
155
157
|
/**
|
|
156
|
-
|
|
157
|
-
|
|
158
|
+
* Gets the root container control
|
|
159
|
+
*/
|
|
158
160
|
get rootContainer(): Container;
|
|
159
161
|
/**
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
* Returns an array containing the root container.
|
|
163
|
+
* This is mostly used to let the Inspector introspects the ADT
|
|
164
|
+
* @returns an array containing the rootContainer
|
|
165
|
+
*/
|
|
164
166
|
getChildren(): Array<Container>;
|
|
165
167
|
/**
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
168
|
+
* Will return all controls that are inside this texture
|
|
169
|
+
* @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
|
|
170
|
+
* @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
|
|
171
|
+
* @return all child controls
|
|
172
|
+
*/
|
|
171
173
|
getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
|
|
172
174
|
/**
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
175
|
+
* Will return all controls with the given type name
|
|
176
|
+
* @param typeName defines the type name to search for
|
|
177
|
+
* @returns an array of all controls found
|
|
178
|
+
*/
|
|
177
179
|
getControlsByType(typeName: string): Control[];
|
|
178
180
|
/**
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
181
|
+
* Will return the first control with the given name
|
|
182
|
+
* @param name defines the name to search for
|
|
183
|
+
* @return the first control found or null
|
|
184
|
+
*/
|
|
183
185
|
getControlByName(name: string): Nullable<Control>;
|
|
184
186
|
private _getControlByKey;
|
|
185
187
|
/**
|
|
186
|
-
|
|
187
|
-
|
|
188
|
+
* Gets or sets the current focused control
|
|
189
|
+
*/
|
|
188
190
|
get focusedControl(): Nullable<IFocusableControl>;
|
|
189
191
|
set focusedControl(control: Nullable<IFocusableControl>);
|
|
190
192
|
/**
|
|
191
|
-
|
|
192
|
-
|
|
193
|
+
* Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
|
|
194
|
+
*/
|
|
193
195
|
get isForeground(): boolean;
|
|
194
196
|
set isForeground(value: boolean);
|
|
195
197
|
/**
|
|
196
|
-
|
|
197
|
-
|
|
198
|
+
* Gets or set information about clipboardData
|
|
199
|
+
*/
|
|
198
200
|
get clipboardData(): string;
|
|
199
201
|
set clipboardData(value: string);
|
|
200
202
|
/**
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
203
|
+
* Creates a new AdvancedDynamicTexture
|
|
204
|
+
* @param name defines the name of the texture
|
|
205
|
+
* @param width defines the width of the texture
|
|
206
|
+
* @param height defines the height of the texture
|
|
207
|
+
* @param scene defines the hosting scene
|
|
208
|
+
* @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
|
|
209
|
+
* @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
|
|
210
|
+
* @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
|
|
211
|
+
*/
|
|
210
212
|
constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
|
|
211
213
|
/**
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
214
|
+
* Get the current class name of the texture useful for serialization or dynamic coding.
|
|
215
|
+
* @returns "AdvancedDynamicTexture"
|
|
216
|
+
*/
|
|
215
217
|
getClassName(): string;
|
|
216
218
|
/**
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
219
|
+
* Function used to execute a function on all controls
|
|
220
|
+
* @param func defines the function to execute
|
|
221
|
+
* @param container defines the container where controls belong. If null the root container will be used
|
|
222
|
+
*/
|
|
221
223
|
executeOnAllControls(func: (control: Control) => void, container?: Container): void;
|
|
222
224
|
private _useInvalidateRectOptimization;
|
|
223
225
|
/**
|
|
@@ -235,47 +237,55 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
235
237
|
*/
|
|
236
238
|
invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
|
|
237
239
|
/**
|
|
238
|
-
|
|
239
|
-
|
|
240
|
+
* Marks the texture as dirty forcing a complete update
|
|
241
|
+
*/
|
|
240
242
|
markAsDirty(): void;
|
|
241
243
|
/**
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
244
|
+
* Helper function used to create a new style
|
|
245
|
+
* @returns a new style
|
|
246
|
+
* @see https://doc.babylonjs.com/how_to/gui#styles
|
|
247
|
+
*/
|
|
246
248
|
createStyle(): Style;
|
|
247
249
|
/**
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
250
|
+
* Adds a new control to the root container
|
|
251
|
+
* @param control defines the control to add
|
|
252
|
+
* @returns the current texture
|
|
253
|
+
*/
|
|
252
254
|
addControl(control: Control): AdvancedDynamicTexture;
|
|
253
255
|
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
* Removes a control from the root container
|
|
257
|
+
* @param control defines the control to remove
|
|
258
|
+
* @returns the current texture
|
|
259
|
+
*/
|
|
258
260
|
removeControl(control: Control): AdvancedDynamicTexture;
|
|
259
261
|
/**
|
|
260
|
-
|
|
261
|
-
|
|
262
|
+
* Moves overlapped controls towards a position where it is not overlapping anymore.
|
|
263
|
+
* Please note that this method alters linkOffsetXInPixels and linkOffsetYInPixels.
|
|
264
|
+
* @param overlapGroup the overlap group which will be processed or undefined to process all overlap groups
|
|
265
|
+
* @param deltaStep the step size (speed) to reach the target non overlapping position (default 0.1)
|
|
266
|
+
* @param repelFactor how much is the control repelled by other controls
|
|
267
|
+
*/
|
|
268
|
+
moveToNonOverlappedPosition(overlapGroup?: number | Control[], deltaStep?: number, repelFactor?: number): void;
|
|
269
|
+
/**
|
|
270
|
+
* Release all resources
|
|
271
|
+
*/
|
|
262
272
|
dispose(): void;
|
|
263
273
|
private _onResize;
|
|
264
274
|
/** @hidden */
|
|
265
275
|
_getGlobalViewport(): Viewport;
|
|
266
276
|
/**
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
277
|
+
* Get screen coordinates for a vector3
|
|
278
|
+
* @param position defines the position to project
|
|
279
|
+
* @param worldMatrix defines the world matrix to use
|
|
280
|
+
* @returns the projected position
|
|
281
|
+
*/
|
|
272
282
|
getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
|
|
273
283
|
/**
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
284
|
+
* Get screen coordinates for a vector3
|
|
285
|
+
* @param position defines the position to project
|
|
286
|
+
* @param worldMatrix defines the world matrix to use
|
|
287
|
+
* @returns the projected position with Z
|
|
288
|
+
*/
|
|
279
289
|
getProjectedPositionWithZ(position: Vector3, worldMatrix: Matrix): Vector3;
|
|
280
290
|
private _checkUpdate;
|
|
281
291
|
private _clearMeasure;
|
|
@@ -300,23 +310,23 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
300
310
|
/** @hidden */
|
|
301
311
|
private onClipboardPaste;
|
|
302
312
|
/**
|
|
303
|
-
|
|
304
|
-
|
|
313
|
+
* Register the clipboard Events onto the canvas
|
|
314
|
+
*/
|
|
305
315
|
registerClipboardEvents(): void;
|
|
306
316
|
/**
|
|
307
317
|
* Unregister the clipboard Events from the canvas
|
|
308
318
|
*/
|
|
309
319
|
unRegisterClipboardEvents(): void;
|
|
310
320
|
/**
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
321
|
+
* Connect the texture to a hosting mesh to enable interactions
|
|
322
|
+
* @param mesh defines the mesh to attach to
|
|
323
|
+
* @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
|
|
324
|
+
*/
|
|
315
325
|
attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
|
|
316
326
|
/**
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
327
|
+
* Move the focus to a specific control
|
|
328
|
+
* @param control defines the control which will receive the focus
|
|
329
|
+
*/
|
|
320
330
|
moveFocusToControl(control: IFocusableControl): void;
|
|
321
331
|
private _manageFocus;
|
|
322
332
|
private _attachToOnPointerOut;
|
|
@@ -340,12 +350,19 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
340
350
|
*/
|
|
341
351
|
parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean): Promise<void>;
|
|
342
352
|
/**
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
353
|
+
* Recreate the content of the ADT from a url json
|
|
354
|
+
* @param url defines the url to load
|
|
355
|
+
* @param scaleToSize defines whether to scale to texture to the saved size
|
|
356
|
+
* @returns a promise that will resolve on success
|
|
357
|
+
*/
|
|
348
358
|
parseFromURLAsync(url: string, scaleToSize?: boolean): Promise<void>;
|
|
359
|
+
/**
|
|
360
|
+
* Compares two rectangle based controls for pixel overlap
|
|
361
|
+
* @param control1 The first control to compare
|
|
362
|
+
* @param control2 The second control to compare
|
|
363
|
+
* @returns true if overlaps, otherwise false
|
|
364
|
+
*/
|
|
365
|
+
private static _Overlaps;
|
|
349
366
|
/**
|
|
350
367
|
* Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
|
|
351
368
|
* @param mesh defines the mesh which will receive the texture
|
|
@@ -368,16 +385,17 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
|
368
385
|
*/
|
|
369
386
|
static CreateForMeshTexture(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, invertY?: boolean): AdvancedDynamicTexture;
|
|
370
387
|
/**
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
388
|
+
* Creates a new AdvancedDynamicTexture in fullscreen mode.
|
|
389
|
+
* In this mode the texture will rely on a layer for its rendering.
|
|
390
|
+
* This allows it to be treated like any other layer.
|
|
391
|
+
* As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
|
|
392
|
+
* LayerMask is set through advancedTexture.layer.layerMask
|
|
393
|
+
* @param name defines name for the texture
|
|
394
|
+
* @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
|
|
395
|
+
* @param scene defines the hosting scene
|
|
396
|
+
* @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
|
|
397
|
+
* @param adaptiveScaling defines whether to automatically scale root to match hardwarescaling (false by default)
|
|
398
|
+
* @returns a new AdvancedDynamicTexture
|
|
399
|
+
*/
|
|
400
|
+
static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number, adaptiveScaling?: boolean): AdvancedDynamicTexture;
|
|
383
401
|
}
|