babylonjs-gui 7.5.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.
@@ -451,8 +451,9 @@ export class AdvancedDynamicTexture extends DynamicTexture {
451
451
  * Recreate the content of the ADT from a JSON object
452
452
  * @param serializedObject define the JSON serialized object to restore from
453
453
  * @param scaleToSize defines whether to scale to texture to the saved size
454
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
454
455
  */
455
- parseSerializedObject(serializedObject: any, scaleToSize?: boolean): void;
456
+ parseSerializedObject(serializedObject: any, scaleToSize?: boolean, urlRewriter?: (url: string) => string): void;
456
457
  /**
457
458
  * Clones the ADT. If no mesh is defined, the GUI will be considered as a fullscreen GUI
458
459
  * @param newName defines the name of the new ADT
@@ -464,39 +465,44 @@ export class AdvancedDynamicTexture extends DynamicTexture {
464
465
  * Recreate the content of the ADT from a JSON object
465
466
  * @param serializedObject define the JSON serialized object to restore from
466
467
  * @param scaleToSize defines whether to scale to texture to the saved size
468
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
467
469
  * @deprecated Please use parseSerializedObject instead
468
470
  */
469
- parseContent: (serializedObject: any, scaleToSize?: boolean) => void;
471
+ parseContent: (serializedObject: any, scaleToSize?: boolean, urlRewriter?: ((url: string) => string) | undefined) => void;
470
472
  /**
471
473
  * Recreate the content of the ADT from a snippet saved by the GUI editor
472
474
  * @param snippetId defines the snippet to load
473
475
  * @param scaleToSize defines whether to scale to texture to the saved size
474
476
  * @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
477
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
475
478
  * @returns a promise that will resolve on success
476
479
  */
477
- static ParseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture>;
480
+ static ParseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
478
481
  /**
479
482
  * Recreate the content of the ADT from a snippet saved by the GUI editor
480
483
  * @param snippetId defines the snippet to load
481
484
  * @param scaleToSize defines whether to scale to texture to the saved size
485
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
482
486
  * @returns a promise that will resolve on success
483
487
  */
484
- parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture>;
488
+ parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
485
489
  /**
486
490
  * Recreate the content of the ADT from a url json
487
491
  * @param url defines the url to load
488
492
  * @param scaleToSize defines whether to scale to texture to the saved size
489
493
  * @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
494
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
490
495
  * @returns a promise that will resolve on success
491
496
  */
492
- static ParseFromFileAsync(url: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture>;
497
+ static ParseFromFileAsync(url: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
493
498
  /**
494
499
  * Recreate the content of the ADT from a url json
495
500
  * @param url defines the url to load
496
501
  * @param scaleToSize defines whether to scale to texture to the saved size
502
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
497
503
  * @returns a promise that will resolve on success
498
504
  */
499
- parseFromURLAsync(url: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture>;
505
+ parseFromURLAsync(url: string, scaleToSize?: boolean, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
500
506
  private static _LoadURLContentAsync;
501
507
  /**
502
508
  * Compares two rectangle based controls for pixel overlap
@@ -1009,7 +1015,7 @@ export class Container extends Control {
1009
1015
  /**
1010
1016
  * @internal
1011
1017
  */
1012
- _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
1018
+ _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): void;
1013
1019
  isReady(): boolean;
1014
1020
  }
1015
1021
 
@@ -1032,6 +1038,7 @@ import { IAccessibilityTag } from "babylonjs/IAccessibilityTag";
1032
1038
  import { IAnimatable } from "babylonjs/Animations/animatable.interface";
1033
1039
  import { Animation } from "babylonjs/Animations/animation";
1034
1040
  import { BaseGradient } from "babylonjs-gui/2D/controls/gradient/BaseGradient";
1041
+ import { AbstractEngine } from "babylonjs/Engines/abstractEngine";
1035
1042
  /**
1036
1043
  * Root class used for all 2D controls
1037
1044
  * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#controls
@@ -1130,6 +1137,8 @@ export class Control implements IAnimatable {
1130
1137
  private _gradient;
1131
1138
  /** @internal */
1132
1139
  protected _rebuildLayout: boolean;
1140
+ /** @internal */
1141
+ protected _urlRewriter?: (url: string) => string;
1133
1142
  /**
1134
1143
  * Observable that fires when the control's enabled state changes
1135
1144
  */
@@ -1836,9 +1845,10 @@ export class Control implements IAnimatable {
1836
1845
  * Parses a serialized object into this control
1837
1846
  * @param serializedObject the object with the serialized properties
1838
1847
  * @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
1848
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
1839
1849
  * @returns this control
1840
1850
  */
1841
- parse(serializedObject: any, host?: AdvancedDynamicTexture): Control;
1851
+ parse(serializedObject: any, host?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Control;
1842
1852
  /**
1843
1853
  * Serializes the current control
1844
1854
  * @param serializationObject defined the JSON serialized object
@@ -1849,7 +1859,7 @@ export class Control implements IAnimatable {
1849
1859
  /**
1850
1860
  * @internal
1851
1861
  */
1852
- _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
1862
+ _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): void;
1853
1863
  /** Releases associated resources */
1854
1864
  dispose(): void;
1855
1865
  private static _HORIZONTAL_ALIGNMENT_LEFT;
@@ -1874,7 +1884,7 @@ export class Control implements IAnimatable {
1874
1884
  /**
1875
1885
  * @internal
1876
1886
  */
1877
- static _GetFontOffset(font: string): {
1887
+ static _GetFontOffset(font: string, engineToUse?: AbstractEngine): {
1878
1888
  ascent: number;
1879
1889
  height: number;
1880
1890
  descent: number;
@@ -1883,9 +1893,10 @@ export class Control implements IAnimatable {
1883
1893
  * Creates a Control from parsed data
1884
1894
  * @param serializedObject defines parsed data
1885
1895
  * @param host defines the hosting AdvancedDynamicTexture
1896
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
1886
1897
  * @returns a new Control
1887
1898
  */
1888
- static Parse(serializedObject: any, host: AdvancedDynamicTexture): Control;
1899
+ static Parse(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Control;
1889
1900
  static AddHeader: (control: Control, text: string, size: string | number, options: {
1890
1901
  isHorizontal: boolean;
1891
1902
  controlFirst: boolean;
@@ -9287,8 +9298,9 @@ declare module BABYLON.GUI {
9287
9298
  * Recreate the content of the ADT from a JSON object
9288
9299
  * @param serializedObject define the JSON serialized object to restore from
9289
9300
  * @param scaleToSize defines whether to scale to texture to the saved size
9301
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
9290
9302
  */
9291
- parseSerializedObject(serializedObject: any, scaleToSize?: boolean): void;
9303
+ parseSerializedObject(serializedObject: any, scaleToSize?: boolean, urlRewriter?: (url: string) => string): void;
9292
9304
  /**
9293
9305
  * Clones the ADT. If no mesh is defined, the GUI will be considered as a fullscreen GUI
9294
9306
  * @param newName defines the name of the new ADT
@@ -9300,39 +9312,44 @@ declare module BABYLON.GUI {
9300
9312
  * Recreate the content of the ADT from a JSON object
9301
9313
  * @param serializedObject define the JSON serialized object to restore from
9302
9314
  * @param scaleToSize defines whether to scale to texture to the saved size
9315
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
9303
9316
  * @deprecated Please use parseSerializedObject instead
9304
9317
  */
9305
- parseContent: (serializedObject: any, scaleToSize?: boolean) => void;
9318
+ parseContent: (serializedObject: any, scaleToSize?: boolean, urlRewriter?: ((url: string) => string) | undefined) => void;
9306
9319
  /**
9307
9320
  * Recreate the content of the ADT from a snippet saved by the GUI editor
9308
9321
  * @param snippetId defines the snippet to load
9309
9322
  * @param scaleToSize defines whether to scale to texture to the saved size
9310
9323
  * @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
9324
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
9311
9325
  * @returns a promise that will resolve on success
9312
9326
  */
9313
- static ParseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture>;
9327
+ static ParseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
9314
9328
  /**
9315
9329
  * Recreate the content of the ADT from a snippet saved by the GUI editor
9316
9330
  * @param snippetId defines the snippet to load
9317
9331
  * @param scaleToSize defines whether to scale to texture to the saved size
9332
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
9318
9333
  * @returns a promise that will resolve on success
9319
9334
  */
9320
- parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture>;
9335
+ parseFromSnippetAsync(snippetId: string, scaleToSize?: boolean, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
9321
9336
  /**
9322
9337
  * Recreate the content of the ADT from a url json
9323
9338
  * @param url defines the url to load
9324
9339
  * @param scaleToSize defines whether to scale to texture to the saved size
9325
9340
  * @param appendToAdt if provided the snippet will be appended to the adt. Otherwise a fullscreen ADT will be created.
9341
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
9326
9342
  * @returns a promise that will resolve on success
9327
9343
  */
9328
- static ParseFromFileAsync(url: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture): Promise<AdvancedDynamicTexture>;
9344
+ static ParseFromFileAsync(url: string, scaleToSize?: boolean, appendToAdt?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
9329
9345
  /**
9330
9346
  * Recreate the content of the ADT from a url json
9331
9347
  * @param url defines the url to load
9332
9348
  * @param scaleToSize defines whether to scale to texture to the saved size
9349
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
9333
9350
  * @returns a promise that will resolve on success
9334
9351
  */
9335
- parseFromURLAsync(url: string, scaleToSize?: boolean): Promise<AdvancedDynamicTexture>;
9352
+ parseFromURLAsync(url: string, scaleToSize?: boolean, urlRewriter?: (url: string) => string): Promise<AdvancedDynamicTexture>;
9336
9353
  private static _LoadURLContentAsync;
9337
9354
  /**
9338
9355
  * Compares two rectangle based controls for pixel overlap
@@ -9809,7 +9826,7 @@ declare module BABYLON.GUI {
9809
9826
  /**
9810
9827
  * @internal
9811
9828
  */
9812
- _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
9829
+ _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): void;
9813
9830
  isReady(): boolean;
9814
9831
  }
9815
9832
 
@@ -9912,6 +9929,8 @@ declare module BABYLON.GUI {
9912
9929
  private _gradient;
9913
9930
  /** @internal */
9914
9931
  protected _rebuildLayout: boolean;
9932
+ /** @internal */
9933
+ protected _urlRewriter?: (url: string) => string;
9915
9934
  /**
9916
9935
  * BABYLON.Observable that fires when the control's enabled state changes
9917
9936
  */
@@ -10618,9 +10637,10 @@ declare module BABYLON.GUI {
10618
10637
  * Parses a serialized object into this control
10619
10638
  * @param serializedObject the object with the serialized properties
10620
10639
  * @param host the texture where the control will be instantiated. Can be empty, in which case the control will be created on the same texture
10640
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
10621
10641
  * @returns this control
10622
10642
  */
10623
- parse(serializedObject: any, host?: AdvancedDynamicTexture): Control;
10643
+ parse(serializedObject: any, host?: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Control;
10624
10644
  /**
10625
10645
  * Serializes the current control
10626
10646
  * @param serializationObject defined the JSON serialized object
@@ -10631,7 +10651,7 @@ declare module BABYLON.GUI {
10631
10651
  /**
10632
10652
  * @internal
10633
10653
  */
10634
- _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
10654
+ _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): void;
10635
10655
  /** Releases associated resources */
10636
10656
  dispose(): void;
10637
10657
  private static _HORIZONTAL_ALIGNMENT_LEFT;
@@ -10656,7 +10676,7 @@ declare module BABYLON.GUI {
10656
10676
  /**
10657
10677
  * @internal
10658
10678
  */
10659
- static _GetFontOffset(font: string): {
10679
+ static _GetFontOffset(font: string, engineToUse?: BABYLON.AbstractEngine): {
10660
10680
  ascent: number;
10661
10681
  height: number;
10662
10682
  descent: number;
@@ -10665,9 +10685,10 @@ declare module BABYLON.GUI {
10665
10685
  * Creates a Control from parsed data
10666
10686
  * @param serializedObject defines parsed data
10667
10687
  * @param host defines the hosting AdvancedDynamicTexture
10688
+ * @param urlRewriter defines an url rewriter to update urls before sending them to the controls
10668
10689
  * @returns a new Control
10669
10690
  */
10670
- static Parse(serializedObject: any, host: AdvancedDynamicTexture): Control;
10691
+ static Parse(serializedObject: any, host: AdvancedDynamicTexture, urlRewriter?: (url: string) => string): Control;
10671
10692
  static AddHeader: (control: Control, text: string, size: string | number, options: {
10672
10693
  isHorizontal: boolean;
10673
10694
  controlFirst: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "babylonjs-gui",
3
- "version": "7.5.0",
3
+ "version": "7.6.0",
4
4
  "main": "babylon.gui.js",
5
5
  "types": "babylon.gui.module.d.ts",
6
6
  "files": [
@@ -15,7 +15,7 @@
15
15
  "test:escheck": "es-check es6 ./babylon.gui.js"
16
16
  },
17
17
  "dependencies": {
18
- "babylonjs": "^7.5.0"
18
+ "babylonjs": "^7.6.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@dev/build-tools": "1.0.0",