babylonjs-gui 5.0.0-beta.8 → 5.0.0-rc.1

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.
@@ -401,6 +401,7 @@ declare module "babylonjs-gui/2D/advancedDynamicTexture" {
401
401
  private _resizeObserver;
402
402
  private _preKeyboardObserver;
403
403
  private _pointerMoveObserver;
404
+ private _sceneRenderObserver;
404
405
  private _pointerObserver;
405
406
  private _canvasPointerOutObserver;
406
407
  private _canvasBlurObserver;
@@ -573,6 +574,13 @@ declare module "babylonjs-gui/2D/advancedDynamicTexture" {
573
574
  */
574
575
  get clipboardData(): string;
575
576
  set clipboardData(value: string);
577
+ /**
578
+ * If set to true, every scene render will trigger a pointer event for the GUI
579
+ * if it is linked to a mesh or has controls linked to a mesh. This will allow
580
+ * you to catch the pointer moving around the GUI due to camera or mesh movements,
581
+ * but it has a performance cost.
582
+ */
583
+ checkPointerEveryFrame: boolean;
576
584
  /**
577
585
  * Creates a new AdvancedDynamicTexture
578
586
  * @param name defines the name of the texture
@@ -675,6 +683,7 @@ declare module "babylonjs-gui/2D/advancedDynamicTexture" {
675
683
  }, control: Control): void;
676
684
  /** @hidden */
677
685
  _cleanControlAfterRemoval(control: Control): void;
686
+ private _translateToPicking;
678
687
  /** Attach to all scene events required to support pointer events */
679
688
  attach(): void;
680
689
  /** @hidden */
@@ -703,6 +712,7 @@ declare module "babylonjs-gui/2D/advancedDynamicTexture" {
703
712
  */
704
713
  moveFocusToControl(control: IFocusableControl): void;
705
714
  private _manageFocus;
715
+ private _attachPickingToSceneRender;
706
716
  private _attachToOnPointerOut;
707
717
  private _attachToOnBlur;
708
718
  /**
@@ -784,6 +794,7 @@ declare module "babylonjs-gui/2D/advancedDynamicTexture" {
784
794
  */
785
795
  scaleTo(width: number, height: number): void;
786
796
  }
797
+ export { IFocusableControl };
787
798
  }
788
799
  declare module "babylonjs-gui/2D/controls/control" {
789
800
  import { Nullable } from "babylonjs/types";
@@ -1400,7 +1411,7 @@ declare module "babylonjs-gui/2D/controls/control" {
1400
1411
  /** @hidden */
1401
1412
  _flagDescendantsAsMatrixDirty(): void;
1402
1413
  /** @hidden */
1403
- _intersectsRect(rect: Measure): boolean;
1414
+ _intersectsRect(rect: Measure, context?: ICanvasRenderingContext): boolean;
1404
1415
  /** @hidden */
1405
1416
  protected _computeAdditionnalOffsetX(): number;
1406
1417
  /** @hidden */
@@ -1451,17 +1462,17 @@ declare module "babylonjs-gui/2D/controls/control" {
1451
1462
  */
1452
1463
  contains(x: number, y: number): boolean;
1453
1464
  /** @hidden */
1454
- _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
1465
+ _processPicking(x: number, y: number, pi: Nullable<PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
1455
1466
  /** @hidden */
1456
- _onPointerMove(target: Control, coordinates: Vector2, pointerId: number, pi: PointerInfoBase): void;
1467
+ _onPointerMove(target: Control, coordinates: Vector2, pointerId: number, pi: Nullable<PointerInfoBase>): void;
1457
1468
  /** @hidden */
1458
- _onPointerEnter(target: Control, pi: PointerInfoBase): boolean;
1469
+ _onPointerEnter(target: Control, pi: Nullable<PointerInfoBase>): boolean;
1459
1470
  /** @hidden */
1460
1471
  _onPointerOut(target: Control, pi: Nullable<PointerInfoBase>, force?: boolean): void;
1461
1472
  /** @hidden */
1462
- _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: PointerInfoBase): boolean;
1473
+ _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, pi: Nullable<PointerInfoBase>): boolean;
1463
1474
  /** @hidden */
1464
- _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: PointerInfoBase): void;
1475
+ _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: Nullable<PointerInfoBase>): void;
1465
1476
  /** @hidden */
1466
1477
  _forcePointerUp(pointerId?: Nullable<number>): void;
1467
1478
  /** @hidden */
@@ -1469,7 +1480,7 @@ declare module "babylonjs-gui/2D/controls/control" {
1469
1480
  /** @hidden */
1470
1481
  _onCanvasBlur(): void;
1471
1482
  /** @hidden */
1472
- _processObservables(type: number, x: number, y: number, pi: PointerInfoBase, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
1483
+ _processObservables(type: number, x: number, y: number, pi: Nullable<PointerInfoBase>, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
1473
1484
  private _prepareFont;
1474
1485
  /**
1475
1486
  * Serializes the current control
@@ -1648,7 +1659,7 @@ declare module "babylonjs-gui/2D/controls/container" {
1648
1659
  _draw(context: ICanvasRenderingContext, invalidatedRectangle?: Measure): void;
1649
1660
  getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
1650
1661
  /** @hidden */
1651
- _processPicking(x: number, y: number, pi: PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
1662
+ _processPicking(x: number, y: number, pi: Nullable<PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
1652
1663
  /** @hidden */
1653
1664
  protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void;
1654
1665
  /**
@@ -1853,6 +1864,7 @@ declare module "babylonjs-gui/2D/controls/textBlock" {
1853
1864
  protected _applyStates(context: ICanvasRenderingContext): void;
1854
1865
  protected _breakLines(refWidth: number, refHeight: number, context: ICanvasRenderingContext): object[];
1855
1866
  protected _parseLine(line: string | undefined, context: ICanvasRenderingContext): object;
1867
+ private _getCharsToRemove;
1856
1868
  protected _parseLineEllipsis(line: string | undefined, width: number, context: ICanvasRenderingContext): object;
1857
1869
  protected _parseLineWordWrap(line: string | undefined, width: number, context: ICanvasRenderingContext): object[];
1858
1870
  protected _parseLineWordWrapEllipsis(line: string | undefined, width: number, height: number, context: ICanvasRenderingContext): object[];
@@ -2416,6 +2428,8 @@ declare module "babylonjs-gui/2D/controls/inputText" {
2416
2428
  private _autoStretchWidth;
2417
2429
  private _maxWidth;
2418
2430
  private _isFocused;
2431
+ /** the type of device that most recently focused the input: "mouse", "touch" or "pen" */
2432
+ private _focusedBy;
2419
2433
  private _blinkTimeout;
2420
2434
  private _blinkIsEven;
2421
2435
  private _cursorOffset;
@@ -4376,7 +4390,8 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4376
4390
  export class TouchButton3D extends Button3D {
4377
4391
  private _collisionMesh;
4378
4392
  private _collidableFrontDirection;
4379
- protected _isNearPressed: boolean;
4393
+ private _isNearPressed;
4394
+ private _interactionSurfaceHeight;
4380
4395
  private _isToggleButton;
4381
4396
  private _toggleState;
4382
4397
  private _toggleButtonCallback;
@@ -4390,6 +4405,10 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4390
4405
  * @param collisionMesh mesh to track collisions with
4391
4406
  */
4392
4407
  constructor(name?: string, collisionMesh?: Mesh);
4408
+ /**
4409
+ * Whether the current interaction is caused by near interaction or not
4410
+ */
4411
+ get isActiveNearInteraction(): boolean;
4393
4412
  /**
4394
4413
  * Sets the front-facing direction of the button. Pass in Vector3.Zero to allow interactions from any direction
4395
4414
  * @param frontDir the forward direction of the button
@@ -4418,6 +4437,12 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4418
4437
  get isToggled(): boolean;
4419
4438
  protected _onToggle(newState: boolean): void;
4420
4439
  private _isInteractionInFrontOfButton;
4440
+ /**
4441
+ * Get the height of the touchPoint from the collidable part of the button
4442
+ * @param touchPoint the point to compare to the button, in absolute position
4443
+ * @returns the depth of the touch point into the front of the button
4444
+ */
4445
+ getPressDepth(touchPoint: Vector3): number;
4421
4446
  protected _getInteractionHeight(interactionPos: Vector3, basePos: Vector3): number;
4422
4447
  /** @hidden */
4423
4448
  _generatePointerEventType(providedType: number, nearMeshPosition: Vector3, activeInteractionCount: number): number;
@@ -5124,6 +5149,7 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5124
5149
  import { FluentButtonMaterial } from "babylonjs-gui/3D/materials/fluentButton/fluentButtonMaterial";
5125
5150
  import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
5126
5151
  import { TouchButton3D } from "babylonjs-gui/3D/controls/touchButton3D";
5152
+ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5127
5153
  /**
5128
5154
  * Class used to create a holographic button in 3D
5129
5155
  * @since 5.0.0
@@ -5165,6 +5191,10 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5165
5191
  */
5166
5192
  set renderingGroupId(id: number);
5167
5193
  get renderingGroupId(): number;
5194
+ /**
5195
+ * Gets the mesh used to render this control
5196
+ */
5197
+ get mesh(): Nullable<AbstractMesh>;
5168
5198
  /**
5169
5199
  * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
5170
5200
  */
@@ -5220,6 +5250,81 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5220
5250
  dispose(): void;
5221
5251
  }
5222
5252
  }
5253
+ declare module "babylonjs-gui/3D/behaviors/defaultBehavior" {
5254
+ import { Behavior } from "babylonjs/Behaviors/behavior";
5255
+ import { FollowBehavior } from "babylonjs/Behaviors/Meshes/followBehavior";
5256
+ import { SixDofDragBehavior } from "babylonjs/Behaviors/Meshes/sixDofDragBehavior";
5257
+ import { Mesh } from "babylonjs/Meshes/mesh";
5258
+ import { Nullable } from "babylonjs/types";
5259
+ import { SurfaceMagnetismBehavior } from "babylonjs/Behaviors/Meshes/surfaceMagnetismBehavior";
5260
+ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5261
+ /**
5262
+ * Default behavior for 3D UI elements.
5263
+ * Handles a FollowBehavior, SixDofBehavior and SurfaceMagnetismBehavior
5264
+ * @since 5.0.0
5265
+ */
5266
+ export class DefaultBehavior implements Behavior<Mesh> {
5267
+ private _scene;
5268
+ private _followBehavior;
5269
+ private _sixDofDragBehavior;
5270
+ private _surfaceMagnetismBehavior;
5271
+ private _onBeforeRenderObserver;
5272
+ private _onDragObserver;
5273
+ /**
5274
+ * Instantiates the default behavior
5275
+ */
5276
+ constructor();
5277
+ /**
5278
+ * Attached node of this behavior
5279
+ */
5280
+ attachedNode: Nullable<Mesh>;
5281
+ /**
5282
+ * The name of the behavior
5283
+ */
5284
+ get name(): string;
5285
+ /**
5286
+ * The follow behavior
5287
+ */
5288
+ get followBehavior(): FollowBehavior;
5289
+ /**
5290
+ * The six DoF drag behavior
5291
+ */
5292
+ get sixDofDragBehavior(): SixDofDragBehavior;
5293
+ /**
5294
+ * The surface magnetism behavior
5295
+ */
5296
+ get surfaceMagnetismBehavior(): SurfaceMagnetismBehavior;
5297
+ /**
5298
+ * Enables the follow behavior
5299
+ */
5300
+ followBehaviorEnabled: boolean;
5301
+ /**
5302
+ * Enables the six DoF drag behavior
5303
+ */
5304
+ sixDofDragBehaviorEnabled: boolean;
5305
+ /**
5306
+ * Enables the surface magnetism behavior
5307
+ */
5308
+ surfaceMagnetismBehaviorEnabled: boolean;
5309
+ /**
5310
+ * Initializes the behavior
5311
+ */
5312
+ init(): void;
5313
+ /**
5314
+ * Attaches the default behavior
5315
+ * @param ownerMesh The top level mesh
5316
+ * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
5317
+ * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
5318
+ */
5319
+ attach(ownerMesh: Mesh, draggablesMeshes?: Mesh[], sceneUnderstandingMeshes?: AbstractMesh[]): void;
5320
+ /**
5321
+ * Detaches the behavior from the mesh
5322
+ */
5323
+ detach(): void;
5324
+ private _addObservables;
5325
+ private _removeObservables;
5326
+ }
5327
+ }
5223
5328
  declare module "babylonjs-gui/3D/materials/handle/shaders/handle.vertex" {
5224
5329
  /** @hidden */
5225
5330
  export var handleVertexShader: {
@@ -5439,6 +5544,7 @@ declare module "babylonjs-gui/3D/gizmos/slateGizmo" {
5439
5544
  * Value we use to offset handles from mesh
5440
5545
  */
5441
5546
  private _margin;
5547
+ private _handleSize;
5442
5548
  private _attachedSlate;
5443
5549
  private _existingSlateScale;
5444
5550
  /**
@@ -5449,10 +5555,6 @@ declare module "babylonjs-gui/3D/gizmos/slateGizmo" {
5449
5555
  * The distance away from the object which the draggable meshes should appear world sized when fixedScreenSize is set to true (default: 10)
5450
5556
  */
5451
5557
  fixedScreenSizeDistanceFactor: number;
5452
- /**
5453
- * Size of the handles (meters in XR)
5454
- */
5455
- handleSize: number;
5456
5558
  /**
5457
5559
  * The slate attached to this gizmo
5458
5560
  */
@@ -5471,85 +5573,11 @@ declare module "babylonjs-gui/3D/gizmos/slateGizmo" {
5471
5573
  */
5472
5574
  updateBoundingBox(): void;
5473
5575
  private _updateHandlesPosition;
5576
+ private _updateHandlesScaling;
5474
5577
  protected _update(): void;
5475
5578
  dispose(): void;
5476
5579
  }
5477
5580
  }
5478
- declare module "babylonjs-gui/3D/behaviors/defaultBehavior" {
5479
- import { Behavior } from "babylonjs/Behaviors/behavior";
5480
- import { FollowBehavior } from "babylonjs/Behaviors/Meshes/followBehavior";
5481
- import { SixDofDragBehavior } from "babylonjs/Behaviors/Meshes/sixDofDragBehavior";
5482
- import { Mesh } from "babylonjs/Meshes/mesh";
5483
- import { Nullable } from "babylonjs/types";
5484
- import { SurfaceMagnetismBehavior } from "babylonjs/Behaviors/Meshes/surfaceMagnetismBehavior";
5485
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5486
- /**
5487
- * Default behavior for 3D UI elements.
5488
- * Handles a FollowBehavior, SixDofBehavior and SurfaceMagnetismBehavior
5489
- * @since 5.0.0
5490
- */
5491
- export class DefaultBehavior implements Behavior<Mesh> {
5492
- private _scene;
5493
- private _followBehavior;
5494
- private _sixDofDragBehavior;
5495
- private _surfaceMagnetismBehavior;
5496
- private _onBeforeRenderObserver;
5497
- private _onDragObserver;
5498
- /**
5499
- * Instantiates the default behavior
5500
- */
5501
- constructor();
5502
- /**
5503
- * Attached node of this behavior
5504
- */
5505
- attachedNode: Nullable<Mesh>;
5506
- /**
5507
- * The name of the behavior
5508
- */
5509
- get name(): string;
5510
- /**
5511
- * The follow behavior
5512
- */
5513
- get followBehavior(): FollowBehavior;
5514
- /**
5515
- * The six DoF drag behavior
5516
- */
5517
- get sixDofDragBehavior(): SixDofDragBehavior;
5518
- /**
5519
- * The surface magnetism behavior
5520
- */
5521
- get surfaceMagnetismBehavior(): SurfaceMagnetismBehavior;
5522
- /**
5523
- * Enables the follow behavior
5524
- */
5525
- followBehaviorEnabled: boolean;
5526
- /**
5527
- * Enables the six DoF drag behavior
5528
- */
5529
- sixDofDragBehaviorEnabled: boolean;
5530
- /**
5531
- * Enables the surface magnetism behavior
5532
- */
5533
- surfaceMagnetismBehaviorEnabled: boolean;
5534
- /**
5535
- * Initializes the behavior
5536
- */
5537
- init(): void;
5538
- /**
5539
- * Attaches the default behavior
5540
- * @param ownerMesh The top level mesh
5541
- * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
5542
- * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
5543
- */
5544
- attach(ownerMesh: Mesh, draggablesMeshes?: Mesh[], sceneUnderstandingMeshes?: AbstractMesh[]): void;
5545
- /**
5546
- * Detaches the behavior from the mesh
5547
- */
5548
- detach(): void;
5549
- private _addObservables;
5550
- private _removeObservables;
5551
- }
5552
- }
5553
5581
  declare module "babylonjs-gui/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment" {
5554
5582
  /** @hidden */
5555
5583
  export var fluentBackplatePixelShader: {
@@ -5721,16 +5749,16 @@ declare module "babylonjs-gui/3D/materials/fluentBackplate/fluentBackplateMateri
5721
5749
  }
5722
5750
  }
5723
5751
  declare module "babylonjs-gui/3D/controls/holographicSlate" {
5724
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5725
- import { Scene } from "babylonjs/scene";
5726
- import { TransformNode } from "babylonjs/Meshes/transformNode";
5727
- import { Mesh } from "babylonjs/Meshes/mesh";
5728
- import { TouchHolographicButton } from "babylonjs-gui/3D/controls/touchHolographicButton";
5729
- import { Vector3 } from "babylonjs/Maths/math.vector";
5730
5752
  import { ContentDisplay3D } from "babylonjs-gui/3D/controls/contentDisplay3D";
5753
+ import { TouchHolographicButton } from "babylonjs-gui/3D/controls/touchHolographicButton";
5731
5754
  import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
5732
- import { SlateGizmo } from "babylonjs-gui/3D/gizmos/slateGizmo";
5733
5755
  import { DefaultBehavior } from "babylonjs-gui/3D/behaviors/defaultBehavior";
5756
+ import { SlateGizmo } from "babylonjs-gui/3D/gizmos/slateGizmo";
5757
+ import { Vector2, Vector3 } from "babylonjs/Maths/math.vector";
5758
+ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5759
+ import { TransformNode } from "babylonjs/Meshes/transformNode";
5760
+ import { Mesh } from "babylonjs/Meshes/mesh";
5761
+ import { Scene } from "babylonjs/scene";
5734
5762
  /**
5735
5763
  * Class used to create a holographic slate
5736
5764
  * @since 5.0.0
@@ -5748,35 +5776,24 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5748
5776
  * File name for the close icon.
5749
5777
  */
5750
5778
  static FOLLOW_ICON_FILENAME: string;
5779
+ private static DEFAULT_TEXT_RESOLUTION_Y;
5751
5780
  /**
5752
- * Dimensions of the slate
5753
- */
5754
- dimensions: Vector3;
5755
- /**
5756
- * Minimum dimensions of the slate
5757
- */
5758
- minDimensions: Vector3;
5759
- /**
5760
- * Default dimensions of the slate
5761
- */
5762
- readonly defaultDimensions: Vector3;
5763
- /**
5764
- * Dimensions of the backplate
5781
+ * Margin between title bar and contentplate
5765
5782
  */
5766
- backplateDimensions: Vector3;
5767
- /**
5768
- * Margin between backplate and contentplate
5769
- */
5770
- backPlateMargin: number;
5783
+ titleBarMargin: number;
5771
5784
  /**
5772
5785
  * Origin in local coordinates (top left corner)
5773
5786
  */
5774
5787
  origin: Vector3;
5775
- private _backPlateMaterial;
5788
+ private _dimensions;
5789
+ private _titleBarHeight;
5790
+ private _titleBarMaterial;
5791
+ private _backMaterial;
5776
5792
  private _contentMaterial;
5777
5793
  private _pickedPointObserver;
5778
5794
  private _positionChangedObserver;
5779
- private _imageUrl;
5795
+ private _titleText;
5796
+ private _titleTextComponent;
5780
5797
  private _contentViewport;
5781
5798
  private _contentDragBehavior;
5782
5799
  private _defaultBehavior;
@@ -5786,21 +5803,42 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5786
5803
  get defaultBehavior(): DefaultBehavior;
5787
5804
  /** @hidden */
5788
5805
  _gizmo: SlateGizmo;
5789
- protected _backPlate: Mesh;
5806
+ protected _titleBar: Mesh;
5807
+ protected _titleBarTitle: Mesh;
5790
5808
  protected _contentPlate: Mesh;
5791
- protected _followButton: TouchHolographicButton;
5809
+ protected _backPlate: Mesh;
5810
+ /** @hidden */
5811
+ _followButton: TouchHolographicButton;
5792
5812
  protected _closeButton: TouchHolographicButton;
5793
5813
  protected _contentScaleRatio: number;
5794
5814
  /**
5795
- * Rendering ground id of all the mesh in the button
5815
+ * 2D dimensions of the slate
5816
+ */
5817
+ get dimensions(): Vector2;
5818
+ set dimensions(value: Vector2);
5819
+ /**
5820
+ * Minimum dimensions of the slate
5821
+ */
5822
+ minDimensions: Vector2;
5823
+ /**
5824
+ * Default dimensions of the slate
5825
+ */
5826
+ readonly defaultDimensions: Vector2;
5827
+ /**
5828
+ * Height of the title bar component
5829
+ */
5830
+ get titleBarHeight(): number;
5831
+ set titleBarHeight(value: number);
5832
+ /**
5833
+ * Rendering ground id of all the meshes
5796
5834
  */
5797
5835
  set renderingGroupId(id: number);
5798
5836
  get renderingGroupId(): number;
5799
5837
  /**
5800
- * Gets or sets the image url for the button
5838
+ * The title text displayed at the top of the slate
5801
5839
  */
5802
- get imageUrl(): string;
5803
- set imageUrl(value: string);
5840
+ set title(title: string);
5841
+ get title(): string;
5804
5842
  /**
5805
5843
  * Creates a new slate
5806
5844
  * @param name defines the control name
@@ -5812,7 +5850,6 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5812
5850
  * @param facadeTexture defines the AdvancedDynamicTexture to use
5813
5851
  */
5814
5852
  protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
5815
- private _rebuildContent;
5816
5853
  private _addControl;
5817
5854
  protected _getTypeName(): string;
5818
5855
  /**
@@ -5832,8 +5869,9 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5832
5869
  _prepareNode(scene: Scene): void;
5833
5870
  /**
5834
5871
  * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.
5872
+ * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well
5835
5873
  */
5836
- resetDefaultAspectAndPose(): void;
5874
+ resetDefaultAspectAndPose(resetAspect?: boolean): void;
5837
5875
  /**
5838
5876
  * Releases all associated resources
5839
5877
  */
@@ -6927,6 +6965,7 @@ declare module "babylonjs-gui/3D/controls/slider3D" {
6927
6965
  private _maximum;
6928
6966
  private _value;
6929
6967
  private _step;
6968
+ private _draggedPosition;
6930
6969
  /** Observable raised when the sldier value changes */
6931
6970
  onValueChangedObservable: Observable<number>;
6932
6971
  /**
@@ -7545,6 +7584,7 @@ declare module BABYLON.GUI {
7545
7584
  private _resizeObserver;
7546
7585
  private _preKeyboardObserver;
7547
7586
  private _pointerMoveObserver;
7587
+ private _sceneRenderObserver;
7548
7588
  private _pointerObserver;
7549
7589
  private _canvasPointerOutObserver;
7550
7590
  private _canvasBlurObserver;
@@ -7717,6 +7757,13 @@ declare module BABYLON.GUI {
7717
7757
  */
7718
7758
  get clipboardData(): string;
7719
7759
  set clipboardData(value: string);
7760
+ /**
7761
+ * If set to true, every scene render will trigger a pointer event for the GUI
7762
+ * if it is linked to a mesh or has controls linked to a mesh. This will allow
7763
+ * you to catch the pointer moving around the GUI due to camera or mesh movements,
7764
+ * but it has a performance cost.
7765
+ */
7766
+ checkPointerEveryFrame: boolean;
7720
7767
  /**
7721
7768
  * Creates a new AdvancedDynamicTexture
7722
7769
  * @param name defines the name of the texture
@@ -7819,6 +7866,7 @@ declare module BABYLON.GUI {
7819
7866
  }, control: Control): void;
7820
7867
  /** @hidden */
7821
7868
  _cleanControlAfterRemoval(control: Control): void;
7869
+ private _translateToPicking;
7822
7870
  /** Attach to all scene events required to support pointer events */
7823
7871
  attach(): void;
7824
7872
  /** @hidden */
@@ -7847,6 +7895,7 @@ declare module BABYLON.GUI {
7847
7895
  */
7848
7896
  moveFocusToControl(control: IFocusableControl): void;
7849
7897
  private _manageFocus;
7898
+ private _attachPickingToSceneRender;
7850
7899
  private _attachToOnPointerOut;
7851
7900
  private _attachToOnBlur;
7852
7901
  /**
@@ -8531,7 +8580,7 @@ declare module BABYLON.GUI {
8531
8580
  /** @hidden */
8532
8581
  _flagDescendantsAsMatrixDirty(): void;
8533
8582
  /** @hidden */
8534
- _intersectsRect(rect: Measure): boolean;
8583
+ _intersectsRect(rect: Measure, context?: BABYLON.ICanvasRenderingContext): boolean;
8535
8584
  /** @hidden */
8536
8585
  protected _computeAdditionnalOffsetX(): number;
8537
8586
  /** @hidden */
@@ -8582,17 +8631,17 @@ declare module BABYLON.GUI {
8582
8631
  */
8583
8632
  contains(x: number, y: number): boolean;
8584
8633
  /** @hidden */
8585
- _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8634
+ _processPicking(x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8586
8635
  /** @hidden */
8587
- _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
8636
+ _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>): void;
8588
8637
  /** @hidden */
8589
- _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
8638
+ _onPointerEnter(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>): boolean;
8590
8639
  /** @hidden */
8591
8640
  _onPointerOut(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, force?: boolean): void;
8592
8641
  /** @hidden */
8593
- _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
8642
+ _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>): boolean;
8594
8643
  /** @hidden */
8595
- _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: BABYLON.PointerInfoBase): void;
8644
+ _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: BABYLON.Nullable<BABYLON.PointerInfoBase>): void;
8596
8645
  /** @hidden */
8597
8646
  _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
8598
8647
  /** @hidden */
@@ -8600,7 +8649,7 @@ declare module BABYLON.GUI {
8600
8649
  /** @hidden */
8601
8650
  _onCanvasBlur(): void;
8602
8651
  /** @hidden */
8603
- _processObservables(type: number, x: number, y: number, pi: BABYLON.PointerInfoBase, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8652
+ _processObservables(type: number, x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8604
8653
  private _prepareFont;
8605
8654
  /**
8606
8655
  * Serializes the current control
@@ -8772,7 +8821,7 @@ declare module BABYLON.GUI {
8772
8821
  _draw(context: BABYLON.ICanvasRenderingContext, invalidatedRectangle?: Measure): void;
8773
8822
  getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
8774
8823
  /** @hidden */
8775
- _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8824
+ _processPicking(x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8776
8825
  /** @hidden */
8777
8826
  protected _additionalProcessing(parentMeasure: Measure, context: BABYLON.ICanvasRenderingContext): void;
8778
8827
  /**
@@ -8969,6 +9018,7 @@ declare module BABYLON.GUI {
8969
9018
  protected _applyStates(context: BABYLON.ICanvasRenderingContext): void;
8970
9019
  protected _breakLines(refWidth: number, refHeight: number, context: BABYLON.ICanvasRenderingContext): object[];
8971
9020
  protected _parseLine(line: string | undefined, context: BABYLON.ICanvasRenderingContext): object;
9021
+ private _getCharsToRemove;
8972
9022
  protected _parseLineEllipsis(line: string | undefined, width: number, context: BABYLON.ICanvasRenderingContext): object;
8973
9023
  protected _parseLineWordWrap(line: string | undefined, width: number, context: BABYLON.ICanvasRenderingContext): object[];
8974
9024
  protected _parseLineWordWrapEllipsis(line: string | undefined, width: number, height: number, context: BABYLON.ICanvasRenderingContext): object[];
@@ -9492,6 +9542,8 @@ declare module BABYLON.GUI {
9492
9542
  private _autoStretchWidth;
9493
9543
  private _maxWidth;
9494
9544
  private _isFocused;
9545
+ /** the type of device that most recently focused the input: "mouse", "touch" or "pen" */
9546
+ private _focusedBy;
9495
9547
  private _blinkTimeout;
9496
9548
  private _blinkIsEven;
9497
9549
  private _cursorOffset;
@@ -11279,7 +11331,8 @@ declare module BABYLON.GUI {
11279
11331
  export class TouchButton3D extends Button3D {
11280
11332
  private _collisionMesh;
11281
11333
  private _collidableFrontDirection;
11282
- protected _isNearPressed: boolean;
11334
+ private _isNearPressed;
11335
+ private _interactionSurfaceHeight;
11283
11336
  private _isToggleButton;
11284
11337
  private _toggleState;
11285
11338
  private _toggleButtonCallback;
@@ -11293,6 +11346,10 @@ declare module BABYLON.GUI {
11293
11346
  * @param collisionMesh mesh to track collisions with
11294
11347
  */
11295
11348
  constructor(name?: string, collisionMesh?: BABYLON.Mesh);
11349
+ /**
11350
+ * Whether the current interaction is caused by near interaction or not
11351
+ */
11352
+ get isActiveNearInteraction(): boolean;
11296
11353
  /**
11297
11354
  * Sets the front-facing direction of the button. Pass in BABYLON.Vector3.Zero to allow interactions from any direction
11298
11355
  * @param frontDir the forward direction of the button
@@ -11321,6 +11378,12 @@ declare module BABYLON.GUI {
11321
11378
  get isToggled(): boolean;
11322
11379
  protected _onToggle(newState: boolean): void;
11323
11380
  private _isInteractionInFrontOfButton;
11381
+ /**
11382
+ * Get the height of the touchPoint from the collidable part of the button
11383
+ * @param touchPoint the point to compare to the button, in absolute position
11384
+ * @returns the depth of the touch point into the front of the button
11385
+ */
11386
+ getPressDepth(touchPoint: BABYLON.Vector3): number;
11324
11387
  protected _getInteractionHeight(interactionPos: BABYLON.Vector3, basePos: BABYLON.Vector3): number;
11325
11388
  /** @hidden */
11326
11389
  _generatePointerEventType(providedType: number, nearMeshPosition: BABYLON.Vector3, activeInteractionCount: number): number;
@@ -12003,6 +12066,10 @@ declare module BABYLON.GUI {
12003
12066
  */
12004
12067
  set renderingGroupId(id: number);
12005
12068
  get renderingGroupId(): number;
12069
+ /**
12070
+ * Gets the mesh used to render this control
12071
+ */
12072
+ get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
12006
12073
  /**
12007
12074
  * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
12008
12075
  */
@@ -12058,6 +12125,74 @@ declare module BABYLON.GUI {
12058
12125
  dispose(): void;
12059
12126
  }
12060
12127
  }
12128
+ declare module BABYLON.GUI {
12129
+ /**
12130
+ * Default behavior for 3D UI elements.
12131
+ * Handles a BABYLON.FollowBehavior, SixDofBehavior and BABYLON.SurfaceMagnetismBehavior
12132
+ * @since 5.0.0
12133
+ */
12134
+ export class DefaultBehavior implements BABYLON.Behavior<BABYLON.Mesh> {
12135
+ private _scene;
12136
+ private _followBehavior;
12137
+ private _sixDofDragBehavior;
12138
+ private _surfaceMagnetismBehavior;
12139
+ private _onBeforeRenderObserver;
12140
+ private _onDragObserver;
12141
+ /**
12142
+ * Instantiates the default behavior
12143
+ */
12144
+ constructor();
12145
+ /**
12146
+ * Attached node of this behavior
12147
+ */
12148
+ attachedNode: BABYLON.Nullable<BABYLON.Mesh>;
12149
+ /**
12150
+ * The name of the behavior
12151
+ */
12152
+ get name(): string;
12153
+ /**
12154
+ * The follow behavior
12155
+ */
12156
+ get followBehavior(): BABYLON.FollowBehavior;
12157
+ /**
12158
+ * The six DoF drag behavior
12159
+ */
12160
+ get sixDofDragBehavior(): BABYLON.SixDofDragBehavior;
12161
+ /**
12162
+ * The surface magnetism behavior
12163
+ */
12164
+ get surfaceMagnetismBehavior(): BABYLON.SurfaceMagnetismBehavior;
12165
+ /**
12166
+ * Enables the follow behavior
12167
+ */
12168
+ followBehaviorEnabled: boolean;
12169
+ /**
12170
+ * Enables the six DoF drag behavior
12171
+ */
12172
+ sixDofDragBehaviorEnabled: boolean;
12173
+ /**
12174
+ * Enables the surface magnetism behavior
12175
+ */
12176
+ surfaceMagnetismBehaviorEnabled: boolean;
12177
+ /**
12178
+ * Initializes the behavior
12179
+ */
12180
+ init(): void;
12181
+ /**
12182
+ * Attaches the default behavior
12183
+ * @param ownerMesh The top level mesh
12184
+ * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
12185
+ * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
12186
+ */
12187
+ attach(ownerMesh: BABYLON.Mesh, draggablesMeshes?: BABYLON.Mesh[], sceneUnderstandingMeshes?: BABYLON.AbstractMesh[]): void;
12188
+ /**
12189
+ * Detaches the behavior from the mesh
12190
+ */
12191
+ detach(): void;
12192
+ private _addObservables;
12193
+ private _removeObservables;
12194
+ }
12195
+ }
12061
12196
  declare module BABYLON.GUI {
12062
12197
  /** @hidden */
12063
12198
  export var handleVertexShader: {
@@ -12260,6 +12395,7 @@ declare module BABYLON.GUI {
12260
12395
  * Value we use to offset handles from mesh
12261
12396
  */
12262
12397
  private _margin;
12398
+ private _handleSize;
12263
12399
  private _attachedSlate;
12264
12400
  private _existingSlateScale;
12265
12401
  /**
@@ -12270,10 +12406,6 @@ declare module BABYLON.GUI {
12270
12406
  * The distance away from the object which the draggable meshes should appear world sized when fixedScreenSize is set to true (default: 10)
12271
12407
  */
12272
12408
  fixedScreenSizeDistanceFactor: number;
12273
- /**
12274
- * Size of the handles (meters in XR)
12275
- */
12276
- handleSize: number;
12277
12409
  /**
12278
12410
  * The slate attached to this gizmo
12279
12411
  */
@@ -12292,78 +12424,11 @@ declare module BABYLON.GUI {
12292
12424
  */
12293
12425
  updateBoundingBox(): void;
12294
12426
  private _updateHandlesPosition;
12427
+ private _updateHandlesScaling;
12295
12428
  protected _update(): void;
12296
12429
  dispose(): void;
12297
12430
  }
12298
12431
  }
12299
- declare module BABYLON.GUI {
12300
- /**
12301
- * Default behavior for 3D UI elements.
12302
- * Handles a BABYLON.FollowBehavior, SixDofBehavior and BABYLON.SurfaceMagnetismBehavior
12303
- * @since 5.0.0
12304
- */
12305
- export class DefaultBehavior implements BABYLON.Behavior<BABYLON.Mesh> {
12306
- private _scene;
12307
- private _followBehavior;
12308
- private _sixDofDragBehavior;
12309
- private _surfaceMagnetismBehavior;
12310
- private _onBeforeRenderObserver;
12311
- private _onDragObserver;
12312
- /**
12313
- * Instantiates the default behavior
12314
- */
12315
- constructor();
12316
- /**
12317
- * Attached node of this behavior
12318
- */
12319
- attachedNode: BABYLON.Nullable<BABYLON.Mesh>;
12320
- /**
12321
- * The name of the behavior
12322
- */
12323
- get name(): string;
12324
- /**
12325
- * The follow behavior
12326
- */
12327
- get followBehavior(): BABYLON.FollowBehavior;
12328
- /**
12329
- * The six DoF drag behavior
12330
- */
12331
- get sixDofDragBehavior(): BABYLON.SixDofDragBehavior;
12332
- /**
12333
- * The surface magnetism behavior
12334
- */
12335
- get surfaceMagnetismBehavior(): BABYLON.SurfaceMagnetismBehavior;
12336
- /**
12337
- * Enables the follow behavior
12338
- */
12339
- followBehaviorEnabled: boolean;
12340
- /**
12341
- * Enables the six DoF drag behavior
12342
- */
12343
- sixDofDragBehaviorEnabled: boolean;
12344
- /**
12345
- * Enables the surface magnetism behavior
12346
- */
12347
- surfaceMagnetismBehaviorEnabled: boolean;
12348
- /**
12349
- * Initializes the behavior
12350
- */
12351
- init(): void;
12352
- /**
12353
- * Attaches the default behavior
12354
- * @param ownerMesh The top level mesh
12355
- * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
12356
- * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
12357
- */
12358
- attach(ownerMesh: BABYLON.Mesh, draggablesMeshes?: BABYLON.Mesh[], sceneUnderstandingMeshes?: BABYLON.AbstractMesh[]): void;
12359
- /**
12360
- * Detaches the behavior from the mesh
12361
- */
12362
- detach(): void;
12363
- private _addObservables;
12364
- private _removeObservables;
12365
- }
12366
- }
12367
12432
  declare module BABYLON.GUI {
12368
12433
  /** @hidden */
12369
12434
  export var fluentBackplatePixelShader: {
@@ -12540,35 +12605,24 @@ declare module BABYLON.GUI {
12540
12605
  * File name for the close icon.
12541
12606
  */
12542
12607
  static FOLLOW_ICON_FILENAME: string;
12608
+ private static DEFAULT_TEXT_RESOLUTION_Y;
12543
12609
  /**
12544
- * Dimensions of the slate
12545
- */
12546
- dimensions: BABYLON.Vector3;
12547
- /**
12548
- * Minimum dimensions of the slate
12549
- */
12550
- minDimensions: BABYLON.Vector3;
12551
- /**
12552
- * Default dimensions of the slate
12610
+ * Margin between title bar and contentplate
12553
12611
  */
12554
- readonly defaultDimensions: BABYLON.Vector3;
12555
- /**
12556
- * Dimensions of the backplate
12557
- */
12558
- backplateDimensions: BABYLON.Vector3;
12559
- /**
12560
- * Margin between backplate and contentplate
12561
- */
12562
- backPlateMargin: number;
12612
+ titleBarMargin: number;
12563
12613
  /**
12564
12614
  * Origin in local coordinates (top left corner)
12565
12615
  */
12566
12616
  origin: BABYLON.Vector3;
12567
- private _backPlateMaterial;
12617
+ private _dimensions;
12618
+ private _titleBarHeight;
12619
+ private _titleBarMaterial;
12620
+ private _backMaterial;
12568
12621
  private _contentMaterial;
12569
12622
  private _pickedPointObserver;
12570
12623
  private _positionChangedObserver;
12571
- private _imageUrl;
12624
+ private _titleText;
12625
+ private _titleTextComponent;
12572
12626
  private _contentViewport;
12573
12627
  private _contentDragBehavior;
12574
12628
  private _defaultBehavior;
@@ -12578,21 +12632,42 @@ declare module BABYLON.GUI {
12578
12632
  get defaultBehavior(): DefaultBehavior;
12579
12633
  /** @hidden */
12580
12634
  _gizmo: SlateGizmo;
12581
- protected _backPlate: BABYLON.Mesh;
12635
+ protected _titleBar: BABYLON.Mesh;
12636
+ protected _titleBarTitle: BABYLON.Mesh;
12582
12637
  protected _contentPlate: BABYLON.Mesh;
12583
- protected _followButton: TouchHolographicButton;
12638
+ protected _backPlate: BABYLON.Mesh;
12639
+ /** @hidden */
12640
+ _followButton: TouchHolographicButton;
12584
12641
  protected _closeButton: TouchHolographicButton;
12585
12642
  protected _contentScaleRatio: number;
12586
12643
  /**
12587
- * Rendering ground id of all the mesh in the button
12644
+ * 2D dimensions of the slate
12645
+ */
12646
+ get dimensions(): BABYLON.Vector2;
12647
+ set dimensions(value: BABYLON.Vector2);
12648
+ /**
12649
+ * Minimum dimensions of the slate
12650
+ */
12651
+ minDimensions: BABYLON.Vector2;
12652
+ /**
12653
+ * Default dimensions of the slate
12654
+ */
12655
+ readonly defaultDimensions: BABYLON.Vector2;
12656
+ /**
12657
+ * Height of the title bar component
12658
+ */
12659
+ get titleBarHeight(): number;
12660
+ set titleBarHeight(value: number);
12661
+ /**
12662
+ * Rendering ground id of all the meshes
12588
12663
  */
12589
12664
  set renderingGroupId(id: number);
12590
12665
  get renderingGroupId(): number;
12591
12666
  /**
12592
- * Gets or sets the image url for the button
12667
+ * The title text displayed at the top of the slate
12593
12668
  */
12594
- get imageUrl(): string;
12595
- set imageUrl(value: string);
12669
+ set title(title: string);
12670
+ get title(): string;
12596
12671
  /**
12597
12672
  * Creates a new slate
12598
12673
  * @param name defines the control name
@@ -12604,7 +12679,6 @@ declare module BABYLON.GUI {
12604
12679
  * @param facadeTexture defines the AdvancedDynamicTexture to use
12605
12680
  */
12606
12681
  protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
12607
- private _rebuildContent;
12608
12682
  private _addControl;
12609
12683
  protected _getTypeName(): string;
12610
12684
  /**
@@ -12624,8 +12698,9 @@ declare module BABYLON.GUI {
12624
12698
  _prepareNode(scene: BABYLON.Scene): void;
12625
12699
  /**
12626
12700
  * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.
12701
+ * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well
12627
12702
  */
12628
- resetDefaultAspectAndPose(): void;
12703
+ resetDefaultAspectAndPose(resetAspect?: boolean): void;
12629
12704
  /**
12630
12705
  * Releases all associated resources
12631
12706
  */
@@ -13639,6 +13714,7 @@ declare module BABYLON.GUI {
13639
13714
  private _maximum;
13640
13715
  private _value;
13641
13716
  private _step;
13717
+ private _draggedPosition;
13642
13718
  /** BABYLON.Observable raised when the sldier value changes */
13643
13719
  onValueChangedObservable: BABYLON.Observable<number>;
13644
13720
  /**