babylonjs-gui 5.0.0-beta.9 → 5.0.0-rc.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.
@@ -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
  */
@@ -7545,6 +7583,7 @@ declare module BABYLON.GUI {
7545
7583
  private _resizeObserver;
7546
7584
  private _preKeyboardObserver;
7547
7585
  private _pointerMoveObserver;
7586
+ private _sceneRenderObserver;
7548
7587
  private _pointerObserver;
7549
7588
  private _canvasPointerOutObserver;
7550
7589
  private _canvasBlurObserver;
@@ -7717,6 +7756,13 @@ declare module BABYLON.GUI {
7717
7756
  */
7718
7757
  get clipboardData(): string;
7719
7758
  set clipboardData(value: string);
7759
+ /**
7760
+ * If set to true, every scene render will trigger a pointer event for the GUI
7761
+ * if it is linked to a mesh or has controls linked to a mesh. This will allow
7762
+ * you to catch the pointer moving around the GUI due to camera or mesh movements,
7763
+ * but it has a performance cost.
7764
+ */
7765
+ checkPointerEveryFrame: boolean;
7720
7766
  /**
7721
7767
  * Creates a new AdvancedDynamicTexture
7722
7768
  * @param name defines the name of the texture
@@ -7819,6 +7865,7 @@ declare module BABYLON.GUI {
7819
7865
  }, control: Control): void;
7820
7866
  /** @hidden */
7821
7867
  _cleanControlAfterRemoval(control: Control): void;
7868
+ private _translateToPicking;
7822
7869
  /** Attach to all scene events required to support pointer events */
7823
7870
  attach(): void;
7824
7871
  /** @hidden */
@@ -7847,6 +7894,7 @@ declare module BABYLON.GUI {
7847
7894
  */
7848
7895
  moveFocusToControl(control: IFocusableControl): void;
7849
7896
  private _manageFocus;
7897
+ private _attachPickingToSceneRender;
7850
7898
  private _attachToOnPointerOut;
7851
7899
  private _attachToOnBlur;
7852
7900
  /**
@@ -8531,7 +8579,7 @@ declare module BABYLON.GUI {
8531
8579
  /** @hidden */
8532
8580
  _flagDescendantsAsMatrixDirty(): void;
8533
8581
  /** @hidden */
8534
- _intersectsRect(rect: Measure): boolean;
8582
+ _intersectsRect(rect: Measure, context?: BABYLON.ICanvasRenderingContext): boolean;
8535
8583
  /** @hidden */
8536
8584
  protected _computeAdditionnalOffsetX(): number;
8537
8585
  /** @hidden */
@@ -8582,17 +8630,17 @@ declare module BABYLON.GUI {
8582
8630
  */
8583
8631
  contains(x: number, y: number): boolean;
8584
8632
  /** @hidden */
8585
- _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8633
+ _processPicking(x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8586
8634
  /** @hidden */
8587
- _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.PointerInfoBase): void;
8635
+ _onPointerMove(target: Control, coordinates: BABYLON.Vector2, pointerId: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>): void;
8588
8636
  /** @hidden */
8589
- _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
8637
+ _onPointerEnter(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>): boolean;
8590
8638
  /** @hidden */
8591
8639
  _onPointerOut(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, force?: boolean): void;
8592
8640
  /** @hidden */
8593
- _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.PointerInfoBase): boolean;
8641
+ _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>): boolean;
8594
8642
  /** @hidden */
8595
- _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: BABYLON.PointerInfoBase): void;
8643
+ _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean, pi?: BABYLON.Nullable<BABYLON.PointerInfoBase>): void;
8596
8644
  /** @hidden */
8597
8645
  _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
8598
8646
  /** @hidden */
