babylonjs-gui 5.0.0-beta.7 → 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
  /**
@@ -772,7 +782,19 @@ declare module "babylonjs-gui/2D/advancedDynamicTexture" {
772
782
  * @returns a new AdvancedDynamicTexture
773
783
  */
774
784
  static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number, adaptiveScaling?: boolean): AdvancedDynamicTexture;
785
+ /**
786
+ * Scales the texture
787
+ * @param ratio the scale factor to apply to both width and height
788
+ */
789
+ scale(ratio: number): void;
790
+ /**
791
+ * Resizes the texture
792
+ * @param width the new width
793
+ * @param height the new height
794
+ */
795
+ scaleTo(width: number, height: number): void;
775
796
  }
797
+ export { IFocusableControl };
776
798
  }
777
799
  declare module "babylonjs-gui/2D/controls/control" {
778
800
  import { Nullable } from "babylonjs/types";
@@ -1389,7 +1411,7 @@ declare module "babylonjs-gui/2D/controls/control" {
1389
1411
  /** @hidden */
1390
1412
  _flagDescendantsAsMatrixDirty(): void;
1391
1413
  /** @hidden */
1392
- _intersectsRect(rect: Measure): boolean;
1414
+ _intersectsRect(rect: Measure, context?: ICanvasRenderingContext): boolean;
1393
1415
  /** @hidden */
1394
1416
  protected _computeAdditionnalOffsetX(): number;
1395
1417
  /** @hidden */
@@ -1440,17 +1462,17 @@ declare module "babylonjs-gui/2D/controls/control" {
1440
1462
  */
1441
1463
  contains(x: number, y: number): boolean;
1442
1464
  /** @hidden */
1443
- _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;
1444
1466
  /** @hidden */
1445
- _onPointerMove(target: Control, coordinates: Vector2, pointerId: number, pi: PointerInfoBase): void;
1467
+ _onPointerMove(target: Control, coordinates: Vector2, pointerId: number, pi: Nullable<PointerInfoBase>): void;
1446
1468
  /** @hidden */
1447
- _onPointerEnter(target: Control, pi: PointerInfoBase): boolean;
1469
+ _onPointerEnter(target: Control, pi: Nullable<PointerInfoBase>): boolean;
1448
1470
  /** @hidden */
1449
1471
  _onPointerOut(target: Control, pi: Nullable<PointerInfoBase>, force?: boolean): void;
1450
1472
  /** @hidden */
1451
- _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;
1452
1474
  /** @hidden */
1453
- _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;
1454
1476
  /** @hidden */
1455
1477
  _forcePointerUp(pointerId?: Nullable<number>): void;
1456
1478
  /** @hidden */
@@ -1458,7 +1480,7 @@ declare module "babylonjs-gui/2D/controls/control" {
1458
1480
  /** @hidden */
1459
1481
  _onCanvasBlur(): void;
1460
1482
  /** @hidden */
1461
- _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;
1462
1484
  private _prepareFont;
1463
1485
  /**
1464
1486
  * Serializes the current control
@@ -1637,7 +1659,7 @@ declare module "babylonjs-gui/2D/controls/container" {
1637
1659
  _draw(context: ICanvasRenderingContext, invalidatedRectangle?: Measure): void;
1638
1660
  getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
1639
1661
  /** @hidden */
1640
- _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;
1641
1663
  /** @hidden */
1642
1664
  protected _additionalProcessing(parentMeasure: Measure, context: ICanvasRenderingContext): void;
1643
1665
  /**
@@ -1842,6 +1864,7 @@ declare module "babylonjs-gui/2D/controls/textBlock" {
1842
1864
  protected _applyStates(context: ICanvasRenderingContext): void;
1843
1865
  protected _breakLines(refWidth: number, refHeight: number, context: ICanvasRenderingContext): object[];
1844
1866
  protected _parseLine(line: string | undefined, context: ICanvasRenderingContext): object;
1867
+ private _getCharsToRemove;
1845
1868
  protected _parseLineEllipsis(line: string | undefined, width: number, context: ICanvasRenderingContext): object;
1846
1869
  protected _parseLineWordWrap(line: string | undefined, width: number, context: ICanvasRenderingContext): object[];
1847
1870
  protected _parseLineWordWrapEllipsis(line: string | undefined, width: number, height: number, context: ICanvasRenderingContext): object[];
@@ -2405,6 +2428,8 @@ declare module "babylonjs-gui/2D/controls/inputText" {
2405
2428
  private _autoStretchWidth;
2406
2429
  private _maxWidth;
2407
2430
  private _isFocused;
2431
+ /** the type of device that most recently focused the input: "mouse", "touch" or "pen" */
2432
+ private _focusedBy;
2408
2433
  private _blinkTimeout;
2409
2434
  private _blinkIsEven;
2410
2435
  private _cursorOffset;
@@ -4365,7 +4390,8 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4365
4390
  export class TouchButton3D extends Button3D {
4366
4391
  private _collisionMesh;
4367
4392
  private _collidableFrontDirection;
4368
- protected _isNearPressed: boolean;
4393
+ private _isNearPressed;
4394
+ private _interactionSurfaceHeight;
4369
4395
  private _isToggleButton;
4370
4396
  private _toggleState;
4371
4397
  private _toggleButtonCallback;
@@ -4379,6 +4405,10 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4379
4405
  * @param collisionMesh mesh to track collisions with
4380
4406
  */
4381
4407
  constructor(name?: string, collisionMesh?: Mesh);
4408
+ /**
4409
+ * Whether the current interaction is caused by near interaction or not
4410
+ */
4411
+ get isActiveNearInteraction(): boolean;
4382
4412
  /**
4383
4413
  * Sets the front-facing direction of the button. Pass in Vector3.Zero to allow interactions from any direction
4384
4414
  * @param frontDir the forward direction of the button
@@ -4407,6 +4437,12 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4407
4437
  get isToggled(): boolean;
4408
4438
  protected _onToggle(newState: boolean): void;
4409
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;
4410
4446
  protected _getInteractionHeight(interactionPos: Vector3, basePos: Vector3): number;
4411
4447
  /** @hidden */
4412
4448
  _generatePointerEventType(providedType: number, nearMeshPosition: Vector3, activeInteractionCount: number): number;
@@ -5113,6 +5149,7 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5113
5149
  import { FluentButtonMaterial } from "babylonjs-gui/3D/materials/fluentButton/fluentButtonMaterial";
5114
5150
  import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
5115
5151
  import { TouchButton3D } from "babylonjs-gui/3D/controls/touchButton3D";
5152
+ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5116
5153
  /**
5117
5154
  * Class used to create a holographic button in 3D
5118
5155
  * @since 5.0.0
@@ -5154,6 +5191,10 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5154
5191
  */
5155
5192
  set renderingGroupId(id: number);
5156
5193
  get renderingGroupId(): number;
5194
+ /**
5195
+ * Gets the mesh used to render this control
5196
+ */
5197
+ get mesh(): Nullable<AbstractMesh>;
5157
5198
  /**
5158
5199
  * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
5159
5200
  */
@@ -5209,6 +5250,81 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5209
5250
  dispose(): void;
5210
5251
  }
5211
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
+ }
5212
5328
  declare module "babylonjs-gui/3D/materials/handle/shaders/handle.vertex" {
5213
5329
  /** @hidden */
5214
5330
  export var handleVertexShader: {
@@ -5428,6 +5544,7 @@ declare module "babylonjs-gui/3D/gizmos/slateGizmo" {
5428
5544
  * Value we use to offset handles from mesh
5429
5545
  */
5430
5546
  private _margin;
5547
+ private _handleSize;
5431
5548
  private _attachedSlate;
5432
5549
  private _existingSlateScale;
5433
5550
  /**
@@ -5438,10 +5555,6 @@ declare module "babylonjs-gui/3D/gizmos/slateGizmo" {
5438
5555
  * The distance away from the object which the draggable meshes should appear world sized when fixedScreenSize is set to true (default: 10)
5439
5556
  */
5440
5557
  fixedScreenSizeDistanceFactor: number;
5441
- /**
5442
- * Size of the handles (meters in XR)
5443
- */
5444
- handleSize: number;
5445
5558
  /**
5446
5559
  * The slate attached to this gizmo
5447
5560
  */
@@ -5460,85 +5573,11 @@ declare module "babylonjs-gui/3D/gizmos/slateGizmo" {
5460
5573
  */
5461
5574
  updateBoundingBox(): void;
5462
5575
  private _updateHandlesPosition;
5576
+ private _updateHandlesScaling;
5463
5577
  protected _update(): void;
5464
5578
  dispose(): void;
5465
5579
  }
5466
5580
  }
5467
- declare module "babylonjs-gui/3D/behaviors/defaultBehavior" {
5468
- import { Behavior } from "babylonjs/Behaviors/behavior";
5469
- import { FollowBehavior } from "babylonjs/Behaviors/Meshes/followBehavior";
5470
- import { SixDofDragBehavior } from "babylonjs/Behaviors/Meshes/sixDofDragBehavior";
5471
- import { Mesh } from "babylonjs/Meshes/mesh";
5472
- import { Nullable } from "babylonjs/types";
5473
- import { SurfaceMagnetismBehavior } from "babylonjs/Behaviors/Meshes/surfaceMagnetismBehavior";
5474
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5475
- /**
5476
- * Default behavior for 3D UI elements.
5477
- * Handles a FollowBehavior, SixDofBehavior and SurfaceMagnetismBehavior
5478
- * @since 5.0.0
5479
- */
5480
- export class DefaultBehavior implements Behavior<Mesh> {
5481
- private _scene;
5482
- private _followBehavior;
5483
- private _sixDofDragBehavior;
5484
- private _surfaceMagnetismBehavior;
5485
- private _onBeforeRenderObserver;
5486
- private _onDragObserver;
5487
- /**
5488
- * Instantiates the default behavior
5489
- */
5490
- constructor();
5491
- /**
5492
- * Attached node of this behavior
5493
- */
5494
- attachedNode: Nullable<Mesh>;
5495
- /**
5496
- * The name of the behavior
5497
- */
5498
- get name(): string;
5499
- /**
5500
- * The follow behavior
5501
- */
5502
- get followBehavior(): FollowBehavior;
5503
- /**
5504
- * The six DoF drag behavior
5505
- */
5506
- get sixDofDragBehavior(): SixDofDragBehavior;
5507
- /**
5508
- * The surface magnetism behavior
5509
- */
5510
- get surfaceMagnetismBehavior(): SurfaceMagnetismBehavior;
5511
- /**
5512
- * Enables the follow behavior
5513
- */
5514
- followBehaviorEnabled: boolean;
5515
- /**
5516
- * Enables the six DoF drag behavior
5517
- */
5518
- sixDofDragBehaviorEnabled: boolean;
5519
- /**
5520
- * Enables the surface magnetism behavior
5521
- */
5522
- surfaceMagnetismBehaviorEnabled: boolean;
5523
- /**
5524
- * Initializes the behavior
5525
- */
5526
- init(): void;
5527
- /**
5528
- * Attaches the default behavior
5529
- * @param ownerMesh The top level mesh
5530
- * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
5531
- * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
5532
- */
5533
- attach(ownerMesh: Mesh, draggablesMeshes?: Mesh[], sceneUnderstandingMeshes?: AbstractMesh[]): void;
5534
- /**
5535
- * Detaches the behavior from the mesh
5536
- */
5537
- detach(): void;
5538
- private _addObservables;
5539
- private _removeObservables;
5540
- }
5541
- }
5542
5581
  declare module "babylonjs-gui/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment" {
5543
5582
  /** @hidden */
5544
5583
  export var fluentBackplatePixelShader: {
@@ -5710,16 +5749,16 @@ declare module "babylonjs-gui/3D/materials/fluentBackplate/fluentBackplateMateri
5710
5749
  }
5711
5750
  }
5712
5751
  declare module "babylonjs-gui/3D/controls/holographicSlate" {
5713
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5714
- import { Scene } from "babylonjs/scene";
5715
- import { TransformNode } from "babylonjs/Meshes/transformNode";
5716
- import { Mesh } from "babylonjs/Meshes/mesh";
5717
- import { TouchHolographicButton } from "babylonjs-gui/3D/controls/touchHolographicButton";
5718
- import { Vector3 } from "babylonjs/Maths/math.vector";
5719
5752
  import { ContentDisplay3D } from "babylonjs-gui/3D/controls/contentDisplay3D";
5753
+ import { TouchHolographicButton } from "babylonjs-gui/3D/controls/touchHolographicButton";
5720
5754
  import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
5721
- import { SlateGizmo } from "babylonjs-gui/3D/gizmos/slateGizmo";
5722
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";
5723
5762
  /**
5724
5763
  * Class used to create a holographic slate
5725
5764
  * @since 5.0.0
@@ -5737,35 +5776,24 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5737
5776
  * File name for the close icon.
5738
5777
  */
5739
5778
  static FOLLOW_ICON_FILENAME: string;
5779
+ private static DEFAULT_TEXT_RESOLUTION_Y;
5740
5780
  /**
5741
- * Dimensions of the slate
5742
- */
5743
- dimensions: Vector3;
5744
- /**
5745
- * Minimum dimensions of the slate
5781
+ * Margin between title bar and contentplate
5746
5782
  */
5747
- minDimensions: Vector3;
5748
- /**
5749
- * Default dimensions of the slate
5750
- */
5751
- readonly defaultDimensions: Vector3;
5752
- /**
5753
- * Dimensions of the backplate
5754
- */
5755
- backplateDimensions: Vector3;
5756
- /**
5757
- * Margin between backplate and contentplate
5758
- */
5759
- backPlateMargin: number;
5783
+ titleBarMargin: number;
5760
5784
  /**
5761
5785
  * Origin in local coordinates (top left corner)
5762
5786
  */
5763
5787
  origin: Vector3;
5764
- private _backPlateMaterial;
5788
+ private _dimensions;
5789
+ private _titleBarHeight;
5790
+ private _titleBarMaterial;
5791
+ private _backMaterial;
5765
5792
  private _contentMaterial;
5766
5793
  private _pickedPointObserver;
5767
5794
  private _positionChangedObserver;
5768
- private _imageUrl;
5795
+ private _titleText;
5796
+ private _titleTextComponent;
5769
5797
  private _contentViewport;
5770
5798
  private _contentDragBehavior;
5771
5799
  private _defaultBehavior;
@@ -5775,21 +5803,42 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5775
5803
  get defaultBehavior(): DefaultBehavior;
5776
5804
  /** @hidden */
5777
5805
  _gizmo: SlateGizmo;
5778
- protected _backPlate: Mesh;
5806
+ protected _titleBar: Mesh;
5807
+ protected _titleBarTitle: Mesh;
5779
5808
  protected _contentPlate: Mesh;
5780
- protected _followButton: TouchHolographicButton;
5809
+ protected _backPlate: Mesh;
5810
+ /** @hidden */
5811
+ _followButton: TouchHolographicButton;
5781
5812
  protected _closeButton: TouchHolographicButton;
5782
5813
  protected _contentScaleRatio: number;
5783
5814
  /**
5784
- * 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
5785
5834
  */
5786
5835
  set renderingGroupId(id: number);
5787
5836
  get renderingGroupId(): number;
5788
5837
  /**
5789
- * Gets or sets the image url for the button
5838
+ * The title text displayed at the top of the slate
5790
5839
  */
5791
- get imageUrl(): string;
5792
- set imageUrl(value: string);
5840
+ set title(title: string);
5841
+ get title(): string;
5793
5842
  /**
5794
5843
  * Creates a new slate
5795
5844
  * @param name defines the control name
@@ -5801,7 +5850,6 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5801
5850
  * @param facadeTexture defines the AdvancedDynamicTexture to use
5802
5851
  */
5803
5852
  protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
5804
- private _rebuildContent;
5805
5853
  private _addControl;
5806
5854
  protected _getTypeName(): string;
5807
5855
  /**
@@ -5821,8 +5869,9 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5821
5869
  _prepareNode(scene: Scene): void;
5822
5870
  /**
5823
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
5824
5873
  */
5825
- resetDefaultAspectAndPose(): void;
5874
+ resetDefaultAspectAndPose(resetAspect?: boolean): void;
5826
5875
  /**
5827
5876
  * Releases all associated resources
5828
5877
  */
@@ -7534,6 +7583,7 @@ declare module BABYLON.GUI {
7534
7583
  private _resizeObserver;
7535
7584
  private _preKeyboardObserver;
7536
7585
  private _pointerMoveObserver;
7586
+ private _sceneRenderObserver;
7537
7587
  private _pointerObserver;
7538
7588
  private _canvasPointerOutObserver;
7539
7589
  private _canvasBlurObserver;
@@ -7706,6 +7756,13 @@ declare module BABYLON.GUI {
7706
7756
  */
7707
7757
  get clipboardData(): string;
7708
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;
7709
7766
  /**
7710
7767
  * Creates a new AdvancedDynamicTexture
7711
7768
  * @param name defines the name of the texture
@@ -7808,6 +7865,7 @@ declare module BABYLON.GUI {
7808
7865
  }, control: Control): void;
7809
7866
  /** @hidden */
7810
7867
  _cleanControlAfterRemoval(control: Control): void;
7868
+ private _translateToPicking;
7811
7869
  /** Attach to all scene events required to support pointer events */
7812
7870
  attach(): void;
7813
7871
  /** @hidden */
@@ -7836,6 +7894,7 @@ declare module BABYLON.GUI {
7836
7894
  */
7837
7895
  moveFocusToControl(control: IFocusableControl): void;
7838
7896
  private _manageFocus;
7897
+ private _attachPickingToSceneRender;
7839
7898
  private _attachToOnPointerOut;
7840
7899
  private _attachToOnBlur;
7841
7900
  /**
@@ -7905,6 +7964,17 @@ declare module BABYLON.GUI {
7905
7964
  * @returns a new AdvancedDynamicTexture
7906
7965
  */
7907
7966
  static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number, adaptiveScaling?: boolean): AdvancedDynamicTexture;
7967
+ /**
7968
+ * Scales the texture
7969
+ * @param ratio the scale factor to apply to both width and height
7970
+ */
7971
+ scale(ratio: number): void;
7972
+ /**
7973
+ * Resizes the texture
7974
+ * @param width the new width
7975
+ * @param height the new height
7976
+ */
7977
+ scaleTo(width: number, height: number): void;
7908
7978
  }
7909
7979
  }
7910
7980
  declare module BABYLON.GUI {
@@ -8509,7 +8579,7 @@ declare module BABYLON.GUI {
8509
8579
  /** @hidden */
8510
8580
  _flagDescendantsAsMatrixDirty(): void;
8511
8581
  /** @hidden */
8512
- _intersectsRect(rect: Measure): boolean;
8582
+ _intersectsRect(rect: Measure, context?: BABYLON.ICanvasRenderingContext): boolean;
8513
8583
  /** @hidden */
8514
8584
  protected _computeAdditionnalOffsetX(): number;
8515
8585
  /** @hidden */
@@ -8560,17 +8630,17 @@ declare module BABYLON.GUI {
8560
8630
  */
8561
8631
  contains(x: number, y: number): boolean;
8562
8632
  /** @hidden */
8563
- _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;
8564
8634
  /** @hidden */
8565
- _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;
8566
8636
  /** @hidden */
8567
- _onPointerEnter(target: Control, pi: BABYLON.PointerInfoBase): boolean;
8637
+ _onPointerEnter(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>): boolean;
8568
8638
  /** @hidden */
8569
8639
  _onPointerOut(target: Control, pi: BABYLON.Nullable<BABYLON.PointerInfoBase>, force?: boolean): void;
8570
8640
  /** @hidden */
8571
- _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;
8572
8642
  /** @hidden */
8573
- _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;
8574
8644
  /** @hidden */
8575
8645
  _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
8576
8646
  /** @hidden */
@@ -8578,7 +8648,7 @@ declare module BABYLON.GUI {
8578
8648
  /** @hidden */
8579
8649
  _onCanvasBlur(): void;
8580
8650
  /** @hidden */
8581
- _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;
8582
8652
  private _prepareFont;
8583
8653
  /**
8584
8654
  * Serializes the current control
@@ -8750,7 +8820,7 @@ declare module BABYLON.GUI {
8750
8820
  _draw(context: BABYLON.ICanvasRenderingContext, invalidatedRectangle?: Measure): void;
8751
8821
  getDescendantsToRef(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
8752
8822
  /** @hidden */
8753
- _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;
8754
8824
  /** @hidden */
8755
8825
  protected _additionalProcessing(parentMeasure: Measure, context: BABYLON.ICanvasRenderingContext): void;
8756
8826
  /**
@@ -8947,6 +9017,7 @@ declare module BABYLON.GUI {
8947
9017
  protected _applyStates(context: BABYLON.ICanvasRenderingContext): void;
8948
9018
  protected _breakLines(refWidth: number, refHeight: number, context: BABYLON.ICanvasRenderingContext): object[];
8949
9019
  protected _parseLine(line: string | undefined, context: BABYLON.ICanvasRenderingContext): object;
9020
+ private _getCharsToRemove;
8950
9021
  protected _parseLineEllipsis(line: string | undefined, width: number, context: BABYLON.ICanvasRenderingContext): object;
8951
9022
  protected _parseLineWordWrap(line: string | undefined, width: number, context: BABYLON.ICanvasRenderingContext): object[];
8952
9023
  protected _parseLineWordWrapEllipsis(line: string | undefined, width: number, height: number, context: BABYLON.ICanvasRenderingContext): object[];
@@ -9470,6 +9541,8 @@ declare module BABYLON.GUI {
9470
9541
  private _autoStretchWidth;
9471
9542
  private _maxWidth;
9472
9543
  private _isFocused;
9544
+ /** the type of device that most recently focused the input: "mouse", "touch" or "pen" */
9545
+ private _focusedBy;
9473
9546
  private _blinkTimeout;
9474
9547
  private _blinkIsEven;
9475
9548
  private _cursorOffset;
@@ -11257,7 +11330,8 @@ declare module BABYLON.GUI {
11257
11330
  export class TouchButton3D extends Button3D {
11258
11331
  private _collisionMesh;
11259
11332
  private _collidableFrontDirection;
11260
- protected _isNearPressed: boolean;
11333
+ private _isNearPressed;
11334
+ private _interactionSurfaceHeight;
11261
11335
  private _isToggleButton;
11262
11336
  private _toggleState;
11263
11337
  private _toggleButtonCallback;
@@ -11271,6 +11345,10 @@ declare module BABYLON.GUI {
11271
11345
  * @param collisionMesh mesh to track collisions with
11272
11346
  */
11273
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;
11274
11352
  /**
11275
11353
  * Sets the front-facing direction of the button. Pass in BABYLON.Vector3.Zero to allow interactions from any direction
11276
11354
  * @param frontDir the forward direction of the button
@@ -11299,6 +11377,12 @@ declare module BABYLON.GUI {
11299
11377
  get isToggled(): boolean;
11300
11378
  protected _onToggle(newState: boolean): void;
11301
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;
11302
11386
  protected _getInteractionHeight(interactionPos: BABYLON.Vector3, basePos: BABYLON.Vector3): number;
11303
11387
  /** @hidden */
11304
11388
  _generatePointerEventType(providedType: number, nearMeshPosition: BABYLON.Vector3, activeInteractionCount: number): number;
@@ -11981,6 +12065,10 @@ declare module BABYLON.GUI {
11981
12065
  */
11982
12066
  set renderingGroupId(id: number);
11983
12067
  get renderingGroupId(): number;
12068
+ /**
12069
+ * Gets the mesh used to render this control
12070
+ */
12071
+ get mesh(): BABYLON.Nullable<BABYLON.AbstractMesh>;
11984
12072
  /**
11985
12073
  * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
11986
12074
  */
@@ -12036,6 +12124,74 @@ declare module BABYLON.GUI {
12036
12124
  dispose(): void;
12037
12125
  }
12038
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
+ }
12039
12195
  declare module BABYLON.GUI {
12040
12196
  /** @hidden */
12041
12197
  export var handleVertexShader: {
@@ -12238,6 +12394,7 @@ declare module BABYLON.GUI {
12238
12394
  * Value we use to offset handles from mesh
12239
12395
  */
12240
12396
  private _margin;
12397
+ private _handleSize;
12241
12398
  private _attachedSlate;
12242
12399
  private _existingSlateScale;
12243
12400
  /**
@@ -12248,10 +12405,6 @@ declare module BABYLON.GUI {
12248
12405
  * The distance away from the object which the draggable meshes should appear world sized when fixedScreenSize is set to true (default: 10)
12249
12406
  */
12250
12407
  fixedScreenSizeDistanceFactor: number;
12251
- /**
12252
- * Size of the handles (meters in XR)
12253
- */
12254
- handleSize: number;
12255
12408
  /**
12256
12409
  * The slate attached to this gizmo
12257
12410
  */
@@ -12270,78 +12423,11 @@ declare module BABYLON.GUI {
12270
12423
  */
12271
12424
  updateBoundingBox(): void;
12272
12425
  private _updateHandlesPosition;
12426
+ private _updateHandlesScaling;
12273
12427
  protected _update(): void;
12274
12428
  dispose(): void;
12275
12429
  }
12276
12430
  }
12277
- declare module BABYLON.GUI {
12278
- /**
12279
- * Default behavior for 3D UI elements.
12280
- * Handles a BABYLON.FollowBehavior, SixDofBehavior and BABYLON.SurfaceMagnetismBehavior
12281
- * @since 5.0.0
12282
- */
12283
- export class DefaultBehavior implements BABYLON.Behavior<BABYLON.Mesh> {
12284
- private _scene;
12285
- private _followBehavior;
12286
- private _sixDofDragBehavior;
12287
- private _surfaceMagnetismBehavior;
12288
- private _onBeforeRenderObserver;
12289
- private _onDragObserver;
12290
- /**
12291
- * Instantiates the default behavior
12292
- */
12293
- constructor();
12294
- /**
12295
- * Attached node of this behavior
12296
- */
12297
- attachedNode: BABYLON.Nullable<BABYLON.Mesh>;
12298
- /**
12299
- * The name of the behavior
12300
- */
12301
- get name(): string;
12302
- /**
12303
- * The follow behavior
12304
- */
12305
- get followBehavior(): BABYLON.FollowBehavior;
12306
- /**
12307
- * The six DoF drag behavior
12308
- */
12309
- get sixDofDragBehavior(): BABYLON.SixDofDragBehavior;
12310
- /**
12311
- * The surface magnetism behavior
12312
- */
12313
- get surfaceMagnetismBehavior(): BABYLON.SurfaceMagnetismBehavior;
12314
- /**
12315
- * Enables the follow behavior
12316
- */
12317
- followBehaviorEnabled: boolean;
12318
- /**
12319
- * Enables the six DoF drag behavior
12320
- */
12321
- sixDofDragBehaviorEnabled: boolean;
12322
- /**
12323
- * Enables the surface magnetism behavior
12324
- */
12325
- surfaceMagnetismBehaviorEnabled: boolean;
12326
- /**
12327
- * Initializes the behavior
12328
- */
12329
- init(): void;
12330
- /**
12331
- * Attaches the default behavior
12332
- * @param ownerMesh The top level mesh
12333
- * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
12334
- * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
12335
- */
12336
- attach(ownerMesh: BABYLON.Mesh, draggablesMeshes?: BABYLON.Mesh[], sceneUnderstandingMeshes?: BABYLON.AbstractMesh[]): void;
12337
- /**
12338
- * Detaches the behavior from the mesh
12339
- */
12340
- detach(): void;
12341
- private _addObservables;
12342
- private _removeObservables;
12343
- }
12344
- }
12345
12431
  declare module BABYLON.GUI {
12346
12432
  /** @hidden */
12347
12433
  export var fluentBackplatePixelShader: {
@@ -12518,35 +12604,24 @@ declare module BABYLON.GUI {
12518
12604
  * File name for the close icon.
12519
12605
  */
12520
12606
  static FOLLOW_ICON_FILENAME: string;
12607
+ private static DEFAULT_TEXT_RESOLUTION_Y;
12521
12608
  /**
12522
- * Dimensions of the slate
12523
- */
12524
- dimensions: BABYLON.Vector3;
12525
- /**
12526
- * Minimum dimensions of the slate
12527
- */
12528
- minDimensions: BABYLON.Vector3;
12529
- /**
12530
- * Default dimensions of the slate
12531
- */
12532
- readonly defaultDimensions: BABYLON.Vector3;
12533
- /**
12534
- * Dimensions of the backplate
12535
- */
12536
- backplateDimensions: BABYLON.Vector3;
12537
- /**
12538
- * Margin between backplate and contentplate
12609
+ * Margin between title bar and contentplate
12539
12610
  */
12540
- backPlateMargin: number;
12611
+ titleBarMargin: number;
12541
12612
  /**
12542
12613
  * Origin in local coordinates (top left corner)
12543
12614
  */
12544
12615
  origin: BABYLON.Vector3;
12545
- private _backPlateMaterial;
12616
+ private _dimensions;
12617
+ private _titleBarHeight;
12618
+ private _titleBarMaterial;
12619
+ private _backMaterial;
12546
12620
  private _contentMaterial;
12547
12621
  private _pickedPointObserver;
12548
12622
  private _positionChangedObserver;
12549
- private _imageUrl;
12623
+ private _titleText;
12624
+ private _titleTextComponent;
12550
12625
  private _contentViewport;
12551
12626
  private _contentDragBehavior;
12552
12627
  private _defaultBehavior;
@@ -12556,21 +12631,42 @@ declare module BABYLON.GUI {
12556
12631
  get defaultBehavior(): DefaultBehavior;
12557
12632
  /** @hidden */
12558
12633
  _gizmo: SlateGizmo;
12559
- protected _backPlate: BABYLON.Mesh;
12634
+ protected _titleBar: BABYLON.Mesh;
12635
+ protected _titleBarTitle: BABYLON.Mesh;
12560
12636
  protected _contentPlate: BABYLON.Mesh;
12561
- protected _followButton: TouchHolographicButton;
12637
+ protected _backPlate: BABYLON.Mesh;
12638
+ /** @hidden */
12639
+ _followButton: TouchHolographicButton;
12562
12640
  protected _closeButton: TouchHolographicButton;
12563
12641
  protected _contentScaleRatio: number;
12564
12642
  /**
12565
- * 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
12566
12662
  */
12567
12663
  set renderingGroupId(id: number);
12568
12664
  get renderingGroupId(): number;
12569
12665
  /**
12570
- * Gets or sets the image url for the button
12666
+ * The title text displayed at the top of the slate
12571
12667
  */
12572
- get imageUrl(): string;
12573
- set imageUrl(value: string);
12668
+ set title(title: string);
12669
+ get title(): string;
12574
12670
  /**
12575
12671
  * Creates a new slate
12576
12672
  * @param name defines the control name
@@ -12582,7 +12678,6 @@ declare module BABYLON.GUI {
12582
12678
  * @param facadeTexture defines the AdvancedDynamicTexture to use
12583
12679
  */
12584
12680
  protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
12585
- private _rebuildContent;
12586
12681
  private _addControl;
12587
12682
  protected _getTypeName(): string;
12588
12683
  /**
@@ -12602,8 +12697,9 @@ declare module BABYLON.GUI {
12602
12697
  _prepareNode(scene: BABYLON.Scene): void;
12603
12698
  /**
12604
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
12605
12701
  */
12606
- resetDefaultAspectAndPose(): void;
12702
+ resetDefaultAspectAndPose(resetAspect?: boolean): void;
12607
12703
  /**
12608
12704
  * Releases all associated resources
12609
12705
  */