@babylonjs/gui 7.4.0 → 7.6.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/advancedDynamicTexture.d.ts +12 -6
- package/2D/advancedDynamicTexture.js +16 -10
- package/2D/advancedDynamicTexture.js.map +1 -1
- package/2D/controls/container.d.ts +1 -1
- package/2D/controls/container.js +3 -3
- package/2D/controls/container.js.map +1 -1
- package/2D/controls/control.d.ts +9 -4
- package/2D/controls/control.js +22 -9
- package/2D/controls/control.js.map +1 -1
- package/2D/controls/image.js +3 -0
- package/2D/controls/image.js.map +1 -1
- package/2D/controls/inputText.js +1 -1
- package/2D/controls/inputText.js.map +1 -1
- package/2D/controls/inputTextArea.js +1 -1
- package/2D/controls/inputTextArea.js.map +1 -1
- package/2D/controls/textBlock.js +2 -2
- package/2D/controls/textBlock.js.map +1 -1
- package/package.json +2 -2
@@ -394,8 +394,9 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
394
394
|
* Recreate the content of the ADT from a JSON object
|
395
395
|
* @param serializedObject define the JSON serialized object to restore from
|
396
396
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
397
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
397
398
|
*/
|
398
|
-
parseSerializedObject(serializedObject: any, scaleToSize?: boolean): void;
|
399
|
+
parseSerializedObject(serializedObject: any, scaleToSize?: boolean, urlRewriter?: (url: string) => string): void;
|
399
400
|
/**
|
400
401
|
* Clones the ADT. If no mesh is defined, the GUI will be considered as a fullscreen GUI
|
401
402
|
* @param newName defines the name of the new ADT
|
@@ -407,39 +408,44 @@ export declare class AdvancedDynamicTexture extends DynamicTexture {
|
|
407
408
|
* Recreate the content of the ADT from a JSON object
|
408
409
|
* @param serializedObject define the JSON serialized object to restore from
|
409
410
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
411
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
410
412
|
* @deprecated Please use parseSerializedObject instead
|
411
413
|
*/
|
412
|
-
parseContent: (serializedObject: any, scaleToSize?: boolean) => void;
|
414
|
+
parseContent: (serializedObject: any, scaleToSize?: boolean, urlRewriter?: ((url: string) => string) | undefined) => void;
|
413
415
|
/**
|
414
416
|
* Recreate the content of the ADT from a snippet saved by the GUI editor
|
415
417
|
* @param snippetId defines the snippet to load
|
416
418
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
417
419
|
* @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
|
420
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
418
421
|
* @returns a promise that will resolve on success
|
419
422
|
*/
|
420
|
-
static ParseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture>;
|
423
|
+
static ParseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
|
421
424
|
/**
|
422
425
|
* Recreate the content of the ADT from a snippet saved by the GUI editor
|
423
426
|
* @param snippetId defines the snippet to load
|
424
427
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
428
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
425
429
|
* @returns a promise that will resolve on success
|
426
430
|
*/
|
427
|
-
parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture>;
|
431
|
+
parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
|
428
432
|
/**
|
429
433
|
* Recreate the content of the ADT from a url json
|
430
434
|
* @param url defines the url to load
|
431
435
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
432
436
|
* @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
|
437
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
433
438
|
* @returns a promise that will resolve on success
|
434
439
|
*/
|
435
|
-
static ParseFromFileAsync(url: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture>;
|
440
|
+
static ParseFromFileAsync(url: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
|
436
441
|
/**
|
437
442
|
* Recreate the content of the ADT from a url json
|
438
443
|
* @param url defines the url to load
|
439
444
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
445
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
440
446
|
* @returns a promise that will resolve on success
|
441
447
|
*/
|
442
|
-
parseFromURLAsync(url: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture>;
|
448
|
+
parseFromURLAsync(url: string, scaleToSize?: boolean, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
|
443
449
|
private static _LoadURLContentAsync;
|
444
450
|
/**
|
445
451
|
* Compares two rectangle based controls for pixel overlap
|
@@ -364,6 +364,7 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
364
364
|
* Recreate the content of the ADT from a JSON object
|
365
365
|
* @param serializedObject define the JSON serialized object to restore from
|
366
366
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
367
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
367
368
|
* @deprecated Please use parseSerializedObject instead
|
368
369
|
*/
|
369
370
|
this.parseContent = this.parseSerializedObject;
|
@@ -1149,9 +1150,10 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
1149
1150
|
* Recreate the content of the ADT from a JSON object
|
1150
1151
|
* @param serializedObject define the JSON serialized object to restore from
|
1151
1152
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
1153
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
1152
1154
|
*/
|
1153
|
-
parseSerializedObject(serializedObject, scaleToSize) {
|
1154
|
-
this._rootContainer = Control.Parse(serializedObject.root, this);
|
1155
|
+
parseSerializedObject(serializedObject, scaleToSize, urlRewriter) {
|
1156
|
+
this._rootContainer = Control.Parse(serializedObject.root, this, urlRewriter);
|
1155
1157
|
if (scaleToSize) {
|
1156
1158
|
const width = serializedObject.width;
|
1157
1159
|
const height = serializedObject.height;
|
@@ -1197,47 +1199,51 @@ export class AdvancedDynamicTexture extends DynamicTexture {
|
|
1197
1199
|
* @param snippetId defines the snippet to load
|
1198
1200
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
1199
1201
|
* @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
|
1202
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
1200
1203
|
* @returns a promise that will resolve on success
|
1201
1204
|
*/
|
1202
|
-
static async ParseFromSnippetAsync(snippetId, scaleToSize, appendToAdt) {
|
1205
|
+
static async ParseFromSnippetAsync(snippetId, scaleToSize, appendToAdt, urlRewriter) {
|
1203
1206
|
const adt = appendToAdt ?? AdvancedDynamicTexture.CreateFullscreenUI("ADT from snippet");
|
1204
1207
|
if (snippetId === "_BLANK") {
|
1205
1208
|
return adt;
|
1206
1209
|
}
|
1207
1210
|
const serialized = await AdvancedDynamicTexture._LoadURLContentAsync(AdvancedDynamicTexture.SnippetUrl + "/" + snippetId.replace(/#/g, "/"), true);
|
1208
|
-
adt.parseSerializedObject(serialized, scaleToSize);
|
1211
|
+
adt.parseSerializedObject(serialized, scaleToSize, urlRewriter);
|
1209
1212
|
return adt;
|
1210
1213
|
}
|
1211
1214
|
/**
|
1212
1215
|
* Recreate the content of the ADT from a snippet saved by the GUI editor
|
1213
1216
|
* @param snippetId defines the snippet to load
|
1214
1217
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
1218
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
1215
1219
|
* @returns a promise that will resolve on success
|
1216
1220
|
*/
|
1217
|
-
parseFromSnippetAsync(snippetId, scaleToSize) {
|
1218
|
-
return AdvancedDynamicTexture.ParseFromSnippetAsync(snippetId, scaleToSize, this);
|
1221
|
+
parseFromSnippetAsync(snippetId, scaleToSize, urlRewriter) {
|
1222
|
+
return AdvancedDynamicTexture.ParseFromSnippetAsync(snippetId, scaleToSize, this, urlRewriter);
|
1219
1223
|
}
|
1220
1224
|
/**
|
1221
1225
|
* Recreate the content of the ADT from a url json
|
1222
1226
|
* @param url defines the url to load
|
1223
1227
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
1224
1228
|
* @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
|
1229
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
1225
1230
|
* @returns a promise that will resolve on success
|
1226
1231
|
*/
|
1227
|
-
static async ParseFromFileAsync(url, scaleToSize, appendToAdt) {
|
1232
|
+
static async ParseFromFileAsync(url, scaleToSize, appendToAdt, urlRewriter) {
|
1228
1233
|
const adt = appendToAdt ?? AdvancedDynamicTexture.CreateFullscreenUI("ADT from URL");
|
1229
1234
|
const serialized = await AdvancedDynamicTexture._LoadURLContentAsync(url);
|
1230
|
-
adt.parseSerializedObject(serialized, scaleToSize);
|
1235
|
+
adt.parseSerializedObject(serialized, scaleToSize, urlRewriter);
|
1231
1236
|
return adt;
|
1232
1237
|
}
|
1233
1238
|
/**
|
1234
1239
|
* Recreate the content of the ADT from a url json
|
1235
1240
|
* @param url defines the url to load
|
1236
1241
|
* @param scaleToSize defines whether to scale to texture to the saved size
|
1242
|
+
* @param urlRewriter defines an url rewriter to update urls before sending them to the controls
|
1237
1243
|
* @returns a promise that will resolve on success
|
1238
1244
|
*/
|
1239
|
-
parseFromURLAsync(url, scaleToSize) {
|
1240
|
-
return AdvancedDynamicTexture.ParseFromFileAsync(url, scaleToSize, this);
|
1245
|
+
parseFromURLAsync(url, scaleToSize, urlRewriter) {
|
1246
|
+
return AdvancedDynamicTexture.ParseFromFileAsync(url, scaleToSize, this, urlRewriter);
|
1241
1247
|
}
|
1242
1248
|
static _LoadURLContentAsync(url, snippet = false) {
|
1243
1249
|
if (url === "") {
|