@@ -8600,7 +8648,7 @@ declare module BABYLON.GUI {
8600
8648
  /** @hidden */
8601
8649
  _onCanvasBlur(): void;
8602
8650
  /** @hidden */
8603
- _processObservables(type: number, x: number, y: number, pi: BABYLON.PointerInfoBase, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8651
+ _processObservables(type: number, x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8604
8652
  private _prepareFont;
8605
8653
  /**
8606
8654
  * Serializes the current control
@@ -8772,7 +8820,7 @@ declare module BABYLON.GUI {
8772
8820
  _draw(context: BABYLON.ICanvasRenderingContext, invalidatedRectangle?: Measure): void;
8773
8821
  getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
8774
8822
  /** @hidden */
8775
- _processPicking(x: number, y: number, pi: BABYLON.PointerInfoBase, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8823
+ _processPicking(x: number, y: number, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, type: number, pointerId: number, buttonIndex: number, deltaX?: number, deltaY?: number): boolean;
8776
8824
  /** @hidden */
8777
8825
  protected _additionalProcessing(parentMeasure: Measure, context: BABYLON.ICanvasRenderingContext): void;
8778
8826
  /**
@@ -8969,6 +9017,7 @@ declare module BABYLON.GUI {
8969
9017
  protected _applyStates(context: BABYLON.ICanvasRenderingContext): void;
8970
9018
  protected _breakLines(refWidth: number, refHeight: number, context: BABYLON.ICanvasRenderingContext): object[];
8971
9019
  protected _parseLine(line: string | undefined, context: BABYLON.ICanvasRenderingContext): object;
9020
+ private _getCharsToRemove;
8972
9021
  protected _parseLineEllipsis(line: string | undefined, width: number, context: BABYLON.ICanvasRenderingContext): object;
8973
9022
  protected _parseLineWordWrap(line: string | undefined, width: number, context: BABYLON.ICanvasRenderingContext): object[];
8974
9023
  protected _parseLineWordWrapEllipsis(line: string | undefined, width: number, height: number, context: BABYLON.ICanvasRenderingContext): object[];
@@ -9492,6 +9541,8 @@ declare module BABYLON.GUI {
9492
9541
  private _autoStretchWidth;
9493
9542
  private _maxWidth;
9494
9543
  private _isFocused;
9544
+ /** the type of device that most recently focused the input: "mouse", "touch" or "pen" */
9545
+ private _focusedBy;
9495
9546
  private _blinkTimeout;
9496
9547
  private _blinkIsEven;
9497
9548
  private _cursorOffset;
@@ -11279,7 +11330,8 @@ declare module BABYLON.GUI {
11279
11330
  export class TouchButton3D extends Button3D {
11280
11331
  private _collisionMesh;
11281
11332
  private _collidableFrontDirection;
11282
- protected _isNearPressed: boolean;
11333
+ private _isNearPressed;
11334
+ private _interactionSurfaceHeight;
11283
11335
  private _isToggleButton;
11284
11336
  private _toggleState;
11285
11337
  private _toggleButtonCallback;
@@ -11293,6 +11345,10 @@ declare module BABYLON.GUI {
11293
11345
  * @param collisionMesh mesh to track collisions with
11294
11346
  */
11295
11347
  constructor(name?: string, collisionMesh?: BABYLON.Mesh);
11348
+ /**
11349
+ * Whether the current interaction is caused by near interaction or not
11350
+ */
11351
+ get isActiveNearInteraction(): boolean;
11296
11352
  /**
11297
11353
  * Sets the front-facing direction of the button. Pass in BABYLON.Vector3.Zero to allow interactions from any direction
11298
11354
  * @param frontDir the forward direction of the button
@@ -11321,6 +11377,12 @@ declare module BABYLON.GUI {
11321
11377
  get isToggled(): boolean;
11322
11378
  protected _onToggle(newState: boolean): void;
11323
11379
  private _isInteractionInFrontOfButton;
11380
+ /**
11381
+ * Get the height of the touchPoint from the collidable part of the button
11382
+ * @param touchPoint the point to compare to the button, in absolute position
11383
+ * @returns the depth of the touch point into the front of the button
11384
+ */
11385
+ getPressDepth(touchPoint: BABYLON.Vector3): number;
11324
11386
  protected _getInteractionHeight(interactionPos: BABYLON.Vector3, basePos: BABYLON.Vector3): number;
11325
11387
  /** @hidden */
11326
11388
  _generatePointerEventType(providedType: number, nearMeshPosition: BABYLON.Vector3, activeInteractionCount: number): number;
@@ -12003,6 +12065,10 @@ declare module BABYLON.GUI {
12003
12065
  */
12004
12066
  set renderingGroupId(id: number);
12005
12067
  get renderingGroupId(): number;
12068
+ /**
12069
+ * Gets the mesh used to render this control
12070
+ */
12071
+ get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
12006
12072
  /**
12007
12073
  * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
12008
12074
  */
@@ -12058,6 +12124,74 @@ declare module BABYLON.GUI {
12058
12124
  dispose(): void;
12059
12125
  }
12060
12126
  }
12127
+ declare module BABYLON.GUI {
12128
+ /**
12129
+ * Default behavior for 3D UI elements.
12130
+ * Handles a BABYLON.FollowBehavior, SixDofBehavior and BABYLON.SurfaceMagnetismBehavior
12131
+ * @since 5.0.0
12132
+ */
12133
+ export class DefaultBehavior implements BABYLON.Behavior<BABYLON.Mesh> {
12134
+ private _scene;
12135
+ private _followBehavior;
12136
+ private _sixDofDragBehavior;
12137
+ private _surfaceMagnetismBehavior;
12138
+ private _onBeforeRenderObserver;
12139
+ private _onDragObserver;
12140
+ /**
12141
+ * Instantiates the default behavior
12142
+ */
12143
+ constructor();
12144
+ /**
12145
+ * Attached node of this behavior
12146
+ */
12147
+ attachedNode: BABYLON.Nullable<BABYLON.Mesh>;
12148
+ /**
12149
+ * The name of the behavior
12150
+ */
12151
+ get name(): string;
12152
+ /**
12153
+ * The follow behavior
12154
+ */
12155
+ get followBehavior(): BABYLON.FollowBehavior;
12156
+ /**
12157
+ * The six DoF drag behavior
12158
+ */
12159
+ get sixDofDragBehavior(): BABYLON.SixDofDragBehavior;
12160
+ /**
12161
+ * The surface magnetism behavior
12162
+ */
12163
+ get surfaceMagnetismBehavior(): BABYLON.SurfaceMagnetismBehavior;
12164
+ /**
12165
+ * Enables the follow behavior
12166
+ */
12167
+ followBehaviorEnabled: boolean;
12168
+ /**
12169
+ * Enables the six DoF drag behavior
12170
+ */
12171
+ sixDofDragBehaviorEnabled: boolean;
12172
+ /**
12173
+ * Enables the surface magnetism behavior
12174
+ */
12175
+ surfaceMagnetismBehaviorEnabled: boolean;
12176
+ /**
12177
+ * Initializes the behavior
12178
+ */
12179
+ init(): void;
12180
+ /**
12181
+ * Attaches the default behavior
12182
+ * @param ownerMesh The top level mesh
12183
+ * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
12184
+ * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
12185
+ */
12186
+ attach(ownerMesh: BABYLON.Mesh, draggablesMeshes?: BABYLON.Mesh[], sceneUnderstandingMeshes?: BABYLON.AbstractMesh[]): void;
12187
+ /**
12188
+ * Detaches the behavior from the mesh
12189
+ */
12190
+ detach(): void;
12191
+ private _addObservables;
12192
+ private _removeObservables;
12193
+ }
12194
+ }
12061
12195
  declare module BABYLON.GUI {
12062
12196
  /** @hidden */
12063
12197
  export var handleVertexShader: {
@@ -12260,6 +12394,7 @@ declare module BABYLON.GUI {
12260
12394
  * Value we use to offset handles from mesh
12261
12395
  */
12262
12396
  private _margin;
12397
+ private _handleSize;
12263
12398
  private _attachedSlate;
12264
12399
  private _existingSlateScale;
12265
12400
  /**
@@ -12270,10 +12405,6 @@ declare module BABYLON.GUI {
12270
12405
  * The distance away from the object which the draggable meshes should appear world sized when fixedScreenSize is set to true (default: 10)
12271
12406
  */
12272
12407
  fixedScreenSizeDistanceFactor: number;
12273
- /**
12274
- * Size of the handles (meters in XR)
12275
- */
12276
- handleSize: number;
12277
12408
  /**
12278
12409
  * The slate attached to this gizmo
12279
12410
  */
@@ -12292,78 +12423,11 @@ declare module BABYLON.GUI {
12292
12423
  */
12293
12424
  updateBoundingBox(): void;
12294
12425
  private _updateHandlesPosition;
12426
+ private _updateHandlesScaling;
12295
12427
  protected _update(): void;
12296
12428
  dispose(): void;
12297
12429
  }
12298
12430
  }
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
12431
  declare module BABYLON.GUI {
12368
12432
  /** @hidden */
12369
12433
  export var fluentBackplatePixelShader: {
@@ -12540,35 +12604,24 @@ declare module BABYLON.GUI {
12540
12604
  * File name for the close icon.
12541
12605
  */
12542
12606
  static FOLLOW_ICON_FILENAME: string;
12607
+ private static DEFAULT_TEXT_RESOLUTION_Y;
12543
12608
  /**
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
12609
+ * Margin between title bar and contentplate
12553
12610
  */
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;
12611
+ titleBarMargin: number;
12563
12612
  /**
12564
12613
  * Origin in local coordinates (top left corner)
12565
12614
  */
12566
12615
  origin: BABYLON.Vector3;
12567
- private _backPlateMaterial;
12616
+ private _dimensions;
12617
+ private _titleBarHeight;
12618
+ private _titleBarMaterial;
12619
+ private _backMaterial;
12568
12620
  private _contentMaterial;
12569
12621
  private _pickedPointObserver;
12570
12622
  private _positionChangedObserver;
12571
- private _imageUrl;
12623
+ private _titleText;
12624
+ private _titleTextComponent;
12572
12625
  private _contentViewport;
12573
12626
  private _contentDragBehavior;
12574
12627
  private _defaultBehavior;
@@ -12578,21 +12631,42 @@ declare module BABYLON.GUI {
12578
12631
  get defaultBehavior(): DefaultBehavior;
12579
12632
  /** @hidden */
12580
12633
  _gizmo: SlateGizmo;
12581
- protected _backPlate: BABYLON.Mesh;
12634
+ protected _titleBar: BABYLON.Mesh;
12635
+ protected _titleBarTitle: BABYLON.Mesh;
12582
12636
  protected _contentPlate: BABYLON.Mesh;
12583
- protected _followButton: TouchHolographicButton;
12637
+ protected _backPlate: BABYLON.Mesh;
12638
+ /** @hidden */
12639
+ _followButton: TouchHolographicButton;
12584
12640
  protected _closeButton: TouchHolographicButton;
12585
12641
  protected _contentScaleRatio: number;
12586
12642
  /**
12587
- * Rendering ground id of all the mesh in the button
12643
+ * 2D dimensions of the slate
12644
+ */
12645
+ get dimensions(): BABYLON.Vector2;
12646
+ set dimensions(value: BABYLON.Vector2);
12647
+ /**
12648
+ * Minimum dimensions of the slate
12649
+ */
12650
+ minDimensions: BABYLON.Vector2;
12651
+ /**
12652
+ * Default dimensions of the slate
12653
+ */
12654
+ readonly defaultDimensions: BABYLON.Vector2;
12655
+ /**
12656
+ * Height of the title bar component
12657
+ */
12658
+ get titleBarHeight(): number;
12659
+ set titleBarHeight(value: number);
12660
+ /**
12661
+ * Rendering ground id of all the meshes
12588
12662
  */
12589
12663
  set renderingGroupId(id: number);
12590
12664
  get renderingGroupId(): number;
12591
12665
  /**
12592
- * Gets or sets the image url for the button
12666
+ * The title text displayed at the top of the slate
12593
12667
  */
12594
- get imageUrl(): string;
12595
- set imageUrl(value: string);
12668
+ set title(title: string);
12669
+ get title(): string;
12596
12670
  /**
12597
12671
  * Creates a new slate
12598
12672
  * @param name defines the control name
@@ -12604,7 +12678,6 @@ declare module BABYLON.GUI {
12604
12678
  * @param facadeTexture defines the AdvancedDynamicTexture to use
12605
12679
  */
12606
12680
  protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
12607
- private _rebuildContent;
12608
12681
  private _addControl;
12609
12682
  protected _getTypeName(): string;
12610
12683
  /**
@@ -12624,8 +12697,9 @@ declare module BABYLON.GUI {
12624
12697
  _prepareNode(scene: BABYLON.Scene): void;
12625
12698
  /**
12626
12699
  * Resets the aspect and pose of the slate so it is right in front of the active camera, facing towards it.
12700
+ * @param resetAspect Should the slate's dimensions/aspect ratio be reset as well
12627
12701
  */
12628
- resetDefaultAspectAndPose(): void;
12702
+ resetDefaultAspectAndPose(resetAspect?: boolean): void;
12629
12703
  /**
12630
12704
  * Releases all associated resources
12631
12705
  */