/
babylon.gui.d.ts
3575 lines (3575 loc) · 142 KB
/
babylon.gui.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
declare module BABYLON.GUI {
/**
* Class used to specific a value and its associated unit
*/
export class ValueAndUnit {
/** defines the unit to store */
unit: number;
/** defines a boolean indicating if the value can be negative */
negativeValueAllowed: boolean;
private _value;
private _originalUnit;
/**
* Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
* @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
*/
ignoreAdaptiveScaling: boolean;
/**
* Creates a new ValueAndUnit
* @param value defines the value to store
* @param unit defines the unit to store
* @param negativeValueAllowed defines a boolean indicating if the value can be negative
*/
constructor(value: number,
/** defines the unit to store */
unit?: number,
/** defines a boolean indicating if the value can be negative */
negativeValueAllowed?: boolean);
/** Gets a boolean indicating if the value is a percentage */
readonly isPercentage: boolean;
/** Gets a boolean indicating if the value is store as pixel */
readonly isPixel: boolean;
/** Gets direct internal value */
readonly internalValue: number;
/**
* Gets value as pixel
* @param host defines the root host
* @param refValue defines the reference value for percentages
* @returns the value as pixel
*/
getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
/**
* Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
* @param value defines the value to store
* @param unit defines the unit to store
* @returns the current ValueAndUnit
*/
updateInPlace(value: number, unit?: number): ValueAndUnit;
/**
* Gets the value accordingly to its unit
* @param host defines the root host
* @returns the value
*/
getValue(host: AdvancedDynamicTexture): number;
/**
* Gets a string representation of the value
* @param host defines the root host
* @returns a string
*/
toString(host: AdvancedDynamicTexture): string;
/**
* Store a value parsed from a string
* @param source defines the source string
* @returns true if the value was successfully parsed
*/
fromString(source: string | number): boolean;
private static _Regex;
private static _UNITMODE_PERCENTAGE;
private static _UNITMODE_PIXEL;
/** UNITMODE_PERCENTAGE */
static readonly UNITMODE_PERCENTAGE: number;
/** UNITMODE_PIXEL */
static readonly UNITMODE_PIXEL: number;
}
}
declare module BABYLON.GUI {
/**
* Define a style used by control to automatically setup properties based on a template.
* Only support font related properties so far
*/
export class Style implements BABYLON.IDisposable {
private _fontFamily;
private _fontStyle;
private _fontWeight;
/** @hidden */
_host: AdvancedDynamicTexture;
/** @hidden */
_fontSize: ValueAndUnit;
/**
* BABYLON.Observable raised when the style values are changed
*/
onChangedObservable: BABYLON.Observable<Style>;
/**
* Creates a new style object
* @param host defines the AdvancedDynamicTexture which hosts this style
*/
constructor(host: AdvancedDynamicTexture);
/**
* Gets or sets the font size
*/
fontSize: string | number;
/**
* Gets or sets the font family
*/
fontFamily: string;
/**
* Gets or sets the font style
*/
fontStyle: string;
/** Gets or sets font weight */
fontWeight: string;
/** Dispose all associated resources */
dispose(): void;
}
}
declare module BABYLON.GUI {
/**
* Class used to transport BABYLON.Vector2 information for pointer events
*/
export class Vector2WithInfo extends BABYLON.Vector2 {
/** defines the current mouse button index */
buttonIndex: number;
/**
* Creates a new Vector2WithInfo
* @param source defines the vector2 data to transport
* @param buttonIndex defines the current mouse button index
*/
constructor(source: BABYLON.Vector2,
/** defines the current mouse button index */
buttonIndex?: number);
}
/** Class used to provide 2D matrix features */
export class Matrix2D {
/** Gets the internal array of 6 floats used to store matrix data */
m: Float32Array;
/**
* Creates a new matrix
* @param m00 defines value for (0, 0)
* @param m01 defines value for (0, 1)
* @param m10 defines value for (1, 0)
* @param m11 defines value for (1, 1)
* @param m20 defines value for (2, 0)
* @param m21 defines value for (2, 1)
*/
constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
/**
* Fills the matrix from direct values
* @param m00 defines value for (0, 0)
* @param m01 defines value for (0, 1)
* @param m10 defines value for (1, 0)
* @param m11 defines value for (1, 1)
* @param m20 defines value for (2, 0)
* @param m21 defines value for (2, 1)
* @returns the current modified matrix
*/
fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
/**
* Gets matrix determinant
* @returns the determinant
*/
determinant(): number;
/**
* Inverses the matrix and stores it in a target matrix
* @param result defines the target matrix
* @returns the current matrix
*/
invertToRef(result: Matrix2D): Matrix2D;
/**
* Multiplies the current matrix with another one
* @param other defines the second operand
* @param result defines the target matrix
* @returns the current matrix
*/
multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
/**
* Applies the current matrix to a set of 2 floats and stores the result in a vector2
* @param x defines the x coordinate to transform
* @param y defines the x coordinate to transform
* @param result defines the target vector2
* @returns the current matrix
*/
transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
/**
* Creates an identity matrix
* @returns a new matrix
*/
static Identity(): Matrix2D;
/**
* Creates a translation matrix and stores it in a target matrix
* @param x defines the x coordinate of the translation
* @param y defines the y coordinate of the translation
* @param result defines the target matrix
*/
static TranslationToRef(x: number, y: number, result: Matrix2D): void;
/**
* Creates a scaling matrix and stores it in a target matrix
* @param x defines the x coordinate of the scaling
* @param y defines the y coordinate of the scaling
* @param result defines the target matrix
*/
static ScalingToRef(x: number, y: number, result: Matrix2D): void;
/**
* Creates a rotation matrix and stores it in a target matrix
* @param angle defines the rotation angle
* @param result defines the target matrix
*/
static RotationToRef(angle: number, result: Matrix2D): void;
private static _TempPreTranslationMatrix;
private static _TempPostTranslationMatrix;
private static _TempRotationMatrix;
private static _TempScalingMatrix;
private static _TempCompose0;
private static _TempCompose1;
private static _TempCompose2;
/**
* Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
* @param tx defines the x coordinate of the translation
* @param ty defines the y coordinate of the translation
* @param angle defines the rotation angle
* @param scaleX defines the x coordinate of the scaling
* @param scaleY defines the y coordinate of the scaling
* @param parentMatrix defines the parent matrix to multiply by (can be null)
* @param result defines the target matrix
*/
static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
}
}
declare module BABYLON.GUI {
/**
* Class used to store 2D control sizes
*/
export class Measure {
/** defines left coordinate */
left: number;
/** defines top coordinate */
top: number;
/** defines width dimension */
width: number;
/** defines height dimension */
height: number;
/**
* Creates a new measure
* @param left defines left coordinate
* @param top defines top coordinate
* @param width defines width dimension
* @param height defines height dimension
*/
constructor(
/** defines left coordinate */
left: number,
/** defines top coordinate */
top: number,
/** defines width dimension */
width: number,
/** defines height dimension */
height: number);
/**
* Copy from another measure
* @param other defines the other measure to copy from
*/
copyFrom(other: Measure): void;
/**
* Copy from a group of 4 floats
* @param left defines left coordinate
* @param top defines top coordinate
* @param width defines width dimension
* @param height defines height dimension
*/
copyFromFloats(left: number, top: number, width: number, height: number): void;
/**
* Computes the axis aligned bounding box measure for two given measures
* @param a Input measure
* @param b Input measure
* @param result the resulting bounding measure
*/
static CombineToRef(a: Measure, b: Measure, result: Measure): void;
/**
* Computes the axis aligned bounding box of the measure after it is modified by a given transform
* @param transform the matrix to transform the measure before computing the AABB
* @param result the resulting AABB
*/
transformToRef(transform: Matrix2D, result: Measure): void;
/**
* Check equality between this measure and another one
* @param other defines the other measures
* @returns true if both measures are equals
*/
isEqualsTo(other: Measure): boolean;
/**
* Creates an empty measure
* @returns a new measure
*/
static Empty(): Measure;
}
}
declare module BABYLON.GUI {
/**
* Interface used to define a control that can receive focus
*/
export interface IFocusableControl {
/**
* Function called when the control receives the focus
*/
onFocus(): void;
/**
* Function called when the control loses the focus
*/
onBlur(): void;
/**
* Function called to let the control handle keyboard events
* @param evt defines the current keyboard event
*/
processKeyboard(evt: KeyboardEvent): void;
/**
* Function called to get the list of controls that should not steal the focus from this control
* @returns an array of controls
*/
keepsFocusWith(): BABYLON.Nullable<Control[]>;
}
/**
* Class used to create texture to support 2D GUI elements
* @see http://doc.babylonjs.com/how_to/gui
*/
export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
private _isDirty;
private _renderObserver;
private _resizeObserver;
private _preKeyboardObserver;
private _pointerMoveObserver;
private _pointerObserver;
private _canvasPointerOutObserver;
private _background;
/** @hidden */
_rootContainer: Container;
/** @hidden */
_lastPickedControl: Control;
/** @hidden */
_lastControlOver: {
[pointerId: number]: Control;
};
/** @hidden */
_lastControlDown: {
[pointerId: number]: Control;
};
/** @hidden */
_capturingControl: {
[pointerId: number]: Control;
};
/** @hidden */
_shouldBlockPointer: boolean;
/** @hidden */
_layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
/** @hidden */
_linkedControls: Control[];
private _isFullscreen;
private _fullscreenViewport;
private _idealWidth;
private _idealHeight;
private _useSmallestIdeal;
private _renderAtIdealSize;
private _focusedControl;
private _blockNextFocusCheck;
private _renderScale;
private _rootCanvas;
/**
* Define type to string to ensure compatibility across browsers
* Safari doesn't support DataTransfer constructor
*/
private _clipboardData;
/**
* BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
*/
onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
/**
* BABYLON.Observable event triggered each time a pointer down is intercepted by a control
*/
onControlPickedObservable: BABYLON.Observable<Control>;
/**
* BABYLON.Observable event triggered before layout is evaluated
*/
onBeginLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
/**
* BABYLON.Observable event triggered after the layout was evaluated
*/
onEndLayoutObservable: BABYLON.Observable<AdvancedDynamicTexture>;
/**
* BABYLON.Observable event triggered before the texture is rendered
*/
onBeginRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
/**
* BABYLON.Observable event triggered after the texture was rendered
*/
onEndRenderObservable: BABYLON.Observable<AdvancedDynamicTexture>;
/**
* Gets or sets a boolean defining if alpha is stored as premultiplied
*/
premulAlpha: boolean;
/**
* Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
* Useful when you want more antialiasing
*/
renderScale: number;
/** Gets or sets the background color */
background: string;
/**
* Gets or sets the ideal width used to design controls.
* The GUI will then rescale everything accordingly
* @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
*/
idealWidth: number;
/**
* Gets or sets the ideal height used to design controls.
* The GUI will then rescale everything accordingly
* @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
*/
idealHeight: number;
/**
* Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
* @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
*/
useSmallestIdeal: boolean;
/**
* Gets or sets a boolean indicating if adaptive scaling must be used
* @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
*/
renderAtIdealSize: boolean;
/**
* Gets the underlying layer used to render the texture when in fullscreen mode
*/
readonly layer: BABYLON.Nullable<BABYLON.Layer>;
/**
* Gets the root container control
*/
readonly rootContainer: Container;
/**
* Returns an array containing the root container.
* This is mostly used to let the Inspector introspects the ADT
* @returns an array containing the rootContainer
*/
getChildren(): Array<Container>;
/**
* Will return all controls that are inside this texture
* @param directDescendantsOnly defines if true only direct descendants of 'this' will be considered, if false direct and also indirect (children of children, an so on in a recursive manner) descendants of 'this' will be considered
* @param predicate defines an optional predicate that will be called on every evaluated child, the predicate must return true for a given child to be part of the result, otherwise it will be ignored
* @return all child controls
*/
getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
/**
* Gets or sets the current focused control
*/
focusedControl: BABYLON.Nullable<IFocusableControl>;
/**
* Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
*/
isForeground: boolean;
/**
* Gets or set information about clipboardData
*/
clipboardData: string;
/**
* Creates a new AdvancedDynamicTexture
* @param name defines the name of the texture
* @param width defines the width of the texture
* @param height defines the height of the texture
* @param scene defines the hosting scene
* @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
* @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
*/
constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
/**
* Get the current class name of the texture useful for serialization or dynamic coding.
* @returns "AdvancedDynamicTexture"
*/
getClassName(): string;
/**
* Function used to execute a function on all controls
* @param func defines the function to execute
* @param container defines the container where controls belong. If null the root container will be used
*/
executeOnAllControls(func: (control: Control) => void, container?: Container): void;
private _useInvalidateRectOptimization;
/**
* Gets or sets a boolean indicating if the InvalidateRect optimization should be turned on
*/
useInvalidateRectOptimization: boolean;
private _invalidatedRectangle;
/**
* Invalidates a rectangle area on the gui texture
* @param invalidMinX left most position of the rectangle to invalidate in the texture
* @param invalidMinY top most position of the rectangle to invalidate in the texture
* @param invalidMaxX right most position of the rectangle to invalidate in the texture
* @param invalidMaxY bottom most position of the rectangle to invalidate in the texture
*/
invalidateRect(invalidMinX: number, invalidMinY: number, invalidMaxX: number, invalidMaxY: number): void;
/**
* Marks the texture as dirty forcing a complete update
*/
markAsDirty(): void;
/**
* Helper function used to create a new style
* @returns a new style
* @see http://doc.babylonjs.com/how_to/gui#styles
*/
createStyle(): Style;
/**
* Adds a new control to the root container
* @param control defines the control to add
* @returns the current texture
*/
addControl(control: Control): AdvancedDynamicTexture;
/**
* Removes a control from the root container
* @param control defines the control to remove
* @returns the current texture
*/
removeControl(control: Control): AdvancedDynamicTexture;
/**
* Release all resources
*/
dispose(): void;
private _onResize;
/** @hidden */
_getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
/**
* Get screen coordinates for a vector3
* @param position defines the position to project
* @param worldMatrix defines the world matrix to use
* @returns the projected position
*/
getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
private _checkUpdate;
private _clearMeasure;
private _render;
/** @hidden */
_changeCursor(cursor: string): void;
/** @hidden */
_registerLastControlDown(control: Control, pointerId: number): void;
private _doPicking;
/** @hidden */
_cleanControlAfterRemovalFromList(list: {
[pointerId: number]: Control;
}, control: Control): void;
/** @hidden */
_cleanControlAfterRemoval(control: Control): void;
/** Attach to all scene events required to support pointer events */
attach(): void;
/** @hidden */
private onClipboardCopy;
/** @hidden */
private onClipboardCut;
/** @hidden */
private onClipboardPaste;
/**
* Register the clipboard Events onto the canvas
*/
registerClipboardEvents(): void;
/**
* Unregister the clipboard Events from the canvas
*/
unRegisterClipboardEvents(): void;
/**
* Connect the texture to a hosting mesh to enable interactions
* @param mesh defines the mesh to attach to
* @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
*/
attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
/**
* Move the focus to a specific control
* @param control defines the control which will receive the focus
*/
moveFocusToControl(control: IFocusableControl): void;
private _manageFocus;
private _attachToOnPointerOut;
/**
* Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
* @param mesh defines the mesh which will receive the texture
* @param width defines the texture width (1024 by default)
* @param height defines the texture height (1024 by default)
* @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
* @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
* @returns a new AdvancedDynamicTexture
*/
static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
/**
* Creates a new AdvancedDynamicTexture in fullscreen mode.
* In this mode the texture will rely on a layer for its rendering.
* This allows it to be treated like any other layer.
* As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
* LayerMask is set through advancedTexture.layer.layerMask
* @param name defines name for the texture
* @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
* @param scene defines the hsoting scene
* @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
* @returns a new AdvancedDynamicTexture
*/
static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
}
}
declare module BABYLON.GUI {
/**
* Root class used for all 2D controls
* @see http://doc.babylonjs.com/how_to/gui#controls
*/
export class Control {
/** defines the name of the control */
name?: string | undefined;
/**
* Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
*/
static AllowAlphaInheritance: boolean;
private _alpha;
private _alphaSet;
private _zIndex;
/** @hidden */
_host: AdvancedDynamicTexture;
/** Gets or sets the control parent */
parent: BABYLON.Nullable<Container>;
/** @hidden */
_currentMeasure: Measure;
private _fontFamily;
private _fontStyle;
private _fontWeight;
private _fontSize;
private _font;
/** @hidden */
_width: ValueAndUnit;
/** @hidden */
_height: ValueAndUnit;
/** @hidden */
protected _fontOffset: {
ascent: number;
height: number;
descent: number;
};
private _color;
private _style;
private _styleObserver;
/** @hidden */
protected _horizontalAlignment: number;
/** @hidden */
protected _verticalAlignment: number;
/** @hidden */
protected _isDirty: boolean;
/** @hidden */
protected _wasDirty: boolean;
/** @hidden */
_tempParentMeasure: Measure;
/** @hidden */
_prevCurrentMeasureTransformedIntoGlobalSpace: Measure;
/** @hidden */
protected _cachedParentMeasure: Measure;
private _paddingLeft;
private _paddingRight;
private _paddingTop;
private _paddingBottom;
/** @hidden */
_left: ValueAndUnit;
/** @hidden */
_top: ValueAndUnit;
private _scaleX;
private _scaleY;
private _rotation;
private _transformCenterX;
private _transformCenterY;
/** @hidden */
_transformMatrix: Matrix2D;
/** @hidden */
protected _invertTransformMatrix: Matrix2D;
/** @hidden */
protected _transformedPosition: BABYLON.Vector2;
private _isMatrixDirty;
private _cachedOffsetX;
private _cachedOffsetY;
private _isVisible;
private _isHighlighted;
/** @hidden */
_linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
private _fontSet;
private _dummyVector2;
private _downCount;
private _enterCount;
private _doNotRender;
private _downPointerIds;
protected _isEnabled: boolean;
protected _disabledColor: string;
/** @hidden */
protected _rebuildLayout: boolean;
/** @hidden */
_isClipped: boolean;
/** @hidden */
_tag: any;
/**
* Gets or sets the unique id of the node. Please note that this number will be updated when the control is added to a container
*/
uniqueId: number;
/**
* Gets or sets an object used to store user defined information for the node
*/
metadata: any;
/** Gets or sets a boolean indicating if the control can be hit with pointer events */
isHitTestVisible: boolean;
/** Gets or sets a boolean indicating if the control can block pointer events */
isPointerBlocker: boolean;
/** Gets or sets a boolean indicating if the control can be focusable */
isFocusInvisible: boolean;
/**
* Gets or sets a boolean indicating if the children are clipped to the current control bounds.
* Please note that not clipping children may generate issues with adt.useInvalidateRectOptimization so it is recommended to turn this optimization off if you want to use unclipped children
*/
clipChildren: boolean;
/**
* Gets or sets a boolean indicating that the current control should cache its rendering (useful when the control does not change often)
*/
useBitmapCache: boolean;
private _cacheData;
private _shadowOffsetX;
/** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
shadowOffsetX: number;
private _shadowOffsetY;
/** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
shadowOffsetY: number;
private _shadowBlur;
/** Gets or sets a value indicating the amount of blur to use to render the shadow */
shadowBlur: number;
private _shadowColor;
/** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
shadowColor: string;
/** Gets or sets the cursor to use when the control is hovered */
hoverCursor: string;
/** @hidden */
protected _linkOffsetX: ValueAndUnit;
/** @hidden */
protected _linkOffsetY: ValueAndUnit;
/** Gets the control type name */
readonly typeName: string;
/**
* Get the current class name of the control.
* @returns current class name
*/
getClassName(): string;
/**
* An event triggered when the pointer move over the control.
*/
onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
/**
* An event triggered when the pointer move out of the control.
*/
onPointerOutObservable: BABYLON.Observable<Control>;
/**
* An event triggered when the pointer taps the control
*/
onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
/**
* An event triggered when pointer up
*/
onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
/**
* An event triggered when a control is clicked on
*/
onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
/**
* An event triggered when pointer enters the control
*/
onPointerEnterObservable: BABYLON.Observable<Control>;
/**
* An event triggered when the control is marked as dirty
*/
onDirtyObservable: BABYLON.Observable<Control>;
/**
* An event triggered before drawing the control
*/
onBeforeDrawObservable: BABYLON.Observable<Control>;
/**
* An event triggered after the control was drawn
*/
onAfterDrawObservable: BABYLON.Observable<Control>;
/**
* Get the hosting AdvancedDynamicTexture
*/
readonly host: AdvancedDynamicTexture;
/** Gets or set information about font offsets (used to render and align text) */
fontOffset: {
ascent: number;
height: number;
descent: number;
};
/** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
alpha: number;
/**
* Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
*/
isHighlighted: boolean;
/** Gets or sets a value indicating the scale factor on X axis (1 by default)
* @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
*/
scaleX: number;
/** Gets or sets a value indicating the scale factor on Y axis (1 by default)
* @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
*/
scaleY: number;
/** Gets or sets the rotation angle (0 by default)
* @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
*/
rotation: number;
/** Gets or sets the transformation center on Y axis (0 by default)
* @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
*/
transformCenterY: number;
/** Gets or sets the transformation center on X axis (0 by default)
* @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
*/
transformCenterX: number;
/**
* Gets or sets the horizontal alignment
* @see http://doc.babylonjs.com/how_to/gui#alignments
*/
horizontalAlignment: number;
/**
* Gets or sets the vertical alignment
* @see http://doc.babylonjs.com/how_to/gui#alignments
*/
verticalAlignment: number;
/**
* Gets or sets control width
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
width: string | number;
/**
* Gets control width in pixel
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
readonly widthInPixels: number;
/**
* Gets or sets control height
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
height: string | number;
/**
* Gets control height in pixel
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
readonly heightInPixels: number;
/** Gets or set font family */
fontFamily: string;
/** Gets or sets font style */
fontStyle: string;
/** Gets or sets font weight */
fontWeight: string;
/**
* Gets or sets style
* @see http://doc.babylonjs.com/how_to/gui#styles
*/
style: BABYLON.Nullable<Style>;
/** @hidden */
readonly _isFontSizeInPercentage: boolean;
/** Gets font size in pixels */
readonly fontSizeInPixels: number;
/** Gets or sets font size */
fontSize: string | number;
/** Gets or sets foreground color */
color: string;
/** Gets or sets z index which is used to reorder controls on the z axis */
zIndex: number;
/** Gets or sets a boolean indicating if the control can be rendered */
notRenderable: boolean;
/** Gets or sets a boolean indicating if the control is visible */
isVisible: boolean;
/** Gets a boolean indicating that the control needs to update its rendering */
readonly isDirty: boolean;
/**
* Gets the current linked mesh (or null if none)
*/
readonly linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
/**
* Gets or sets a value indicating the padding to use on the left of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
paddingLeft: string | number;
/**
* Gets a value indicating the padding in pixels to use on the left of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
readonly paddingLeftInPixels: number;
/**
* Gets or sets a value indicating the padding to use on the right of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
paddingRight: string | number;
/**
* Gets a value indicating the padding in pixels to use on the right of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
readonly paddingRightInPixels: number;
/**
* Gets or sets a value indicating the padding to use on the top of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
paddingTop: string | number;
/**
* Gets a value indicating the padding in pixels to use on the top of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
readonly paddingTopInPixels: number;
/**
* Gets or sets a value indicating the padding to use on the bottom of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
paddingBottom: string | number;
/**
* Gets a value indicating the padding in pixels to use on the bottom of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
readonly paddingBottomInPixels: number;
/**
* Gets or sets a value indicating the left coordinate of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
left: string | number;
/**
* Gets a value indicating the left coordinate in pixels of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
readonly leftInPixels: number;
/**
* Gets or sets a value indicating the top coordinate of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
top: string | number;
/**
* Gets a value indicating the top coordinate in pixels of the control
* @see http://doc.babylonjs.com/how_to/gui#position-and-size
*/
readonly topInPixels: number;
/**
* Gets or sets a value indicating the offset on X axis to the linked mesh
* @see http://doc.babylonjs.com/how_to/gui#tracking-positions
*/
linkOffsetX: string | number;
/**
* Gets a value indicating the offset in pixels on X axis to the linked mesh
* @see http://doc.babylonjs.com/how_to/gui#tracking-positions
*/
readonly linkOffsetXInPixels: number;
/**
* Gets or sets a value indicating the offset on Y axis to the linked mesh
* @see http://doc.babylonjs.com/how_to/gui#tracking-positions
*/
linkOffsetY: string | number;
/**
* Gets a value indicating the offset in pixels on Y axis to the linked mesh
* @see http://doc.babylonjs.com/how_to/gui#tracking-positions
*/
readonly linkOffsetYInPixels: number;
/** Gets the center coordinate on X axis */
readonly centerX: number;
/** Gets the center coordinate on Y axis */
readonly centerY: number;
/** Gets or sets if control is Enabled*/
isEnabled: boolean;
/** Gets or sets background color of control if it's disabled*/
disabledColor: string;
/**
* Creates a new control
* @param name defines the name of the control
*/
constructor(
/** defines the name of the control */
name?: string | undefined);
/** @hidden */
protected _getTypeName(): string;
/**
* Gets the first ascendant in the hierarchy of the given type
* @param className defines the required type
* @returns the ascendant or null if not found
*/
getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
/** @hidden */
_resetFontCache(): void;
/**
* Determines if a container is an ascendant of the current control
* @param container defines the container to look for
* @returns true if the container is one of the ascendant of the control
*/
isAscendant(container: Control): boolean;
/**
* Gets coordinates in local control space
* @param globalCoordinates defines the coordinates to transform
* @returns the new coordinates in local space
*/
getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
/**
* Gets coordinates in local control space
* @param globalCoordinates defines the coordinates to transform
* @param result defines the target vector2 where to store the result
* @returns the current control
*/
getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
/**
* Gets coordinates in parent local control space
* @param globalCoordinates defines the coordinates to transform
* @returns the new coordinates in parent local space