babylonjs-gui 5.0.0-beta.1 → 5.0.0-beta.10

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.
@@ -583,7 +583,7 @@ declare module "babylonjs-gui/2D/advancedDynamicTexture" {
583
583
  * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
584
584
  * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
585
585
  */
586
- constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
586
+ constructor(name: string, width?: number, height?: number, scene?: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
587
587
  /**
588
588
  * Get the current class name of the texture useful for serialization or dynamic coding.
589
589
  * @returns "AdvancedDynamicTexture"
@@ -772,6 +772,17 @@ declare module "babylonjs-gui/2D/advancedDynamicTexture" {
772
772
  * @returns a new AdvancedDynamicTexture
773
773
  */
774
774
  static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number, adaptiveScaling?: boolean): AdvancedDynamicTexture;
775
+ /**
776
+ * Scales the texture
777
+ * @param ratio the scale factor to apply to both width and height
778
+ */
779
+ scale(ratio: number): void;
780
+ /**
781
+ * Resizes the texture
782
+ * @param width the new width
783
+ * @param height the new height
784
+ */
785
+ scaleTo(width: number, height: number): void;
775
786
  }
776
787
  }
777
788
  declare module "babylonjs-gui/2D/controls/control" {
@@ -1266,10 +1277,10 @@ declare module "babylonjs-gui/2D/controls/control" {
1266
1277
  /** Gets or sets if control is Enabled */
1267
1278
  get isEnabled(): boolean;
1268
1279
  set isEnabled(value: boolean);
1269
- /** Gets or sets background color of control if it's disabled */
1280
+ /** Gets or sets background color of control if it's disabled. Only applies to Button class. */
1270
1281
  get disabledColor(): string;
1271
1282
  set disabledColor(value: string);
1272
- /** Gets or sets front color of control if it's disabled */
1283
+ /** Gets or sets front color of control if it's disabled. Only applies to Checkbox class. */
1273
1284
  get disabledColorItem(): string;
1274
1285
  set disabledColorItem(value: string);
1275
1286
  /**
@@ -1298,6 +1309,15 @@ declare module "babylonjs-gui/2D/controls/control" {
1298
1309
  * @returns the ascendant or null if not found
1299
1310
  */
1300
1311
  getAscendantOfClass(className: string): Nullable<Control>;
1312
+ /**
1313
+ * Mark control element as dirty
1314
+ * @param force force non visible elements to be marked too
1315
+ */
1316
+ markAsDirty(force: false): void;
1317
+ /**
1318
+ * Mark the element and its children as dirty
1319
+ */
1320
+ markAllAsDirty(): void;
1301
1321
  /** @hidden */
1302
1322
  _resetFontCache(): void;
1303
1323
  /**
@@ -1380,7 +1400,7 @@ declare module "babylonjs-gui/2D/controls/control" {
1380
1400
  /** @hidden */
1381
1401
  _flagDescendantsAsMatrixDirty(): void;
1382
1402
  /** @hidden */
1383
- _intersectsRect(rect: Measure): boolean;
1403
+ _intersectsRect(rect: Measure, context?: ICanvasRenderingContext): boolean;
1384
1404
  /** @hidden */
1385
1405
  protected _computeAdditionnalOffsetX(): number;
1386
1406
  /** @hidden */
@@ -4348,6 +4368,7 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4348
4368
  import { Mesh } from "babylonjs/Meshes/mesh";
4349
4369
  import { TransformNode } from "babylonjs/Meshes/transformNode";
4350
4370
  import { Scene } from "babylonjs/scene";
4371
+ import { Observable } from "babylonjs/Misc/observable";
4351
4372
  import { Button3D } from "babylonjs-gui/3D/controls/button3D";
4352
4373
  /**
4353
4374
  * Class used to create a touchable button in 3D
@@ -4356,6 +4377,13 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4356
4377
  private _collisionMesh;
4357
4378
  private _collidableFrontDirection;
4358
4379
  protected _isNearPressed: boolean;
4380
+ private _isToggleButton;
4381
+ private _toggleState;
4382
+ private _toggleButtonCallback;
4383
+ /**
4384
+ * An event triggered when the button is toggled. Only fired if 'isToggleButton' is true
4385
+ */
4386
+ onToggleObservable: Observable<boolean>;
4359
4387
  /**
4360
4388
  * Creates a new touchable button
4361
4389
  * @param name defines the control name
@@ -4376,6 +4404,19 @@ declare module "babylonjs-gui/3D/controls/touchButton3D" {
4376
4404
  * @param collisionMesh the new collision mesh for the button
4377
4405
  */
4378
4406
  set collisionMesh(collisionMesh: Mesh);
4407
+ /**
4408
+ * Setter for if this TouchButton3D should be treated as a toggle button
4409
+ * @param value If this TouchHolographicButton should act like a toggle button
4410
+ */
4411
+ set isToggleButton(value: boolean);
4412
+ get isToggleButton(): boolean;
4413
+ /**
4414
+ * A public entrypoint to set the toggle state of the TouchHolographicButton. Only works if 'isToggleButton' is true
4415
+ * @param newState The new state to set the TouchHolographicButton's toggle state to
4416
+ */
4417
+ set isToggled(newState: boolean);
4418
+ get isToggled(): boolean;
4419
+ protected _onToggle(newState: boolean): void;
4379
4420
  private _isInteractionInFrontOfButton;
4380
4421
  protected _getInteractionHeight(interactionPos: Vector3, basePos: Vector3): number;
4381
4422
  /** @hidden */
@@ -4768,7 +4809,7 @@ declare module "babylonjs-gui/3D/materials/fluent/fluentMaterial" {
4768
4809
  * @param name defines the name of the material
4769
4810
  * @param scene defines the hosting scene
4770
4811
  */
4771
- constructor(name: string, scene: Scene);
4812
+ constructor(name: string, scene?: Scene);
4772
4813
  needAlphaBlending(): boolean;
4773
4814
  needAlphaTesting(): boolean;
4774
4815
  getAlphaTestTexture(): Nullable<BaseTexture>;
@@ -5055,7 +5096,7 @@ declare module "babylonjs-gui/3D/materials/fluentButton/fluentButtonMaterial" {
5055
5096
  */
5056
5097
  globalRightIndexTipPosition: Vector3;
5057
5098
  private _blobTexture;
5058
- constructor(name: string, scene: Scene);
5099
+ constructor(name: string, scene?: Scene);
5059
5100
  needAlphaBlending(): boolean;
5060
5101
  needAlphaTesting(): boolean;
5061
5102
  getAlphaTestTexture(): Nullable<BaseTexture>;
@@ -5079,6 +5120,7 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5079
5120
  import { TransformNode } from "babylonjs/Meshes/transformNode";
5080
5121
  import { Mesh } from "babylonjs/Meshes/mesh";
5081
5122
  import { Scene } from "babylonjs/scene";
5123
+ import { FluentMaterial } from "babylonjs-gui/3D/materials/fluent/fluentMaterial";
5082
5124
  import { FluentButtonMaterial } from "babylonjs-gui/3D/materials/fluentButton/fluentButtonMaterial";
5083
5125
  import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
5084
5126
  import { TouchButton3D } from "babylonjs-gui/3D/controls/touchButton3D";
@@ -5109,6 +5151,8 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5109
5151
  private _pointerHoverObserver;
5110
5152
  private _frontPlateDepth;
5111
5153
  private _backPlateDepth;
5154
+ private _backplateColor;
5155
+ private _backplateToggledColor;
5112
5156
  private _tooltipFade;
5113
5157
  private _tooltipTextBlock;
5114
5158
  private _tooltipTexture;
@@ -5139,7 +5183,7 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5139
5183
  /**
5140
5184
  * Gets the back material used by this button
5141
5185
  */
5142
- get backMaterial(): StandardMaterial;
5186
+ get backMaterial(): FluentMaterial;
5143
5187
  /**
5144
5188
  * Gets the front material used by this button
5145
5189
  */
@@ -5168,6 +5212,7 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5168
5212
  private _createBackMaterial;
5169
5213
  private _createFrontMaterial;
5170
5214
  private _createPlateMaterial;
5215
+ protected _onToggle(newState: boolean): void;
5171
5216
  protected _affectMaterial(mesh: Mesh): void;
5172
5217
  /**
5173
5218
  * Releases all associated resources
@@ -5175,6 +5220,81 @@ declare module "babylonjs-gui/3D/controls/touchHolographicButton" {
5175
5220
  dispose(): void;
5176
5221
  }
5177
5222
  }
5223
+ declare module "babylonjs-gui/3D/behaviors/defaultBehavior" {
5224
+ import { Behavior } from "babylonjs/Behaviors/behavior";
5225
+ import { FollowBehavior } from "babylonjs/Behaviors/Meshes/followBehavior";
5226
+ import { SixDofDragBehavior } from "babylonjs/Behaviors/Meshes/sixDofDragBehavior";
5227
+ import { Mesh } from "babylonjs/Meshes/mesh";
5228
+ import { Nullable } from "babylonjs/types";
5229
+ import { SurfaceMagnetismBehavior } from "babylonjs/Behaviors/Meshes/surfaceMagnetismBehavior";
5230
+ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5231
+ /**
5232
+ * Default behavior for 3D UI elements.
5233
+ * Handles a FollowBehavior, SixDofBehavior and SurfaceMagnetismBehavior
5234
+ * @since 5.0.0
5235
+ */
5236
+ export class DefaultBehavior implements Behavior<Mesh> {
5237
+ private _scene;
5238
+ private _followBehavior;
5239
+ private _sixDofDragBehavior;
5240
+ private _surfaceMagnetismBehavior;
5241
+ private _onBeforeRenderObserver;
5242
+ private _onDragObserver;
5243
+ /**
5244
+ * Instantiates the default behavior
5245
+ */
5246
+ constructor();
5247
+ /**
5248
+ * Attached node of this behavior
5249
+ */
5250
+ attachedNode: Nullable<Mesh>;
5251
+ /**
5252
+ * The name of the behavior
5253
+ */
5254
+ get name(): string;
5255
+ /**
5256
+ * The follow behavior
5257
+ */
5258
+ get followBehavior(): FollowBehavior;
5259
+ /**
5260
+ * The six DoF drag behavior
5261
+ */
5262
+ get sixDofDragBehavior(): SixDofDragBehavior;
5263
+ /**
5264
+ * The surface magnetism behavior
5265
+ */
5266
+ get surfaceMagnetismBehavior(): SurfaceMagnetismBehavior;
5267
+ /**
5268
+ * Enables the follow behavior
5269
+ */
5270
+ followBehaviorEnabled: boolean;
5271
+ /**
5272
+ * Enables the six DoF drag behavior
5273
+ */
5274
+ sixDofDragBehaviorEnabled: boolean;
5275
+ /**
5276
+ * Enables the surface magnetism behavior
5277
+ */
5278
+ surfaceMagnetismBehaviorEnabled: boolean;
5279
+ /**
5280
+ * Initializes the behavior
5281
+ */
5282
+ init(): void;
5283
+ /**
5284
+ * Attaches the default behavior
5285
+ * @param ownerMesh The top level mesh
5286
+ * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
5287
+ * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
5288
+ */
5289
+ attach(ownerMesh: Mesh, draggablesMeshes?: Mesh[], sceneUnderstandingMeshes?: AbstractMesh[]): void;
5290
+ /**
5291
+ * Detaches the behavior from the mesh
5292
+ */
5293
+ detach(): void;
5294
+ private _addObservables;
5295
+ private _removeObservables;
5296
+ }
5297
+ }
5178
5298
  declare module "babylonjs-gui/3D/materials/handle/shaders/handle.vertex" {
5179
5299
  /** @hidden */
5180
5300
  export var handleVertexShader: {
@@ -5430,81 +5550,6 @@ declare module "babylonjs-gui/3D/gizmos/slateGizmo" {
5430
5550
  dispose(): void;
5431
5551
  }
5432
5552
  }
5433
- declare module "babylonjs-gui/3D/behaviors/defaultBehavior" {
5434
- import { Behavior } from "babylonjs/Behaviors/behavior";
5435
- import { FollowBehavior } from "babylonjs/Behaviors/Meshes/followBehavior";
5436
- import { SixDofDragBehavior } from "babylonjs/Behaviors/Meshes/sixDofDragBehavior";
5437
- import { Mesh } from "babylonjs/Meshes/mesh";
5438
- import { Nullable } from "babylonjs/types";
5439
- import { SurfaceMagnetismBehavior } from "babylonjs/Behaviors/Meshes/surfaceMagnetismBehavior";
5440
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5441
- /**
5442
- * Default behavior for 3D UI elements.
5443
- * Handles a FollowBehavior, SixDofBehavior and SurfaceMagnetismBehavior
5444
- * @since 5.0.0
5445
- */
5446
- export class DefaultBehavior implements Behavior<Mesh> {
5447
- private _scene;
5448
- private _followBehavior;
5449
- private _sixDofDragBehavior;
5450
- private _surfaceMagnetismBehavior;
5451
- private _onBeforeRenderObserver;
5452
- private _onDragObserver;
5453
- /**
5454
- * Instantiates the default behavior
5455
- */
5456
- constructor();
5457
- /**
5458
- * Attached node of this behavior
5459
- */
5460
- attachedNode: Nullable<Mesh>;
5461
- /**
5462
- * The name of the behavior
5463
- */
5464
- get name(): string;
5465
- /**
5466
- * The follow behavior
5467
- */
5468
- get followBehavior(): FollowBehavior;
5469
- /**
5470
- * The six DoF drag behavior
5471
- */
5472
- get sixDofDragBehavior(): SixDofDragBehavior;
5473
- /**
5474
- * The surface magnetism behavior
5475
- */
5476
- get surfaceMagnetismBehavior(): SurfaceMagnetismBehavior;
5477
- /**
5478
- * Enables the follow behavior
5479
- */
5480
- followBehaviorEnabled: boolean;
5481
- /**
5482
- * Enables the six DoF drag behavior
5483
- */
5484
- sixDofDragBehaviorEnabled: boolean;
5485
- /**
5486
- * Enables the surface magnetism behavior
5487
- */
5488
- surfaceMagnetismBehaviorEnabled: boolean;
5489
- /**
5490
- * Initializes the behavior
5491
- */
5492
- init(): void;
5493
- /**
5494
- * Attaches the default behavior
5495
- * @param ownerMesh The top level mesh
5496
- * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
5497
- * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
5498
- */
5499
- attach(ownerMesh: Mesh, draggablesMeshes?: Mesh[], sceneUnderstandingMeshes?: AbstractMesh[]): void;
5500
- /**
5501
- * Detaches the behavior from the mesh
5502
- */
5503
- detach(): void;
5504
- private _addObservables;
5505
- private _removeObservables;
5506
- }
5507
- }
5508
5553
  declare module "babylonjs-gui/3D/materials/fluentBackplate/shaders/fluentBackplate.fragment" {
5509
5554
  /** @hidden */
5510
5555
  export var fluentBackplatePixelShader: {
@@ -5657,7 +5702,7 @@ declare module "babylonjs-gui/3D/materials/fluentBackplate/fluentBackplateMateri
5657
5702
  */
5658
5703
  globalRightIndexTipPosition: Vector3;
5659
5704
  private _globalRightIndexTipPosition4;
5660
- constructor(name: string, scene: Scene);
5705
+ constructor(name: string, scene?: Scene);
5661
5706
  needAlphaBlending(): boolean;
5662
5707
  needAlphaTesting(): boolean;
5663
5708
  getAlphaTestTexture(): Nullable<BaseTexture>;
@@ -5676,16 +5721,16 @@ declare module "babylonjs-gui/3D/materials/fluentBackplate/fluentBackplateMateri
5676
5721
  }
5677
5722
  }
5678
5723
  declare module "babylonjs-gui/3D/controls/holographicSlate" {
5679
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5680
- import { Scene } from "babylonjs/scene";
5681
- import { TransformNode } from "babylonjs/Meshes/transformNode";
5682
- import { Mesh } from "babylonjs/Meshes/mesh";
5683
- import { TouchHolographicButton } from "babylonjs-gui/3D/controls/touchHolographicButton";
5684
- import { Vector3 } from "babylonjs/Maths/math.vector";
5685
5724
  import { ContentDisplay3D } from "babylonjs-gui/3D/controls/contentDisplay3D";
5725
+ import { TouchHolographicButton } from "babylonjs-gui/3D/controls/touchHolographicButton";
5686
5726
  import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
5687
- import { SlateGizmo } from "babylonjs-gui/3D/gizmos/slateGizmo";
5688
5727
  import { DefaultBehavior } from "babylonjs-gui/3D/behaviors/defaultBehavior";
5728
+ import { SlateGizmo } from "babylonjs-gui/3D/gizmos/slateGizmo";
5729
+ import { Vector2, Vector3 } from "babylonjs/Maths/math.vector";
5730
+ import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
5731
+ import { TransformNode } from "babylonjs/Meshes/transformNode";
5732
+ import { Mesh } from "babylonjs/Meshes/mesh";
5733
+ import { Scene } from "babylonjs/scene";
5689
5734
  /**
5690
5735
  * Class used to create a holographic slate
5691
5736
  * @since 5.0.0
@@ -5703,35 +5748,37 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5703
5748
  * File name for the close icon.
5704
5749
  */
5705
5750
  static FOLLOW_ICON_FILENAME: string;
5751
+ private static DEFAULT_TEXT_RESOLUTION_Y;
5706
5752
  /**
5707
- * Dimensions of the slate
5753
+ * 2D dimensions of the slate
5708
5754
  */
5709
- dimensions: Vector3;
5755
+ dimensions: Vector2;
5710
5756
  /**
5711
5757
  * Minimum dimensions of the slate
5712
5758
  */
5713
- minDimensions: Vector3;
5759
+ minDimensions: Vector2;
5714
5760
  /**
5715
5761
  * Default dimensions of the slate
5716
5762
  */
5717
- readonly defaultDimensions: Vector3;
5763
+ readonly defaultDimensions: Vector2;
5718
5764
  /**
5719
- * Dimensions of the backplate
5765
+ * Height of the title bar component
5720
5766
  */
5721
- backplateDimensions: Vector3;
5767
+ titleBarHeight: number;
5722
5768
  /**
5723
- * Margin between backplate and contentplate
5769
+ * Margin between title bar and contentplate
5724
5770
  */
5725
- backPlateMargin: number;
5771
+ titleBarMargin: number;
5726
5772
  /**
5727
5773
  * Origin in local coordinates (top left corner)
5728
5774
  */
5729
5775
  origin: Vector3;
5730
- private _backPlateMaterial;
5776
+ private _titleBarMaterial;
5731
5777
  private _contentMaterial;
5732
5778
  private _pickedPointObserver;
5733
5779
  private _positionChangedObserver;
5734
- private _imageUrl;
5780
+ private _titleText;
5781
+ private _titleTextComponent;
5735
5782
  private _contentViewport;
5736
5783
  private _contentDragBehavior;
5737
5784
  private _defaultBehavior;
@@ -5741,21 +5788,22 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5741
5788
  get defaultBehavior(): DefaultBehavior;
5742
5789
  /** @hidden */
5743
5790
  _gizmo: SlateGizmo;
5744
- protected _backPlate: Mesh;
5791
+ protected _titleBar: Mesh;
5792
+ protected _titleBarTitle: Mesh;
5745
5793
  protected _contentPlate: Mesh;
5746
5794
  protected _followButton: TouchHolographicButton;
5747
5795
  protected _closeButton: TouchHolographicButton;
5748
5796
  protected _contentScaleRatio: number;
5749
5797
  /**
5750
- * Rendering ground id of all the mesh in the button
5798
+ * Rendering ground id of all the meshes
5751
5799
  */
5752
5800
  set renderingGroupId(id: number);
5753
5801
  get renderingGroupId(): number;
5754
5802
  /**
5755
- * Gets or sets the image url for the button
5803
+ * The title text displayed at the top of the slate
5756
5804
  */
5757
- get imageUrl(): string;
5758
- set imageUrl(value: string);
5805
+ set title(title: string);
5806
+ get title(): string;
5759
5807
  /**
5760
5808
  * Creates a new slate
5761
5809
  * @param name defines the control name
@@ -5767,7 +5815,6 @@ declare module "babylonjs-gui/3D/controls/holographicSlate" {
5767
5815
  * @param facadeTexture defines the AdvancedDynamicTexture to use
5768
5816
  */
5769
5817
  protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
5770
- private _rebuildContent;
5771
5818
  private _addControl;
5772
5819
  protected _getTypeName(): string;
5773
5820
  /**
@@ -5931,7 +5978,6 @@ declare module "babylonjs-gui/3D/controls/nearMenu" {
5931
5978
  */
5932
5979
  private static PIN_ICON_FILENAME;
5933
5980
  private _pinButton;
5934
- private _pinMaterial;
5935
5981
  private _dragObserver;
5936
5982
  private _defaultBehavior;
5937
5983
  /**
@@ -6320,7 +6366,7 @@ declare module "babylonjs-gui/3D/materials/mrdl/mrdlSliderBarMaterial" {
6320
6366
  * @hidden
6321
6367
  */
6322
6368
  globalRightIndexMiddlePosition: Vector4;
6323
- constructor(name: string, scene: Scene);
6369
+ constructor(name: string, scene?: Scene);
6324
6370
  needAlphaBlending(): boolean;
6325
6371
  needAlphaTesting(): boolean;
6326
6372
  getAlphaTestTexture(): Nullable<BaseTexture>;
@@ -6669,7 +6715,7 @@ declare module "babylonjs-gui/3D/materials/mrdl/mrdlSliderThumbMaterial" {
6669
6715
  * @hidden
6670
6716
  */
6671
6717
  globalRightIndexMiddlePosition: Vector4;
6672
- constructor(name: string, scene: Scene);
6718
+ constructor(name: string, scene?: Scene);
6673
6719
  needAlphaBlending(): boolean;
6674
6720
  needAlphaTesting(): boolean;
6675
6721
  getAlphaTestTexture(): Nullable<BaseTexture>;
@@ -6832,7 +6878,7 @@ declare module "babylonjs-gui/3D/materials/mrdl/mrdlBackplateMaterial" {
6832
6878
  * Gets or sets the edge width of the backplate.
6833
6879
  */
6834
6880
  edgeLineGradientBlend: number;
6835
- constructor(name: string, scene: Scene);
6881
+ constructor(name: string, scene?: Scene);
6836
6882
  needAlphaBlending(): boolean;
6837
6883
  needAlphaTesting(): boolean;
6838
6884
  getAlphaTestTexture(): Nullable<BaseTexture>;
@@ -6999,43 +7045,6 @@ declare module "babylonjs-gui/3D/controls/touchMeshButton3D" {
6999
7045
  protected _affectMaterial(mesh: AbstractMesh): void;
7000
7046
  }
7001
7047
  }
7002
- declare module "babylonjs-gui/3D/controls/touchToggleButton3D" {
7003
- import { AbstractMesh } from "babylonjs/Meshes/abstractMesh";
7004
- import { Mesh } from "babylonjs/Meshes/mesh";
7005
- import { Observable } from "babylonjs/Misc/observable";
7006
- import { Scene } from "babylonjs/scene";
7007
- import { TransformNode } from "babylonjs/Meshes/transformNode";
7008
- import { Vector3 } from "babylonjs/Maths/math.vector";
7009
- import { TouchButton3D } from "babylonjs-gui/3D/controls/touchButton3D";
7010
- /**
7011
- * Class used as base class for touch-enabled toggleable buttons
7012
- */
7013
- export class TouchToggleButton3D extends TouchButton3D {
7014
- private _isPressed;
7015
- /**
7016
- * An event triggered when the button is toggled on
7017
- */
7018
- onToggleOnObservable: Observable<Vector3>;
7019
- /**
7020
- * An event triggered when the button is toggled off
7021
- */
7022
- onToggleOffObservable: Observable<Vector3>;
7023
- /**
7024
- * Creates a new button
7025
- * @param name defines the control name
7026
- * @param collisionMesh defines the mesh to track near interactions with
7027
- */
7028
- constructor(name?: string, collisionMesh?: Mesh);
7029
- private _onToggle;
7030
- protected _getTypeName(): string;
7031
- protected _createNode(scene: Scene): TransformNode;
7032
- protected _affectMaterial(mesh: AbstractMesh): void;
7033
- /**
7034
- * Releases all associated resources
7035
- */
7036
- dispose(): void;
7037
- }
7038
- }
7039
7048
  declare module "babylonjs-gui/3D/controls/holographicBackplate" {
7040
7049
  import { TransformNode } from "babylonjs/Meshes/transformNode";
7041
7050
  import { Mesh } from "babylonjs/Meshes/mesh";
@@ -7106,7 +7115,6 @@ declare module "babylonjs-gui/3D/controls/index" {
7106
7115
  export * from "babylonjs-gui/3D/controls/touchMeshButton3D";
7107
7116
  export * from "babylonjs-gui/3D/controls/touchHolographicButton";
7108
7117
  export * from "babylonjs-gui/3D/controls/touchHolographicMenu";
7109
- export * from "babylonjs-gui/3D/controls/touchToggleButton3D";
7110
7118
  export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
7111
7119
  export * from "babylonjs-gui/3D/controls/holographicBackplate";
7112
7120
  }
@@ -7721,7 +7729,7 @@ declare module BABYLON.GUI {
7721
7729
  * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
7722
7730
  * @param invertY defines if the texture needs to be inverted on the y axis during loading (true by default)
7723
7731
  */
7724
- constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
7732
+ constructor(name: string, width?: number, height?: number, scene?: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number, invertY?: boolean);
7725
7733
  /**
7726
7734
  * Get the current class name of the texture useful for serialization or dynamic coding.
7727
7735
  * @returns "AdvancedDynamicTexture"
@@ -7910,6 +7918,17 @@ declare module BABYLON.GUI {
7910
7918
  * @returns a new AdvancedDynamicTexture
7911
7919
  */
7912
7920
  static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number, adaptiveScaling?: boolean): AdvancedDynamicTexture;
7921
+ /**
7922
+ * Scales the texture
7923
+ * @param ratio the scale factor to apply to both width and height
7924
+ */
7925
+ scale(ratio: number): void;
7926
+ /**
7927
+ * Resizes the texture
7928
+ * @param width the new width
7929
+ * @param height the new height
7930
+ */
7931
+ scaleTo(width: number, height: number): void;
7913
7932
  }
7914
7933
  }
7915
7934
  declare module BABYLON.GUI {
@@ -8391,10 +8410,10 @@ declare module BABYLON.GUI {
8391
8410
  /** Gets or sets if control is Enabled */
8392
8411
  get isEnabled(): boolean;
8393
8412
  set isEnabled(value: boolean);
8394
- /** Gets or sets background color of control if it's disabled */
8413
+ /** Gets or sets background color of control if it's disabled. Only applies to Button class. */
8395
8414
  get disabledColor(): string;
8396
8415
  set disabledColor(value: string);
8397
- /** Gets or sets front color of control if it's disabled */
8416
+ /** Gets or sets front color of control if it's disabled. Only applies to Checkbox class. */
8398
8417
  get disabledColorItem(): string;
8399
8418
  set disabledColorItem(value: string);
8400
8419
  /**
@@ -8423,6 +8442,15 @@ declare module BABYLON.GUI {
8423
8442
  * @returns the ascendant or null if not found
8424
8443
  */
8425
8444
  getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
8445
+ /**
8446
+ * Mark control element as dirty
8447
+ * @param force force non visible elements to be marked too
8448
+ */
8449
+ markAsDirty(force: false): void;
8450
+ /**
8451
+ * Mark the element and its children as dirty
8452
+ */
8453
+ markAllAsDirty(): void;
8426
8454
  /** @hidden */
8427
8455
  _resetFontCache(): void;
8428
8456
  /**
@@ -8505,7 +8533,7 @@ declare module BABYLON.GUI {
8505
8533
  /** @hidden */
8506
8534
  _flagDescendantsAsMatrixDirty(): void;
8507
8535
  /** @hidden */
8508
- _intersectsRect(rect: Measure): boolean;
8536
+ _intersectsRect(rect: Measure, context?: BABYLON.ICanvasRenderingContext): boolean;
8509
8537
  /** @hidden */
8510
8538
  protected _computeAdditionnalOffsetX(): number;
8511
8539
  /** @hidden */
@@ -11254,6 +11282,13 @@ declare module BABYLON.GUI {
11254
11282
  private _collisionMesh;
11255
11283
  private _collidableFrontDirection;
11256
11284
  protected _isNearPressed: boolean;
11285
+ private _isToggleButton;
11286
+ private _toggleState;
11287
+ private _toggleButtonCallback;
11288
+ /**
11289
+ * An event triggered when the button is toggled. Only fired if 'isToggleButton' is true
11290
+ */
11291
+ onToggleObservable: BABYLON.Observable<boolean>;
11257
11292
  /**
11258
11293
  * Creates a new touchable button
11259
11294
  * @param name defines the control name
@@ -11274,6 +11309,19 @@ declare module BABYLON.GUI {
11274
11309
  * @param collisionMesh the new collision mesh for the button
11275
11310
  */
11276
11311
  set collisionMesh(collisionMesh: BABYLON.Mesh);
11312
+ /**
11313
+ * Setter for if this TouchButton3D should be treated as a toggle button
11314
+ * @param value If this TouchHolographicButton should act like a toggle button
11315
+ */
11316
+ set isToggleButton(value: boolean);
11317
+ get isToggleButton(): boolean;
11318
+ /**
11319
+ * A public entrypoint to set the toggle state of the TouchHolographicButton. Only works if 'isToggleButton' is true
11320
+ * @param newState The new state to set the TouchHolographicButton's toggle state to
11321
+ */
11322
+ set isToggled(newState: boolean);
11323
+ get isToggled(): boolean;
11324
+ protected _onToggle(newState: boolean): void;
11277
11325
  private _isInteractionInFrontOfButton;
11278
11326
  protected _getInteractionHeight(interactionPos: BABYLON.Vector3, basePos: BABYLON.Vector3): number;
11279
11327
  /** @hidden */
@@ -11630,7 +11678,7 @@ declare module BABYLON.GUI {
11630
11678
  * @param name defines the name of the material
11631
11679
  * @param scene defines the hosting scene
11632
11680
  */
11633
- constructor(name: string, scene: BABYLON.Scene);
11681
+ constructor(name: string, scene?: BABYLON.Scene);
11634
11682
  needAlphaBlending(): boolean;
11635
11683
  needAlphaTesting(): boolean;
11636
11684
  getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
@@ -11897,7 +11945,7 @@ declare module BABYLON.GUI {
11897
11945
  */
11898
11946
  globalRightIndexTipPosition: BABYLON.Vector3;
11899
11947
  private _blobTexture;
11900
- constructor(name: string, scene: BABYLON.Scene);
11948
+ constructor(name: string, scene?: BABYLON.Scene);
11901
11949
  needAlphaBlending(): boolean;
11902
11950
  needAlphaTesting(): boolean;
11903
11951
  getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
@@ -11943,6 +11991,8 @@ declare module BABYLON.GUI {
11943
11991
  private _pointerHoverObserver;
11944
11992
  private _frontPlateDepth;
11945
11993
  private _backPlateDepth;
11994
+ private _backplateColor;
11995
+ private _backplateToggledColor;
11946
11996
  private _tooltipFade;
11947
11997
  private _tooltipTextBlock;
11948
11998
  private _tooltipTexture;
@@ -11973,7 +12023,7 @@ declare module BABYLON.GUI {
11973
12023
  /**
11974
12024
  * Gets the back material used by this button
11975
12025
  */
11976
- get backMaterial(): BABYLON.StandardMaterial;
12026
+ get backMaterial(): FluentMaterial;
11977
12027
  /**
11978
12028
  * Gets the front material used by this button
11979
12029
  */
@@ -12002,6 +12052,7 @@ declare module BABYLON.GUI {
12002
12052
  private _createBackMaterial;
12003
12053
  private _createFrontMaterial;
12004
12054
  private _createPlateMaterial;
12055
+ protected _onToggle(newState: boolean): void;
12005
12056
  protected _affectMaterial(mesh: BABYLON.Mesh): void;
12006
12057
  /**
12007
12058
  * Releases all associated resources
@@ -12009,6 +12060,74 @@ declare module BABYLON.GUI {
12009
12060
  dispose(): void;
12010
12061
  }
12011
12062
  }
12063
+ declare module BABYLON.GUI {
12064
+ /**
12065
+ * Default behavior for 3D UI elements.
12066
+ * Handles a BABYLON.FollowBehavior, SixDofBehavior and BABYLON.SurfaceMagnetismBehavior
12067
+ * @since 5.0.0
12068
+ */
12069
+ export class DefaultBehavior implements BABYLON.Behavior<BABYLON.Mesh> {
12070
+ private _scene;
12071
+ private _followBehavior;
12072
+ private _sixDofDragBehavior;
12073
+ private _surfaceMagnetismBehavior;
12074
+ private _onBeforeRenderObserver;
12075
+ private _onDragObserver;
12076
+ /**
12077
+ * Instantiates the default behavior
12078
+ */
12079
+ constructor();
12080
+ /**
12081
+ * Attached node of this behavior
12082
+ */
12083
+ attachedNode: BABYLON.Nullable<BABYLON.Mesh>;
12084
+ /**
12085
+ * The name of the behavior
12086
+ */
12087
+ get name(): string;
12088
+ /**
12089
+ * The follow behavior
12090
+ */
12091
+ get followBehavior(): BABYLON.FollowBehavior;
12092
+ /**
12093
+ * The six DoF drag behavior
12094
+ */
12095
+ get sixDofDragBehavior(): BABYLON.SixDofDragBehavior;
12096
+ /**
12097
+ * The surface magnetism behavior
12098
+ */
12099
+ get surfaceMagnetismBehavior(): BABYLON.SurfaceMagnetismBehavior;
12100
+ /**
12101
+ * Enables the follow behavior
12102
+ */
12103
+ followBehaviorEnabled: boolean;
12104
+ /**
12105
+ * Enables the six DoF drag behavior
12106
+ */
12107
+ sixDofDragBehaviorEnabled: boolean;
12108
+ /**
12109
+ * Enables the surface magnetism behavior
12110
+ */
12111
+ surfaceMagnetismBehaviorEnabled: boolean;
12112
+ /**
12113
+ * Initializes the behavior
12114
+ */
12115
+ init(): void;
12116
+ /**
12117
+ * Attaches the default behavior
12118
+ * @param ownerMesh The top level mesh
12119
+ * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
12120
+ * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
12121
+ */
12122
+ attach(ownerMesh: BABYLON.Mesh, draggablesMeshes?: BABYLON.Mesh[], sceneUnderstandingMeshes?: BABYLON.AbstractMesh[]): void;
12123
+ /**
12124
+ * Detaches the behavior from the mesh
12125
+ */
12126
+ detach(): void;
12127
+ private _addObservables;
12128
+ private _removeObservables;
12129
+ }
12130
+ }
12012
12131
  declare module BABYLON.GUI {
12013
12132
  /** @hidden */
12014
12133
  export var handleVertexShader: {
@@ -12247,74 +12366,6 @@ declare module BABYLON.GUI {
12247
12366
  dispose(): void;
12248
12367
  }
12249
12368
  }
12250
- declare module BABYLON.GUI {
12251
- /**
12252
- * Default behavior for 3D UI elements.
12253
- * Handles a BABYLON.FollowBehavior, SixDofBehavior and BABYLON.SurfaceMagnetismBehavior
12254
- * @since 5.0.0
12255
- */
12256
- export class DefaultBehavior implements BABYLON.Behavior<BABYLON.Mesh> {
12257
- private _scene;
12258
- private _followBehavior;
12259
- private _sixDofDragBehavior;
12260
- private _surfaceMagnetismBehavior;
12261
- private _onBeforeRenderObserver;
12262
- private _onDragObserver;
12263
- /**
12264
- * Instantiates the default behavior
12265
- */
12266
- constructor();
12267
- /**
12268
- * Attached node of this behavior
12269
- */
12270
- attachedNode: BABYLON.Nullable<BABYLON.Mesh>;
12271
- /**
12272
- * The name of the behavior
12273
- */
12274
- get name(): string;
12275
- /**
12276
- * The follow behavior
12277
- */
12278
- get followBehavior(): BABYLON.FollowBehavior;
12279
- /**
12280
- * The six DoF drag behavior
12281
- */
12282
- get sixDofDragBehavior(): BABYLON.SixDofDragBehavior;
12283
- /**
12284
- * The surface magnetism behavior
12285
- */
12286
- get surfaceMagnetismBehavior(): BABYLON.SurfaceMagnetismBehavior;
12287
- /**
12288
- * Enables the follow behavior
12289
- */
12290
- followBehaviorEnabled: boolean;
12291
- /**
12292
- * Enables the six DoF drag behavior
12293
- */
12294
- sixDofDragBehaviorEnabled: boolean;
12295
- /**
12296
- * Enables the surface magnetism behavior
12297
- */
12298
- surfaceMagnetismBehaviorEnabled: boolean;
12299
- /**
12300
- * Initializes the behavior
12301
- */
12302
- init(): void;
12303
- /**
12304
- * Attaches the default behavior
12305
- * @param ownerMesh The top level mesh
12306
- * @param draggablesMeshes Descendant meshes that can be used for dragging the owner mesh
12307
- * @param sceneUnderstandingMeshes Meshes from the scene understanding that will be used for surface magnetism
12308
- */
12309
- attach(ownerMesh: BABYLON.Mesh, draggablesMeshes?: BABYLON.Mesh[], sceneUnderstandingMeshes?: BABYLON.AbstractMesh[]): void;
12310
- /**
12311
- * Detaches the behavior from the mesh
12312
- */
12313
- detach(): void;
12314
- private _addObservables;
12315
- private _removeObservables;
12316
- }
12317
- }
12318
12369
  declare module BABYLON.GUI {
12319
12370
  /** @hidden */
12320
12371
  export var fluentBackplatePixelShader: {
@@ -12455,7 +12506,7 @@ declare module BABYLON.GUI {
12455
12506
  */
12456
12507
  globalRightIndexTipPosition: BABYLON.Vector3;
12457
12508
  private _globalRightIndexTipPosition4;
12458
- constructor(name: string, scene: BABYLON.Scene);
12509
+ constructor(name: string, scene?: BABYLON.Scene);
12459
12510
  needAlphaBlending(): boolean;
12460
12511
  needAlphaTesting(): boolean;
12461
12512
  getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
@@ -12491,35 +12542,37 @@ declare module BABYLON.GUI {
12491
12542
  * File name for the close icon.
12492
12543
  */
12493
12544
  static FOLLOW_ICON_FILENAME: string;
12545
+ private static DEFAULT_TEXT_RESOLUTION_Y;
12494
12546
  /**
12495
- * Dimensions of the slate
12547
+ * 2D dimensions of the slate
12496
12548
  */
12497
- dimensions: BABYLON.Vector3;
12549
+ dimensions: BABYLON.Vector2;
12498
12550
  /**
12499
12551
  * Minimum dimensions of the slate
12500
12552
  */
12501
- minDimensions: BABYLON.Vector3;
12553
+ minDimensions: BABYLON.Vector2;
12502
12554
  /**
12503
12555
  * Default dimensions of the slate
12504
12556
  */
12505
- readonly defaultDimensions: BABYLON.Vector3;
12557
+ readonly defaultDimensions: BABYLON.Vector2;
12506
12558
  /**
12507
- * Dimensions of the backplate
12559
+ * Height of the title bar component
12508
12560
  */
12509
- backplateDimensions: BABYLON.Vector3;
12561
+ titleBarHeight: number;
12510
12562
  /**
12511
- * Margin between backplate and contentplate
12563
+ * Margin between title bar and contentplate
12512
12564
  */
12513
- backPlateMargin: number;
12565
+ titleBarMargin: number;
12514
12566
  /**
12515
12567
  * Origin in local coordinates (top left corner)
12516
12568
  */
12517
12569
  origin: BABYLON.Vector3;
12518
- private _backPlateMaterial;
12570
+ private _titleBarMaterial;
12519
12571
  private _contentMaterial;
12520
12572
  private _pickedPointObserver;
12521
12573
  private _positionChangedObserver;
12522
- private _imageUrl;
12574
+ private _titleText;
12575
+ private _titleTextComponent;
12523
12576
  private _contentViewport;
12524
12577
  private _contentDragBehavior;
12525
12578
  private _defaultBehavior;
@@ -12529,21 +12582,22 @@ declare module BABYLON.GUI {
12529
12582
  get defaultBehavior(): DefaultBehavior;
12530
12583
  /** @hidden */
12531
12584
  _gizmo: SlateGizmo;
12532
- protected _backPlate: BABYLON.Mesh;
12585
+ protected _titleBar: BABYLON.Mesh;
12586
+ protected _titleBarTitle: BABYLON.Mesh;
12533
12587
  protected _contentPlate: BABYLON.Mesh;
12534
12588
  protected _followButton: TouchHolographicButton;
12535
12589
  protected _closeButton: TouchHolographicButton;
12536
12590
  protected _contentScaleRatio: number;
12537
12591
  /**
12538
- * Rendering ground id of all the mesh in the button
12592
+ * Rendering ground id of all the meshes
12539
12593
  */
12540
12594
  set renderingGroupId(id: number);
12541
12595
  get renderingGroupId(): number;
12542
12596
  /**
12543
- * Gets or sets the image url for the button
12597
+ * The title text displayed at the top of the slate
12544
12598
  */
12545
- get imageUrl(): string;
12546
- set imageUrl(value: string);
12599
+ set title(title: string);
12600
+ get title(): string;
12547
12601
  /**
12548
12602
  * Creates a new slate
12549
12603
  * @param name defines the control name
@@ -12555,7 +12609,6 @@ declare module BABYLON.GUI {
12555
12609
  * @param facadeTexture defines the AdvancedDynamicTexture to use
12556
12610
  */
12557
12611
  protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
12558
- private _rebuildContent;
12559
12612
  private _addControl;
12560
12613
  protected _getTypeName(): string;
12561
12614
  /**
@@ -12693,7 +12746,6 @@ declare module BABYLON.GUI {
12693
12746
  */
12694
12747
  private static PIN_ICON_FILENAME;
12695
12748
  private _pinButton;
12696
- private _pinMaterial;
12697
12749
  private _dragObserver;
12698
12750
  private _defaultBehavior;
12699
12751
  /**
@@ -13062,7 +13114,7 @@ declare module BABYLON.GUI {
13062
13114
  * @hidden
13063
13115
  */
13064
13116
  globalRightIndexMiddlePosition: BABYLON.Vector4;
13065
- constructor(name: string, scene: BABYLON.Scene);
13117
+ constructor(name: string, scene?: BABYLON.Scene);
13066
13118
  needAlphaBlending(): boolean;
13067
13119
  needAlphaTesting(): boolean;
13068
13120
  getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
@@ -13398,7 +13450,7 @@ declare module BABYLON.GUI {
13398
13450
  * @hidden
13399
13451
  */
13400
13452
  globalRightIndexMiddlePosition: BABYLON.Vector4;
13401
- constructor(name: string, scene: BABYLON.Scene);
13453
+ constructor(name: string, scene?: BABYLON.Scene);
13402
13454
  needAlphaBlending(): boolean;
13403
13455
  needAlphaTesting(): boolean;
13404
13456
  getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
@@ -13549,7 +13601,7 @@ declare module BABYLON.GUI {
13549
13601
  * Gets or sets the edge width of the backplate.
13550
13602
  */
13551
13603
  edgeLineGradientBlend: number;
13552
- constructor(name: string, scene: BABYLON.Scene);
13604
+ constructor(name: string, scene?: BABYLON.Scene);
13553
13605
  needAlphaBlending(): boolean;
13554
13606
  needAlphaTesting(): boolean;
13555
13607
  getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
@@ -13697,36 +13749,6 @@ declare module BABYLON.GUI {
13697
13749
  protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
13698
13750
  }
13699
13751
  }
13700
- declare module BABYLON.GUI {
13701
- /**
13702
- * Class used as base class for touch-enabled toggleable buttons
13703
- */
13704
- export class TouchToggleButton3D extends TouchButton3D {
13705
- private _isPressed;
13706
- /**
13707
- * An event triggered when the button is toggled on
13708
- */
13709
- onToggleOnObservable: BABYLON.Observable<BABYLON.Vector3>;
13710
- /**
13711
- * An event triggered when the button is toggled off
13712
- */
13713
- onToggleOffObservable: BABYLON.Observable<BABYLON.Vector3>;
13714
- /**
13715
- * Creates a new button
13716
- * @param name defines the control name
13717
- * @param collisionMesh defines the mesh to track near interactions with
13718
- */
13719
- constructor(name?: string, collisionMesh?: BABYLON.Mesh);
13720
- private _onToggle;
13721
- protected _getTypeName(): string;
13722
- protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
13723
- protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
13724
- /**
13725
- * Releases all associated resources
13726
- */
13727
- dispose(): void;
13728
- }
13729
- }
13730
13752
  declare module BABYLON.GUI {
13731
13753
  /**
13732
13754
  * Class used to create a holographic backplate in 3D