@babylonjs/gui 5.0.0-alpha.59 → 5.0.0-alpha.62

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.
@@ -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 './controls/focusableControl';
11
+ import { IFocusableControl } from "./controls/focusableControl";
12
12
  import { Style } from "./style";
13
- import { Viewport } from '@babylonjs/core/Maths/math.viewport';
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
- * Define type to string to ensure compatibility across browsers
76
- * Safari doesn't support DataTransfer constructor
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
- * Observable event triggered each time an clipboard event is received from the rendering canvas
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
- * Observable event triggered each time a pointer down is intercepted by a control
85
- */
86
+ * Observable event triggered each time a pointer down is intercepted by a control
87
+ */
86
88
  onControlPickedObservable: Observable<Control>;
87
89
  /**
88
- * Observable event triggered before layout is evaluated
89
- */
90
+ * Observable event triggered before layout is evaluated
91
+ */
90
92
  onBeginLayoutObservable: Observable<AdvancedDynamicTexture>;
91
93
  /**
92
- * Observable event triggered after the layout was evaluated
93
- */
94
+ * Observable event triggered after the layout was evaluated
95
+ */
94
96
  onEndLayoutObservable: Observable<AdvancedDynamicTexture>;
95
97
  /**
96
- * Observable event triggered before the texture is rendered
97
- */
98
+ * Observable event triggered before the texture is rendered
99
+ */
98
100
  onBeginRenderObservable: Observable<AdvancedDynamicTexture>;
99
101
  /**
100
- * Observable event triggered after the texture was rendered
101
- */
102
+ * Observable event triggered after the texture was rendered
103
+ */
102
104
  onEndRenderObservable: Observable<AdvancedDynamicTexture>;
103
105
  /**
104
- * Gets or sets a boolean defining if alpha is stored as premultiplied
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
- * 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
- */
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
- * 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
- */
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
- * 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
- */
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
- * 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
- */
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
- * Gets or sets a boolean indicating if adaptive scaling must be used
142
- * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
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
- * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
150
+ * @see https://doc.babylonjs.com/how_to/gui#adaptive-scaling
149
151
  * */
150
152
  get idealRatio(): number;
151
153
  /**
152
- * Gets the underlying layer used to render the texture when in fullscreen mode
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
- * Gets the root container control
157
- */
158
+ * Gets the root container control
159
+ */
158
160
  get rootContainer(): Container;
159
161
  /**
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
- */
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
- * 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
- */
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
- * 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
- */
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
- * 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
- */
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
- * Gets or sets the current focused control
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
- * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
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
- * Gets or set information about clipboardData
197
- */
198
+ * Gets or set information about clipboardData
199
+ */
198
200
  get clipboardData(): string;
199
201
  set clipboardData(value: string);
200
202
  /**
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
- */
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
- * Get the current class name of the texture useful for serialization or dynamic coding.
213
- * @returns "AdvancedDynamicTexture"
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
- * 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
- */
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
- * Marks the texture as dirty forcing a complete update
239
- */
240
+ * Marks the texture as dirty forcing a complete update
241
+ */
240
242
  markAsDirty(): void;
241
243
  /**
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
- */
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
- * Adds a new control to the root container
249
- * @param control defines the control to add
250
- * @returns the current texture
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
- * Removes a control from the root container
255
- * @param control defines the control to remove
256
- * @returns the current texture
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
- * Release all resources
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
- * Get screen coordinates for a vector3
268
- * @param position defines the position to project
269
- * @param worldMatrix defines the world matrix to use
270
- * @returns the projected position
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
- * Get screen coordinates for a vector3
275
- * @param position defines the position to project
276
- * @param worldMatrix defines the world matrix to use
277
- * @returns the projected position with Z
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
- * Register the clipboard Events onto the canvas
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
- * Connect the texture to a hosting mesh to enable interactions
312
- * @param mesh defines the mesh to attach to
313
- * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
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
- * Move the focus to a specific control
318
- * @param control defines the control which will receive the focus
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
- * Recreate the content of the ADT from a url json
344
- * @param url defines the url to load
345
- * @param scaleToSize defines whether to scale to texture to the saved size
346
- * @returns a promise that will resolve on success
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,16 @@ 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
- * Creates a new AdvancedDynamicTexture in fullscreen mode.
372
- * In this mode the texture will rely on a layer for its rendering.
373
- * This allows it to be treated like any other layer.
374
- * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
375
- * LayerMask is set through advancedTexture.layer.layerMask
376
- * @param name defines name for the texture
377
- * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
378
- * @param scene defines the hosting scene
379
- * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
380
- * @returns a new AdvancedDynamicTexture
381
- */
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
+ * @returns a new AdvancedDynamicTexture
398
+ */
382
399
  static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
383
400
  }