babylonjs-gui 7.12.0 → 7.13.1

Sign up to get free protection for your applications and to get access to all the features.
package/babylon.gui.d.ts CHANGED
@@ -159,6 +159,11 @@ declare module BABYLON.GUI {
159
159
  * Gets or sets a boolean indicating that the canvas must be reverted on Y when updating the texture
160
160
  */
161
161
  applyYInversionOnUpdate: boolean;
162
+ /**
163
+ * A boolean indicating whether or not the elements can be navigated to using the tab key.
164
+ * Defaults to false.
165
+ */
166
+ disableTabNavigation: boolean;
162
167
  /**
163
168
  * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
164
169
  * Useful when you want more antialiasing
@@ -236,8 +241,8 @@ declare module BABYLON.GUI {
236
241
  /**
237
242
  * Gets or sets the current focused control
238
243
  */
239
- get focusedControl(): BABYLON.Nullable<IFocusableControl>;
240
- set focusedControl(control: BABYLON.Nullable<IFocusableControl>);
244
+ get focusedControl(): BABYLON.Nullable<Control>;
245
+ set focusedControl(control: BABYLON.Nullable<Control>);
241
246
  /**
242
247
  * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
243
248
  */
@@ -382,6 +387,7 @@ declare module BABYLON.GUI {
382
387
  private _translateToPicking;
383
388
  /** Attach to all scene events required to support pointer events */
384
389
  attach(): void;
390
+ private _focusNextElement;
385
391
  /**
386
392
  * @internal
387
393
  */
@@ -418,7 +424,7 @@ declare module BABYLON.GUI {
418
424
  * Move the focus to a specific control
419
425
  * @param control defines the control which will receive the focus
420
426
  */
421
- moveFocusToControl(control: IFocusableControl): void;
427
+ moveFocusToControl(control: Control): void;
422
428
  private _manageFocus;
423
429
  private _attachPickingToSceneRender;
424
430
  private _attachToOnPointerOut;
@@ -971,7 +977,7 @@ declare module BABYLON.GUI {
971
977
  * Root class used for all 2D controls
972
978
  * @see https://doc.babylonjs.com/features/featuresDeepDive/gui/gui#controls
973
979
  */
974
- export class Control implements BABYLON.IAnimatable {
980
+ export class Control implements BABYLON.IAnimatable, IFocusableControl {
975
981
  /** defines the name of the control */
976
982
  name?: string | undefined;
977
983
  /**
@@ -1193,6 +1199,10 @@ declare module BABYLON.GUI {
1193
1199
  * An event triggered when a control is clicked on
1194
1200
  */
1195
1201
  onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
1202
+ /**
1203
+ * An event triggered when a control receives an ENTER key down event
1204
+ */
1205
+ onEnterPressedObservable: BABYLON.Observable<Control>;
1196
1206
  /**
1197
1207
  * An event triggered when pointer enters the control
1198
1208
  */
@@ -1513,6 +1523,52 @@ declare module BABYLON.GUI {
1513
1523
  * Array of animations
1514
1524
  */
1515
1525
  animations: BABYLON.Nullable<BABYLON.Animation[]>;
1526
+ protected _focusedColor: BABYLON.Nullable<string>;
1527
+ /**
1528
+ * Border color when control is focused
1529
+ * When not defined the ADT color will be used. If no ADT color is defined, focused state won't have any border
1530
+ */
1531
+ get focusedColor(): BABYLON.Nullable<string>;
1532
+ set focusedColor(value: BABYLON.Nullable<string>);
1533
+ /**
1534
+ * The tab index of this control. -1 indicates this control is not part of the tab navigation.
1535
+ * A positive value indicates the order of the control in the tab navigation.
1536
+ * A value of 0 indicated the control will be focused after all controls with a positive index.
1537
+ * More than one control can have the same tab index and the navigation would then go through all controls with the same value in an order defined by the layout or the hierarchy.
1538
+ * The value can be changed at any time.
1539
+ * @see https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/tabindex
1540
+ */
1541
+ tabIndex: number;
1542
+ protected _isFocused: boolean;
1543
+ protected _unfocusedColor: BABYLON.Nullable<string>;
1544
+ /** BABYLON.Observable raised when the control gets the focus */
1545
+ onFocusObservable: BABYLON.Observable<Control>;
1546
+ /** BABYLON.Observable raised when the control loses the focus */
1547
+ onBlurObservable: BABYLON.Observable<Control>;
1548
+ /** BABYLON.Observable raised when a key event was processed */
1549
+ onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
1550
+ /** @internal */
1551
+ onBlur(): void;
1552
+ /** @internal */
1553
+ onFocus(): void;
1554
+ /**
1555
+ * Function called to get the list of controls that should not steal the focus from this control
1556
+ * @returns an array of controls
1557
+ */
1558
+ keepsFocusWith(): BABYLON.Nullable<Control[]>;
1559
+ /**
1560
+ * Function to focus a button programmatically
1561
+ */
1562
+ focus(): void;
1563
+ /**
1564
+ * Function to unfocus a button programmatically
1565
+ */
1566
+ blur(): void;
1567
+ /**
1568
+ * Handles the keyboard event
1569
+ * @param evt Defines the KeyboardEvent
1570
+ */
1571
+ processKeyboard(evt: BABYLON.IKeyboardEvent): void;
1516
1572
  /**
1517
1573
  * Creates a new control
1518
1574
  * @param name defines the name of the control
@@ -1924,45 +1980,11 @@ declare module BABYLON.GUI {
1924
1980
  */
1925
1981
  export class FocusableButton extends Button implements IFocusableControl {
1926
1982
  name?: string | undefined;
1927
- /** Highlight color when button is focused */
1928
- focusedColor: BABYLON.Nullable<string>;
1929
- private _isFocused;
1930
- private _unfocusedColor;
1931
- /** BABYLON.Observable raised when the control gets the focus */
1932
- onFocusObservable: BABYLON.Observable<Button>;
1933
- /** BABYLON.Observable raised when the control loses the focus */
1934
- onBlurObservable: BABYLON.Observable<Button>;
1935
- /** BABYLON.Observable raised when a key event was processed */
1936
- onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
1937
1983
  constructor(name?: string | undefined);
1938
- /** @internal */
1939
- onBlur(): void;
1940
- /** @internal */
1941
- onFocus(): void;
1942
- /**
1943
- * Function called to get the list of controls that should not steal the focus from this control
1944
- * @returns an array of controls
1945
- */
1946
- keepsFocusWith(): BABYLON.Nullable<Control[]>;
1947
- /**
1948
- * Function to focus a button programmatically
1949
- */
1950
- focus(): void;
1951
- /**
1952
- * Function to unfocus a button programmatically
1953
- */
1954
- blur(): void;
1955
- /**
1956
- * Handles the keyboard event
1957
- * @param evt Defines the KeyboardEvent
1958
- */
1959
- processKeyboard(evt: BABYLON.IKeyboardEvent): void;
1960
1984
  /**
1961
1985
  * @internal
1962
1986
  */
1963
1987
  _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
1964
- /** @internal */
1965
- dispose(): void;
1966
1988
  }
1967
1989
 
1968
1990
 
@@ -1996,6 +2018,15 @@ declare module BABYLON.GUI {
1996
2018
  * Function to unfocus the control programmatically
1997
2019
  */
1998
2020
  blur(): void;
2021
+ /**
2022
+ * Gets or sets the tabIndex of the control
2023
+ */
2024
+ tabIndex?: number;
2025
+ /**
2026
+ * Gets or sets the color used to draw the focus border
2027
+ * Defaults to "white"
2028
+ */
2029
+ focusBorderColor?: string;
1999
2030
  }
2000
2031
 
2001
2032
 
@@ -2550,19 +2581,17 @@ declare module BABYLON.GUI {
2550
2581
  /**
2551
2582
  * Class used to create input text control
2552
2583
  */
2553
- export class InputText extends Control implements IFocusableControl {
2584
+ export class InputText extends Control {
2554
2585
  name?: string | undefined;
2555
2586
  protected _textWrapper: TextWrapper;
2556
2587
  protected _placeholderText: string;
2557
2588
  protected _background: string;
2558
2589
  protected _focusedBackground: string;
2559
- protected _focusedColor: string;
2560
2590
  protected _placeholderColor: string;
2561
2591
  protected _thickness: number;
2562
2592
  protected _margin: ValueAndUnit;
2563
2593
  protected _autoStretchWidth: boolean;
2564
2594
  protected _maxWidth: ValueAndUnit;
2565
- protected _isFocused: boolean;
2566
2595
  /** the type of device that most recently focused the input: "mouse", "touch" or "pen" */
2567
2596
  protected _focusedBy: string;
2568
2597
  protected _blinkTimeout: number;
@@ -2607,10 +2636,6 @@ declare module BABYLON.GUI {
2607
2636
  onTextChangedObservable: BABYLON.Observable<InputText>;
2608
2637
  /** BABYLON.Observable raised just before an entered character is to be added */
2609
2638
  onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
2610
- /** BABYLON.Observable raised when the control gets the focus */
2611
- onFocusObservable: BABYLON.Observable<InputText>;
2612
- /** BABYLON.Observable raised when the control loses the focus */
2613
- onBlurObservable: BABYLON.Observable<InputText>;
2614
2639
  /** BABYLON.Observable raised when the text is highlighted */
2615
2640
  onTextHighlightObservable: BABYLON.Observable<InputText>;
2616
2641
  /** BABYLON.Observable raised when copy event is triggered */
@@ -2619,8 +2644,6 @@ declare module BABYLON.GUI {
2619
2644
  onTextCutObservable: BABYLON.Observable<InputText>;
2620
2645
  /** BABYLON.Observable raised when paste event is triggered */
2621
2646
  onTextPasteObservable: BABYLON.Observable<InputText>;
2622
- /** BABYLON.Observable raised when a key event was processed */
2623
- onKeyboardEventProcessedObservable: BABYLON.Observable<BABYLON.IKeyboardEvent>;
2624
2647
  /** Gets or sets the maximum width allowed by the control */
2625
2648
  get maxWidth(): string | number;
2626
2649
  /** Gets the maximum width allowed by the control in pixels */
@@ -2650,7 +2673,6 @@ declare module BABYLON.GUI {
2650
2673
  get focusedBackground(): string;
2651
2674
  set focusedBackground(value: string);
2652
2675
  /** Gets or sets the background color when focused */
2653
- get focusedColor(): string;
2654
2676
  set focusedColor(value: string);
2655
2677
  /** Gets or sets the background color */
2656
2678
  get background(): string;
@@ -2691,14 +2713,6 @@ declare module BABYLON.GUI {
2691
2713
  onBlur(): void;
2692
2714
  /** @internal */
2693
2715
  onFocus(): void;
2694
- /**
2695
- * Function to focus an inputText programmatically
2696
- */
2697
- focus(): void;
2698
- /**
2699
- * Function to unfocus an inputText programmatically
2700
- */
2701
- blur(): void;
2702
2716
  protected _getTypeName(): string;
2703
2717
  /**
2704
2718
  * Function called to get the list of controls that should not steal the focus from this control