babylonjs-gui 5.43.1 → 5.44.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/babylon.gui.d.ts CHANGED
@@ -584,6 +584,7 @@ declare module BABYLON.GUI {
584
584
  * @internal
585
585
  */
586
586
  _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
587
+ protected _getRectangleFill(context: BABYLON.ICanvasRenderingContext): string | import("core/Engines/ICanvas").ICanvasGradient;
587
588
  /**
588
589
  * @internal
589
590
  */
@@ -787,6 +788,8 @@ declare module BABYLON.GUI {
787
788
  /** @internal */
788
789
  protected _background: string;
789
790
  /** @internal */
791
+ protected _backgroundGradient: BABYLON.Nullable<BaseGradient>;
792
+ /** @internal */
790
793
  protected _adaptWidthToChildren: boolean;
791
794
  /** @internal */
792
795
  protected _adaptHeightToChildren: boolean;
@@ -814,6 +817,9 @@ declare module BABYLON.GUI {
814
817
  /** Gets or sets background color */
815
818
  get background(): string;
816
819
  set background(value: string);
820
+ /** Gets or sets background gradient color. Takes precedence over background */
821
+ get backgroundGradient(): BABYLON.Nullable<BaseGradient>;
822
+ set backgroundGradient(value: BABYLON.Nullable<BaseGradient>);
817
823
  /** Gets the list of children */
818
824
  get children(): Control[];
819
825
  get isReadOnly(): boolean;
@@ -883,6 +889,7 @@ declare module BABYLON.GUI {
883
889
  _offsetTop(offset: number): void;
884
890
  /** @internal */
885
891
  _markAllAsDirty(): void;
892
+ protected _getBackgroundColor(context: BABYLON.ICanvasRenderingContext): string | BABYLON.ICanvasGradient;
886
893
  /**
887
894
  * @internal
888
895
  */
@@ -1024,6 +1031,7 @@ declare module BABYLON.GUI {
1024
1031
  protected _disabledColor: string;
1025
1032
  protected _disabledColorItem: string;
1026
1033
  protected _isReadOnly: boolean;
1034
+ private _gradient;
1027
1035
  /** @internal */
1028
1036
  protected _rebuildLayout: boolean;
1029
1037
  /** @internal */
@@ -1293,6 +1301,9 @@ declare module BABYLON.GUI {
1293
1301
  /** Gets or sets foreground color */
1294
1302
  get color(): string;
1295
1303
  set color(value: string);
1304
+ /** Gets or sets gradient. Setting a gradient will override the color */
1305
+ get gradient(): BABYLON.Nullable<BaseGradient>;
1306
+ set gradient(value: BABYLON.Nullable<BaseGradient>);
1296
1307
  /** Gets or sets z index which is used to reorder controls on the z axis */
1297
1308
  get zIndex(): number;
1298
1309
  set zIndex(value: number);
@@ -1589,6 +1600,7 @@ declare module BABYLON.GUI {
1589
1600
  * @internal
1590
1601
  */
1591
1602
  _renderHighlightSpecific(context: BABYLON.ICanvasRenderingContext): void;
1603
+ protected _getColor(context: BABYLON.ICanvasRenderingContext): string | BABYLON.ICanvasGradient;
1592
1604
  /**
1593
1605
  * @internal
1594
1606
  */
@@ -1900,6 +1912,162 @@ declare module BABYLON.GUI {
1900
1912
  }
1901
1913
 
1902
1914
 
1915
+ /**
1916
+ * Type that represents a single stop on the gradient.
1917
+ */
1918
+ export type GradientColorStop = {
1919
+ /**
1920
+ * Offset from the start where the color will be applied.
1921
+ */
1922
+ offset: number;
1923
+ /**
1924
+ * Color to be applied.
1925
+ */
1926
+ color: string;
1927
+ };
1928
+ /**
1929
+ * Class that serves as a base for all the gradients created from context.
1930
+ */
1931
+ export abstract class BaseGradient {
1932
+ private _colorStops;
1933
+ private _canvasGradient;
1934
+ private _context;
1935
+ private _gradientDirty;
1936
+ /**
1937
+ * Overwritten by child classes to create the canvas gradient.
1938
+ * @param context
1939
+ */
1940
+ protected abstract _createCanvasGradient(context: BABYLON.ICanvasRenderingContext): BABYLON.ICanvasGradient;
1941
+ private _addColorStopsToCanvasGradient;
1942
+ /**
1943
+ * If there are any changes or the context changed, regenerate the canvas gradient object. Else,
1944
+ * reuse the existing gradient.
1945
+ **/
1946
+ getCanvasGradient(context: BABYLON.ICanvasRenderingContext): CanvasGradient;
1947
+ /**
1948
+ * Adds a new color stop to the gradient.
1949
+ * @param offset the offset of the stop on the gradient. Should be between 0 and 1
1950
+ * @param color the color of the stop
1951
+ */
1952
+ addColorStop(offset: number, color: string): void;
1953
+ /**
1954
+ * Removes an existing color stop with the specified offset from the gradient
1955
+ * @param offset the offset of the stop to be removed
1956
+ */
1957
+ removeColorStop(offset: number): void;
1958
+ /**
1959
+ * Removes all color stops from the gradient
1960
+ */
1961
+ clearColorStops(): void;
1962
+ /** Color stops of the gradient */
1963
+ get colorStops(): GradientColorStop[];
1964
+ /** Type of the gradient */
1965
+ getClassName(): string;
1966
+ /** Serialize into a json object */
1967
+ serialize(serializationObject: any): void;
1968
+ /** Parse from json object */
1969
+ parse(serializationObject: any): void;
1970
+ }
1971
+
1972
+
1973
+ /**
1974
+ * Gradient along a line that connects two coordinates.
1975
+ * These coordinates are relative to the canvas' space, not to any control's space.
1976
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createLinearGradient
1977
+ */
1978
+ export class LinearGradient extends BaseGradient {
1979
+ private _x0;
1980
+ private _y0;
1981
+ private _x1;
1982
+ private _y1;
1983
+ /**
1984
+ * Creates a new linear gradient
1985
+ * @param x0
1986
+ * @param y0
1987
+ * @param x1
1988
+ * @param y1
1989
+ */
1990
+ constructor(x0?: number, y0?: number, x1?: number, y1?: number);
1991
+ protected _createCanvasGradient(context: BABYLON.ICanvasRenderingContext): BABYLON.ICanvasGradient;
1992
+ /** X axis coordinate of the starting point in the line */
1993
+ get x0(): number;
1994
+ /** X axis coordinate of the ending point in the line */
1995
+ get x1(): number;
1996
+ /** Y axis coordinate of the starting point in the line */
1997
+ get y0(): number;
1998
+ /** Y axis coordinate of the ending point in the line */
1999
+ get y1(): number;
2000
+ /**
2001
+ * Class name of the gradient
2002
+ * @returns the class name of the gradient
2003
+ */
2004
+ getClassName(): string;
2005
+ /**
2006
+ * Serializes this gradient
2007
+ * @param serializationObject the object to serialize to
2008
+ */
2009
+ serialize(serializationObject: any): void;
2010
+ /**
2011
+ * Parses a gradient from a serialization object
2012
+ * @param serializationObject the object to parse from
2013
+ */
2014
+ parse(serializationObject: any): void;
2015
+ }
2016
+
2017
+
2018
+ /**
2019
+ * Gradient formed from two circles with their own centers and radius.
2020
+ * The coordinates of the circles centers are relative to the canvas' space, not to any control's space.
2021
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/createRadialGradient
2022
+ */
2023
+ export class RadialGradient extends BaseGradient {
2024
+ private _x0;
2025
+ private _y0;
2026
+ private _r0;
2027
+ private _x1;
2028
+ private _y1;
2029
+ private _r1;
2030
+ /**
2031
+ * Creates a new radial gradient
2032
+ * @param x0 x coordinate of the first circle's center
2033
+ * @param y0 y coordinate of the first circle's center
2034
+ * @param r0 radius of the first circle
2035
+ * @param x1 x coordinate of the second circle's center
2036
+ * @param y1 y coordinate of the second circle's center
2037
+ * @param r1 radius of the second circle
2038
+ */
2039
+ constructor(x0?: number, y0?: number, r0?: number, x1?: number, y1?: number, r1?: number);
2040
+ protected _createCanvasGradient(context: BABYLON.ICanvasRenderingContext): BABYLON.ICanvasGradient;
2041
+ /** x coordinate of the first circle's center */
2042
+ get x0(): number;
2043
+ /** x coordinate of the second circle's center */
2044
+ get x1(): number;
2045
+ /** y coordinate of the first circle's center */
2046
+ get y0(): number;
2047
+ /** y coordinate of the second circle's center */
2048
+ get y1(): number;
2049
+ /** radius of the first circle */
2050
+ get r0(): number;
2051
+ /** radius of the second circle */
2052
+ get r1(): number;
2053
+ /**
2054
+ * Class name of the gradient
2055
+ * @returns the class name of the gradient
2056
+ */
2057
+ getClassName(): string;
2058
+ /**
2059
+ * Serializes this gradient
2060
+ * @param serializationObject the object to serialize to
2061
+ */
2062
+ serialize(serializationObject: any): void;
2063
+ /**
2064
+ * Parses a gradient from a serialization object
2065
+ * @param serializationObject the object to parse from
2066
+ */
2067
+ parse(serializationObject: any): void;
2068
+ }
2069
+
2070
+
1903
2071
  /**
1904
2072
  * Class used to create a 2D grid container
1905
2073
  */
@@ -2813,6 +2981,7 @@ declare module BABYLON.GUI {
2813
2981
  protected _computeAdditionnalOffsetX(): 1 | 0;
2814
2982
  /** @internal */
2815
2983
  protected _computeAdditionnalOffsetY(): 1 | 0;
2984
+ protected _getRectangleFill(context: BABYLON.ICanvasRenderingContext): string | BABYLON.ICanvasGradient;
2816
2985
  protected _localDraw(context: BABYLON.ICanvasRenderingContext): void;
2817
2986
  protected _additionalProcessing(parentMeasure: Measure, context: BABYLON.ICanvasRenderingContext): void;
2818
2987
  private _drawRoundedRect;
@@ -3471,12 +3640,16 @@ declare module BABYLON.GUI {
3471
3640
  private _borderColor;
3472
3641
  private _tempMeasure;
3473
3642
  private _invertScrollDirection;
3643
+ private _backgroundGradient;
3474
3644
  /** Gets or sets border color */
3475
3645
  get borderColor(): string;
3476
3646
  set borderColor(value: string);
3477
3647
  /** Gets or sets background color */
3478
3648
  get background(): string;
3479
3649
  set background(value: string);
3650
+ /** Gets or sets background gradient. Takes precedence over gradient. */
3651
+ get backgroundGradient(): BABYLON.Nullable<BaseGradient>;
3652
+ set backgroundGradient(value: BABYLON.Nullable<BaseGradient>);
3480
3653
  /** Inverts the scrolling direction (default: false) */
3481
3654
  get invertScrollDirection(): boolean;
3482
3655
  set invertScrollDirection(invert: boolean);
@@ -3487,6 +3660,7 @@ declare module BABYLON.GUI {
3487
3660
  constructor(name?: string | undefined);
3488
3661
  protected _getTypeName(): string;
3489
3662
  protected _getThumbThickness(): number;
3663
+ private _getBackgroundColor;
3490
3664
  _draw(context: BABYLON.ICanvasRenderingContext): void;
3491
3665
  private _first;
3492
3666
  private _originX;
@@ -3496,6 +3670,8 @@ declare module BABYLON.GUI {
3496
3670
  */
3497
3671
  protected _updateValueFromPointer(x: number, y: number): void;
3498
3672
  _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
3673
+ serialize(serializationObject: any): void;
3674
+ _parseFromContent(serializationObject: any, host: AdvancedDynamicTexture): void;
3499
3675
  }
3500
3676
 
3501
3677
 
@@ -3509,6 +3685,7 @@ declare module BABYLON.GUI {
3509
3685
  private _thumbColor;
3510
3686
  private _isThumbCircle;
3511
3687
  protected _displayValueBar: boolean;
3688
+ private _backgroundGradient;
3512
3689
  /** Gets or sets a boolean indicating if the value bar must be rendered */
3513
3690
  get displayValueBar(): boolean;
3514
3691
  set displayValueBar(value: boolean);
@@ -3518,6 +3695,9 @@ declare module BABYLON.GUI {
3518
3695
  /** Gets or sets background color */
3519
3696
  get background(): string;
3520
3697
  set background(value: string);
3698
+ /** Gets or sets background gradient */
3699
+ get backgroundGradient(): BABYLON.Nullable<BaseGradient>;
3700
+ set backgroundGradient(value: BABYLON.Nullable<BaseGradient>);
3521
3701
  /** Gets or sets thumb's color */
3522
3702
  get thumbColor(): string;
3523
3703
  set thumbColor(value: string);
@@ -3530,7 +3710,11 @@ declare module BABYLON.GUI {
3530
3710
  */
3531
3711
  constructor(name?: string | undefined);
3532
3712
  protected _getTypeName(): string;
3713
+ protected _getBackgroundColor(context: BABYLON.ICanvasRenderingContext): string | CanvasGradient;
3533
3714
  _draw(context: BABYLON.ICanvasRenderingContext): void;
3715
+ serialize(serializationObject: any): void;
3716
+ /** @internal */
3717
+ _parseFromContent(serializedObject: any, host: AdvancedDynamicTexture): void;
3534
3718
  }
3535
3719
 
3536
3720
 
@@ -3640,6 +3824,7 @@ declare module BABYLON.GUI {
3640
3824
  private _underline;
3641
3825
  private _lineThrough;
3642
3826
  private _wordDivider;
3827
+ private _forceResizeWidth;
3643
3828
  /**
3644
3829
  * An event triggered after the text is changed
3645
3830
  */
@@ -3744,6 +3929,13 @@ declare module BABYLON.GUI {
3744
3929
  * Gets or sets word divider
3745
3930
  */
3746
3931
  set wordDivider(value: string);
3932
+ /**
3933
+ * By default, if a text block has text wrapping other than Clip, its width
3934
+ * is not resized even if resizeToFit = true. This parameter forces the width
3935
+ * to be resized.
3936
+ */
3937
+ get forceResizeWidth(): boolean;
3938
+ set forceResizeWidth(value: boolean);
3747
3939
  /**
3748
3940
  * Creates a new TextBlock object
3749
3941
  * @param name defines the name of the control