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