babylon.gui.d.ts 46 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282
  1. declare module BABYLON.GUI {
  2. /**
  3. * Define a style used by control to automatically setup properties based on a template.
  4. * Only support font related properties so far
  5. */
  6. class Style implements BABYLON.IDisposable {
  7. private _fontFamily;
  8. private _fontStyle;
  9. /** @hidden */
  10. _host: AdvancedDynamicTexture;
  11. /** @hidden */
  12. _fontSize: ValueAndUnit;
  13. /**
  14. * Observable raised when the style values are changed
  15. */
  16. onChangedObservable: Observable<Style>;
  17. /**
  18. * Creates a new style object
  19. * @param host defines the AdvancedDynamicTexture which hosts this style
  20. */
  21. constructor(host: AdvancedDynamicTexture);
  22. /**
  23. * Gets or sets the font size
  24. */
  25. fontSize: string | number;
  26. /**
  27. * Gets or sets the font family
  28. */
  29. fontFamily: string;
  30. /**
  31. * Gets or sets the font style
  32. */
  33. fontStyle: string;
  34. /** Dispose all associated resources */
  35. dispose(): void;
  36. }
  37. }
  38. declare module BABYLON.GUI {
  39. class ValueAndUnit {
  40. unit: number;
  41. negativeValueAllowed: boolean;
  42. private _value;
  43. ignoreAdaptiveScaling: boolean;
  44. constructor(value: number, unit?: number, negativeValueAllowed?: boolean);
  45. readonly isPercentage: boolean;
  46. readonly isPixel: boolean;
  47. readonly internalValue: number;
  48. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  49. getValue(host: AdvancedDynamicTexture): number;
  50. toString(host: AdvancedDynamicTexture): string;
  51. fromString(source: string | number): boolean;
  52. private static _Regex;
  53. private static _UNITMODE_PERCENTAGE;
  54. private static _UNITMODE_PIXEL;
  55. static readonly UNITMODE_PERCENTAGE: number;
  56. static readonly UNITMODE_PIXEL: number;
  57. }
  58. }
  59. declare module BABYLON.GUI {
  60. interface IFocusableControl {
  61. onFocus(): void;
  62. onBlur(): void;
  63. processKeyboard(evt: KeyboardEvent): void;
  64. }
  65. class AdvancedDynamicTexture extends DynamicTexture {
  66. private _isDirty;
  67. private _renderObserver;
  68. private _resizeObserver;
  69. private _preKeyboardObserver;
  70. private _pointerMoveObserver;
  71. private _pointerObserver;
  72. private _canvasPointerOutObserver;
  73. private _background;
  74. _rootContainer: Container;
  75. _lastPickedControl: Control;
  76. _lastControlOver: {
  77. [pointerId: number]: Control;
  78. };
  79. _lastControlDown: {
  80. [pointerId: number]: Control;
  81. };
  82. _capturingControl: {
  83. [pointerId: number]: Control;
  84. };
  85. _shouldBlockPointer: boolean;
  86. _layerToDispose: Nullable<Layer>;
  87. _linkedControls: Control[];
  88. private _isFullscreen;
  89. private _fullscreenViewport;
  90. private _idealWidth;
  91. private _idealHeight;
  92. private _useSmallestIdeal;
  93. private _renderAtIdealSize;
  94. private _focusedControl;
  95. private _blockNextFocusCheck;
  96. private _renderScale;
  97. /**
  98. * Gets or sets a boolean defining if alpha is stored as premultiplied
  99. */
  100. premulAlpha: boolean;
  101. renderScale: number;
  102. background: string;
  103. idealWidth: number;
  104. idealHeight: number;
  105. useSmallestIdeal: boolean;
  106. renderAtIdealSize: boolean;
  107. readonly layer: Nullable<Layer>;
  108. readonly rootContainer: Container;
  109. focusedControl: Nullable<IFocusableControl>;
  110. isForeground: boolean;
  111. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  112. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  113. markAsDirty(): void;
  114. /**
  115. * Helper function used to create a new style
  116. */
  117. createStyle(): Style;
  118. addControl(control: Control): AdvancedDynamicTexture;
  119. removeControl(control: Control): AdvancedDynamicTexture;
  120. dispose(): void;
  121. private _onResize();
  122. _getGlobalViewport(scene: Scene): Viewport;
  123. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  124. private _checkUpdate(camera);
  125. private _render();
  126. private _doPicking(x, y, type, pointerId, buttonIndex);
  127. _cleanControlAfterRemovalFromList(list: {
  128. [pointerId: number]: Control;
  129. }, control: Control): void;
  130. _cleanControlAfterRemoval(control: Control): void;
  131. attach(): void;
  132. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  133. moveFocusToControl(control: IFocusableControl): void;
  134. private _manageFocus();
  135. private _attachToOnPointerOut(scene);
  136. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
  137. /**
  138. * FullScreenUI is created in a layer. This allows it to be treated like any other layer.
  139. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  140. * When the GUI is not Created as FullscreenUI it does not respect the layerMask.
  141. * layerMask is set through advancedTexture.layer.layerMask
  142. * @param name name for the Texture
  143. * @param foreground render in foreground (default is true)
  144. * @param scene scene to be rendered in
  145. * @param sampling method for scaling to fit screen
  146. * @returns AdvancedDynamicTexture
  147. */
  148. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  149. }
  150. }
  151. declare module BABYLON.GUI {
  152. class Measure {
  153. left: number;
  154. top: number;
  155. width: number;
  156. height: number;
  157. constructor(left: number, top: number, width: number, height: number);
  158. copyFrom(other: Measure): void;
  159. isEqualsTo(other: Measure): boolean;
  160. static Empty(): Measure;
  161. }
  162. }
  163. declare module BABYLON.GUI {
  164. class Vector2WithInfo extends Vector2 {
  165. buttonIndex: number;
  166. constructor(source: Vector2, buttonIndex?: number);
  167. }
  168. class Matrix2D {
  169. m: Float32Array;
  170. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  171. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  172. determinant(): number;
  173. invertToRef(result: Matrix2D): Matrix2D;
  174. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  175. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  176. static Identity(): Matrix2D;
  177. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  178. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  179. static RotationToRef(angle: number, result: Matrix2D): void;
  180. private static _TempPreTranslationMatrix;
  181. private static _TempPostTranslationMatrix;
  182. private static _TempRotationMatrix;
  183. private static _TempScalingMatrix;
  184. private static _TempCompose0;
  185. private static _TempCompose1;
  186. private static _TempCompose2;
  187. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  188. }
  189. }
  190. declare module BABYLON.GUI {
  191. class MultiLinePoint {
  192. private _multiLine;
  193. private _x;
  194. private _y;
  195. private _control;
  196. private _mesh;
  197. private _controlObserver;
  198. private _meshObserver;
  199. _point: Vector2;
  200. constructor(multiLine: MultiLine);
  201. x: string | number;
  202. y: string | number;
  203. control: Nullable<Control>;
  204. mesh: Nullable<AbstractMesh>;
  205. translate(): Vector2;
  206. private _translatePoint();
  207. dispose(): void;
  208. }
  209. }
  210. declare module BABYLON.GUI {
  211. class Control {
  212. name: string | undefined;
  213. private _alpha;
  214. private _alphaSet;
  215. private _zIndex;
  216. _root: Nullable<Container>;
  217. _host: AdvancedDynamicTexture;
  218. parent: Nullable<Container>;
  219. _currentMeasure: Measure;
  220. private _fontFamily;
  221. private _fontStyle;
  222. private _fontSize;
  223. private _font;
  224. _width: ValueAndUnit;
  225. _height: ValueAndUnit;
  226. protected _fontOffset: {
  227. ascent: number;
  228. height: number;
  229. descent: number;
  230. };
  231. private _color;
  232. private _style;
  233. private _styleObserver;
  234. protected _horizontalAlignment: number;
  235. protected _verticalAlignment: number;
  236. private _isDirty;
  237. _tempParentMeasure: Measure;
  238. protected _cachedParentMeasure: Measure;
  239. private _paddingLeft;
  240. private _paddingRight;
  241. private _paddingTop;
  242. private _paddingBottom;
  243. _left: ValueAndUnit;
  244. _top: ValueAndUnit;
  245. private _scaleX;
  246. private _scaleY;
  247. private _rotation;
  248. private _transformCenterX;
  249. private _transformCenterY;
  250. private _transformMatrix;
  251. protected _invertTransformMatrix: Matrix2D;
  252. protected _transformedPosition: Vector2;
  253. private _onlyMeasureMode;
  254. private _isMatrixDirty;
  255. private _cachedOffsetX;
  256. private _cachedOffsetY;
  257. private _isVisible;
  258. _linkedMesh: Nullable<AbstractMesh>;
  259. private _fontSet;
  260. private _dummyVector2;
  261. private _downCount;
  262. private _enterCount;
  263. private _doNotRender;
  264. private _downPointerIds;
  265. isHitTestVisible: boolean;
  266. isPointerBlocker: boolean;
  267. isFocusInvisible: boolean;
  268. shadowOffsetX: number;
  269. shadowOffsetY: number;
  270. shadowBlur: number;
  271. shadowColor: string;
  272. protected _linkOffsetX: ValueAndUnit;
  273. protected _linkOffsetY: ValueAndUnit;
  274. readonly typeName: string;
  275. /**
  276. * An event triggered when the pointer move over the control.
  277. */
  278. onPointerMoveObservable: Observable<Vector2>;
  279. /**
  280. * An event triggered when the pointer move out of the control.
  281. */
  282. onPointerOutObservable: Observable<Control>;
  283. /**
  284. * An event triggered when the pointer taps the control
  285. */
  286. onPointerDownObservable: Observable<Vector2WithInfo>;
  287. /**
  288. * An event triggered when pointer up
  289. */
  290. onPointerUpObservable: Observable<Vector2WithInfo>;
  291. /**
  292. * An event triggered when a control is clicked on
  293. */
  294. onPointerClickObservable: Observable<Vector2WithInfo>;
  295. /**
  296. * An event triggered when pointer enters the control
  297. */
  298. onPointerEnterObservable: Observable<Control>;
  299. /**
  300. * An event triggered when the control is marked as dirty
  301. */
  302. onDirtyObservable: Observable<Control>;
  303. /**
  304. * An event triggered after the control is drawn
  305. */
  306. onAfterDrawObservable: Observable<Control>;
  307. /** Gets or set information about font offsets (used to render and align text) */
  308. fontOffset: {
  309. ascent: number;
  310. height: number;
  311. descent: number;
  312. };
  313. alpha: number;
  314. scaleX: number;
  315. scaleY: number;
  316. rotation: number;
  317. transformCenterY: number;
  318. transformCenterX: number;
  319. horizontalAlignment: number;
  320. verticalAlignment: number;
  321. width: string | number;
  322. readonly widthInPixels: number;
  323. height: string | number;
  324. readonly heightInPixels: number;
  325. fontFamily: string;
  326. fontStyle: string;
  327. style: BABYLON.Nullable<Style>;
  328. /** @hidden */
  329. readonly _isFontSizeInPercentage: boolean;
  330. readonly fontSizeInPixels: number;
  331. fontSize: string | number;
  332. color: string;
  333. zIndex: number;
  334. notRenderable: boolean;
  335. isVisible: boolean;
  336. readonly isDirty: boolean;
  337. paddingLeft: string | number;
  338. readonly paddingLeftInPixels: number;
  339. paddingRight: string | number;
  340. readonly paddingRightInPixels: number;
  341. paddingTop: string | number;
  342. readonly paddingTopInPixels: number;
  343. paddingBottom: string | number;
  344. readonly paddingBottomInPixels: number;
  345. left: string | number;
  346. readonly leftInPixels: number;
  347. top: string | number;
  348. readonly topInPixels: number;
  349. linkOffsetX: string | number;
  350. readonly linkOffsetXInPixels: number;
  351. linkOffsetY: string | number;
  352. readonly linkOffsetYInPixels: number;
  353. readonly centerX: number;
  354. readonly centerY: number;
  355. constructor(name?: string | undefined);
  356. protected _getTypeName(): string;
  357. /** @hidden */
  358. _resetFontCache(): void;
  359. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  360. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  361. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  362. moveToVector3(position: Vector3, scene: Scene): void;
  363. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  364. _moveToProjectedPosition(projectedPosition: Vector3): void;
  365. _markMatrixAsDirty(): void;
  366. _markAsDirty(): void;
  367. _markAllAsDirty(): void;
  368. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  369. protected _transform(context: CanvasRenderingContext2D): void;
  370. protected _applyStates(context: CanvasRenderingContext2D): void;
  371. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  372. protected _clip(context: CanvasRenderingContext2D): void;
  373. _measure(): void;
  374. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  375. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  376. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  377. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  378. contains(x: number, y: number): boolean;
  379. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  380. _onPointerMove(target: Control, coordinates: Vector2): void;
  381. _onPointerEnter(target: Control): boolean;
  382. _onPointerOut(target: Control): void;
  383. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  384. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  385. forcePointerUp(pointerId?: Nullable<number>): void;
  386. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  387. private _prepareFont();
  388. dispose(): void;
  389. private static _HORIZONTAL_ALIGNMENT_LEFT;
  390. private static _HORIZONTAL_ALIGNMENT_RIGHT;
  391. private static _HORIZONTAL_ALIGNMENT_CENTER;
  392. private static _VERTICAL_ALIGNMENT_TOP;
  393. private static _VERTICAL_ALIGNMENT_BOTTOM;
  394. private static _VERTICAL_ALIGNMENT_CENTER;
  395. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  396. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  397. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  398. static readonly VERTICAL_ALIGNMENT_TOP: number;
  399. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  400. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  401. private static _FontHeightSizes;
  402. static _GetFontOffset(font: string): {
  403. ascent: number;
  404. height: number;
  405. descent: number;
  406. };
  407. static AddHeader(control: Control, text: string, size: string | number, options: {
  408. isHorizontal: boolean;
  409. controlFirst: boolean;
  410. }): StackPanel;
  411. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  412. }
  413. }
  414. declare module BABYLON.GUI {
  415. class Container extends Control {
  416. name: string | undefined;
  417. protected _children: Control[];
  418. protected _measureForChildren: Measure;
  419. protected _background: string;
  420. protected _adaptWidthToChildren: boolean;
  421. protected _adaptHeightToChildren: boolean;
  422. adaptHeightToChildren: boolean;
  423. adaptWidthToChildren: boolean;
  424. background: string;
  425. readonly children: Control[];
  426. constructor(name?: string | undefined);
  427. protected _getTypeName(): string;
  428. getChildByName(name: string): Nullable<Control>;
  429. getChildByType(name: string, type: string): Nullable<Control>;
  430. containsControl(control: Control): boolean;
  431. addControl(control: Control): Container;
  432. removeControl(control: Control): Container;
  433. _reOrderControl(control: Control): void;
  434. _markMatrixAsDirty(): void;
  435. _markAllAsDirty(): void;
  436. protected _localDraw(context: CanvasRenderingContext2D): void;
  437. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  438. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  439. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  440. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  441. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  442. dispose(): void;
  443. }
  444. }
  445. declare module BABYLON.GUI {
  446. class StackPanel extends Container {
  447. name: string | undefined;
  448. private _isVertical;
  449. private _manualWidth;
  450. private _manualHeight;
  451. private _doNotTrackManualChanges;
  452. private _tempMeasureStore;
  453. isVertical: boolean;
  454. width: string | number;
  455. height: string | number;
  456. constructor(name?: string | undefined);
  457. protected _getTypeName(): string;
  458. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  459. }
  460. }
  461. declare module BABYLON.GUI {
  462. class Rectangle extends Container {
  463. name: string | undefined;
  464. private _thickness;
  465. private _cornerRadius;
  466. thickness: number;
  467. cornerRadius: number;
  468. constructor(name?: string | undefined);
  469. protected _getTypeName(): string;
  470. protected _localDraw(context: CanvasRenderingContext2D): void;
  471. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  472. private _drawRoundedRect(context, offset?);
  473. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  474. }
  475. }
  476. declare module BABYLON.GUI {
  477. class Ellipse extends Container {
  478. name: string | undefined;
  479. private _thickness;
  480. thickness: number;
  481. constructor(name?: string | undefined);
  482. protected _getTypeName(): string;
  483. protected _localDraw(context: CanvasRenderingContext2D): void;
  484. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  485. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  486. }
  487. }
  488. declare module BABYLON.GUI {
  489. class Line extends Control {
  490. name: string | undefined;
  491. private _lineWidth;
  492. private _x1;
  493. private _y1;
  494. private _x2;
  495. private _y2;
  496. private _dash;
  497. private _connectedControl;
  498. private _connectedControlDirtyObserver;
  499. dash: Array<number>;
  500. connectedControl: Control;
  501. x1: string | number;
  502. y1: string | number;
  503. x2: string | number;
  504. y2: string | number;
  505. lineWidth: number;
  506. horizontalAlignment: number;
  507. verticalAlignment: number;
  508. private readonly _effectiveX2;
  509. private readonly _effectiveY2;
  510. constructor(name?: string | undefined);
  511. protected _getTypeName(): string;
  512. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  513. _measure(): void;
  514. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  515. /**
  516. * Move one end of the line given 3D cartesian coordinates.
  517. * @param position Targeted world position
  518. * @param scene Scene
  519. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  520. */
  521. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  522. /**
  523. * Move one end of the line to a position in screen absolute space.
  524. * @param projectedPosition Position in screen absolute space (X, Y)
  525. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  526. */
  527. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  528. }
  529. }
  530. declare module BABYLON.GUI {
  531. class Slider extends Control {
  532. name: string | undefined;
  533. private _thumbWidth;
  534. private _minimum;
  535. private _maximum;
  536. private _value;
  537. private _background;
  538. private _borderColor;
  539. private _barOffset;
  540. private _isThumbCircle;
  541. private _isThumbClamped;
  542. onValueChangedObservable: Observable<number>;
  543. borderColor: string;
  544. background: string;
  545. barOffset: string | number;
  546. readonly barOffsetInPixels: number;
  547. thumbWidth: string | number;
  548. readonly thumbWidthInPixels: number;
  549. minimum: number;
  550. maximum: number;
  551. value: number;
  552. isThumbCircle: boolean;
  553. isThumbClamped: boolean;
  554. constructor(name?: string | undefined);
  555. protected _getTypeName(): string;
  556. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  557. private _pointerIsDown;
  558. private _updateValueFromPointer(x, y);
  559. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  560. _onPointerMove(target: Control, coordinates: Vector2): void;
  561. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  562. }
  563. }
  564. declare module BABYLON.GUI {
  565. class Checkbox extends Control {
  566. name: string | undefined;
  567. private _isChecked;
  568. private _background;
  569. private _checkSizeRatio;
  570. private _thickness;
  571. thickness: number;
  572. onIsCheckedChangedObservable: Observable<boolean>;
  573. checkSizeRatio: number;
  574. background: string;
  575. isChecked: boolean;
  576. constructor(name?: string | undefined);
  577. protected _getTypeName(): string;
  578. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  579. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  580. }
  581. }
  582. declare module BABYLON.GUI {
  583. class RadioButton extends Control {
  584. name: string | undefined;
  585. private _isChecked;
  586. private _background;
  587. private _checkSizeRatio;
  588. private _thickness;
  589. thickness: number;
  590. group: string;
  591. onIsCheckedChangedObservable: Observable<boolean>;
  592. checkSizeRatio: number;
  593. background: string;
  594. isChecked: boolean;
  595. constructor(name?: string | undefined);
  596. protected _getTypeName(): string;
  597. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  598. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  599. }
  600. }
  601. declare module BABYLON.GUI {
  602. class TextBlock extends Control {
  603. /**
  604. * Defines the name of the control
  605. */
  606. name: string | undefined;
  607. private _text;
  608. private _textWrapping;
  609. private _textHorizontalAlignment;
  610. private _textVerticalAlignment;
  611. private _lines;
  612. private _resizeToFit;
  613. private _lineSpacing;
  614. private _outlineWidth;
  615. private _outlineColor;
  616. /**
  617. * An event triggered after the text is changed
  618. */
  619. onTextChangedObservable: Observable<TextBlock>;
  620. /**
  621. * An event triggered after the text was broken up into lines
  622. */
  623. onLinesReadyObservable: Observable<TextBlock>;
  624. /**
  625. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  626. */
  627. readonly lines: any[];
  628. /**
  629. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  630. */
  631. /**
  632. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  633. */
  634. resizeToFit: boolean;
  635. /**
  636. * Gets or sets a boolean indicating if text must be wrapped
  637. */
  638. /**
  639. * Gets or sets a boolean indicating if text must be wrapped
  640. */
  641. textWrapping: boolean;
  642. /**
  643. * Gets or sets text to display
  644. */
  645. /**
  646. * Gets or sets text to display
  647. */
  648. text: string;
  649. /**
  650. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  651. */
  652. /**
  653. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  654. */
  655. textHorizontalAlignment: number;
  656. /**
  657. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  658. */
  659. /**
  660. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  661. */
  662. textVerticalAlignment: number;
  663. /**
  664. * Gets or sets line spacing value
  665. */
  666. /**
  667. * Gets or sets line spacing value
  668. */
  669. lineSpacing: string | number;
  670. /**
  671. * Gets or sets outlineWidth of the text to display
  672. */
  673. /**
  674. * Gets or sets outlineWidth of the text to display
  675. */
  676. outlineWidth: number;
  677. /**
  678. * Gets or sets outlineColor of the text to display
  679. */
  680. /**
  681. * Gets or sets outlineColor of the text to display
  682. */
  683. outlineColor: string;
  684. /**
  685. * Creates a new TextBlock object
  686. * @param name defines the name of the control
  687. * @param text defines the text to display (emptry string by default)
  688. */
  689. constructor(
  690. /**
  691. * Defines the name of the control
  692. */
  693. name?: string | undefined, text?: string);
  694. protected _getTypeName(): string;
  695. private _drawText(text, textWidth, y, context);
  696. /** @hidden */
  697. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  698. protected _applyStates(context: CanvasRenderingContext2D): void;
  699. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  700. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  701. protected _parseLineWithTextWrapping(line: string | undefined, context: CanvasRenderingContext2D): object;
  702. protected _renderLines(context: CanvasRenderingContext2D): void;
  703. dispose(): void;
  704. }
  705. }
  706. declare var DOMImage: new (width?: number | undefined, height?: number | undefined) => HTMLImageElement;
  707. declare module BABYLON.GUI {
  708. class Image extends Control {
  709. name: string | undefined;
  710. private _domImage;
  711. private _imageWidth;
  712. private _imageHeight;
  713. private _loaded;
  714. private _stretch;
  715. private _source;
  716. private _autoScale;
  717. private _sourceLeft;
  718. private _sourceTop;
  719. private _sourceWidth;
  720. private _sourceHeight;
  721. private _cellWidth;
  722. private _cellHeight;
  723. private _cellId;
  724. sourceLeft: number;
  725. sourceTop: number;
  726. sourceWidth: number;
  727. sourceHeight: number;
  728. autoScale: boolean;
  729. stretch: number;
  730. domImage: HTMLImageElement;
  731. private _onImageLoaded();
  732. source: Nullable<string>;
  733. cellWidth: number;
  734. cellHeight: number;
  735. cellId: number;
  736. constructor(name?: string | undefined, url?: Nullable<string>);
  737. protected _getTypeName(): string;
  738. synchronizeSizeWithContent(): void;
  739. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  740. private static _STRETCH_NONE;
  741. private static _STRETCH_FILL;
  742. private static _STRETCH_UNIFORM;
  743. private static _STRETCH_EXTEND;
  744. static readonly STRETCH_NONE: number;
  745. static readonly STRETCH_FILL: number;
  746. static readonly STRETCH_UNIFORM: number;
  747. static readonly STRETCH_EXTEND: number;
  748. }
  749. }
  750. declare module BABYLON.GUI {
  751. class Button extends Rectangle {
  752. name: string | undefined;
  753. pointerEnterAnimation: () => void;
  754. pointerOutAnimation: () => void;
  755. pointerDownAnimation: () => void;
  756. pointerUpAnimation: () => void;
  757. constructor(name?: string | undefined);
  758. protected _getTypeName(): string;
  759. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  760. _onPointerEnter(target: Control): boolean;
  761. _onPointerOut(target: Control): void;
  762. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  763. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  764. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  765. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  766. static CreateSimpleButton(name: string, text: string): Button;
  767. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  768. }
  769. }
  770. declare module BABYLON.GUI {
  771. class ColorPicker extends Control {
  772. name: string | undefined;
  773. private _colorWheelCanvas;
  774. private _value;
  775. private _tmpColor;
  776. private _pointerStartedOnSquare;
  777. private _pointerStartedOnWheel;
  778. private _squareLeft;
  779. private _squareTop;
  780. private _squareSize;
  781. private _h;
  782. private _s;
  783. private _v;
  784. onValueChangedObservable: Observable<Color3>;
  785. value: Color3;
  786. width: string | number;
  787. height: string | number;
  788. size: string | number;
  789. constructor(name?: string | undefined);
  790. protected _getTypeName(): string;
  791. private _updateSquareProps();
  792. private _drawGradientSquare(hueValue, left, top, width, height, context);
  793. private _drawCircle(centerX, centerY, radius, context);
  794. private _createColorWheelCanvas(radius, thickness);
  795. private _RGBtoHSV(color, result);
  796. private _HSVtoRGB(hue, saturation, value, result);
  797. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  798. private _pointerIsDown;
  799. private _updateValueFromPointer(x, y);
  800. private _isPointOnSquare(coordinates);
  801. private _isPointOnWheel(coordinates);
  802. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  803. _onPointerMove(target: Control, coordinates: Vector2): void;
  804. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  805. }
  806. }
  807. declare module BABYLON.GUI {
  808. class InputText extends Control implements IFocusableControl {
  809. name: string | undefined;
  810. private _text;
  811. private _placeholderText;
  812. private _background;
  813. private _focusedBackground;
  814. private _placeholderColor;
  815. private _thickness;
  816. private _margin;
  817. private _autoStretchWidth;
  818. private _maxWidth;
  819. private _isFocused;
  820. private _blinkTimeout;
  821. private _blinkIsEven;
  822. private _cursorOffset;
  823. private _scrollLeft;
  824. private _textWidth;
  825. private _clickedCoordinate;
  826. promptMessage: string;
  827. onTextChangedObservable: Observable<InputText>;
  828. onFocusObservable: Observable<InputText>;
  829. onBlurObservable: Observable<InputText>;
  830. maxWidth: string | number;
  831. readonly maxWidthInPixels: number;
  832. margin: string;
  833. readonly marginInPixels: number;
  834. autoStretchWidth: boolean;
  835. thickness: number;
  836. focusedBackground: string;
  837. background: string;
  838. placeholderColor: string;
  839. placeholderText: string;
  840. text: string;
  841. width: string | number;
  842. constructor(name?: string | undefined, text?: string);
  843. onBlur(): void;
  844. onFocus(): void;
  845. protected _getTypeName(): string;
  846. processKey(keyCode: number, key?: string): void;
  847. processKeyboard(evt: KeyboardEvent): void;
  848. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  849. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  850. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  851. dispose(): void;
  852. }
  853. }
  854. declare module BABYLON.GUI {
  855. class KeyPropertySet {
  856. width?: string;
  857. height?: string;
  858. paddingLeft?: string;
  859. paddingRight?: string;
  860. paddingTop?: string;
  861. paddingBottom?: string;
  862. color?: string;
  863. background?: string;
  864. }
  865. class VirtualKeyboard extends StackPanel {
  866. onKeyPressObservable: Observable<string>;
  867. defaultButtonWidth: string;
  868. defaultButtonHeight: string;
  869. defaultButtonPaddingLeft: string;
  870. defaultButtonPaddingRight: string;
  871. defaultButtonPaddingTop: string;
  872. defaultButtonPaddingBottom: string;
  873. defaultButtonColor: string;
  874. defaultButtonBackground: string;
  875. shiftButtonColor: string;
  876. selectedShiftThickness: number;
  877. shiftState: number;
  878. protected _getTypeName(): string;
  879. private _createKey(key, propertySet);
  880. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  881. applyShiftState(shiftState: number): void;
  882. private _connectedInputText;
  883. private _onFocusObserver;
  884. private _onBlurObserver;
  885. private _onKeyPressObserver;
  886. readonly connectedInputText: Nullable<InputText>;
  887. connect(input: InputText): void;
  888. disconnect(): void;
  889. static CreateDefaultLayout(): VirtualKeyboard;
  890. }
  891. }
  892. declare module BABYLON.GUI {
  893. class MultiLine extends Control {
  894. name: string | undefined;
  895. private _lineWidth;
  896. private _dash;
  897. private _points;
  898. private _minX;
  899. private _minY;
  900. private _maxX;
  901. private _maxY;
  902. constructor(name?: string | undefined);
  903. dash: Array<number>;
  904. getAt(index: number): MultiLinePoint;
  905. onPointUpdate: () => void;
  906. add(...items: (AbstractMesh | Control | {
  907. x: string | number;
  908. y: string | number;
  909. })[]): MultiLinePoint[];
  910. push(item?: (AbstractMesh | Control | {
  911. x: string | number;
  912. y: string | number;
  913. })): MultiLinePoint;
  914. remove(value: number | MultiLinePoint): void;
  915. lineWidth: number;
  916. horizontalAlignment: number;
  917. verticalAlignment: number;
  918. protected _getTypeName(): string;
  919. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  920. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  921. _measure(): void;
  922. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  923. dispose(): void;
  924. }
  925. }
  926. declare module BABYLON.GUI {
  927. /**
  928. * Class used to manage 3D user interface
  929. */
  930. class GUI3DManager implements BABYLON.IDisposable {
  931. private _scene;
  932. private _sceneDisposeObserver;
  933. private _utilityLayer;
  934. private _rootContainer;
  935. private _pointerObserver;
  936. _lastPickedControl: Control3D;
  937. /** @hidden */
  938. _lastControlOver: {
  939. [pointerId: number]: Control3D;
  940. };
  941. /** @hidden */
  942. _lastControlDown: {
  943. [pointerId: number]: Control3D;
  944. };
  945. /** Gets the hosting scene */
  946. readonly scene: Scene;
  947. readonly utilityLayer: Nullable<UtilityLayerRenderer>;
  948. /**
  949. * Creates a new GUI3DManager
  950. * @param scene
  951. */
  952. constructor(scene?: Scene);
  953. private _doPicking(type, pointerEvent);
  954. /**
  955. * Gets the root container
  956. */
  957. readonly rootContainer: Container3D;
  958. /**
  959. * Gets a boolean indicating if the given control is in the root child list
  960. * @param control defines the control to check
  961. * @returns true if the control is in the root child list
  962. */
  963. containsControl(control: Control3D): boolean;
  964. /**
  965. * Adds a control to the root child list
  966. * @param control defines the control to add
  967. * @returns the current manager
  968. */
  969. addControl(control: Control3D): GUI3DManager;
  970. /**
  971. * Removes the control from the root child list
  972. * @param control defines the control to remove
  973. * @returns the current container
  974. */
  975. removeControl(control: Control3D): GUI3DManager;
  976. /**
  977. * Releases all associated resources
  978. */
  979. dispose(): void;
  980. }
  981. }
  982. declare module BABYLON.GUI {
  983. /**
  984. * Class used to render controls with fluent desgin
  985. */
  986. class FluentMaterial extends PushMaterial {
  987. private _emissiveTexture;
  988. emissiveTexture: BaseTexture;
  989. private _renderId;
  990. constructor(name: string, scene: Scene);
  991. needAlphaBlending(): boolean;
  992. needAlphaTesting(): boolean;
  993. getAlphaTestTexture(): Nullable<BaseTexture>;
  994. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  995. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  996. getActiveTextures(): BaseTexture[];
  997. hasTexture(texture: BaseTexture): boolean;
  998. dispose(forceDisposeEffect?: boolean): void;
  999. clone(name: string): FluentMaterial;
  1000. serialize(): any;
  1001. getClassName(): string;
  1002. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  1003. }
  1004. }
  1005. declare module BABYLON.GUI {
  1006. class Vector3WithInfo extends Vector3 {
  1007. buttonIndex: number;
  1008. constructor(source: Vector3, buttonIndex?: number);
  1009. }
  1010. }
  1011. declare module BABYLON.GUI {
  1012. /**
  1013. * Class used as base class for controls
  1014. */
  1015. class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  1016. /** Defines the control name */
  1017. name: string | undefined;
  1018. /** @hidden */
  1019. _host: GUI3DManager;
  1020. private _mesh;
  1021. private _downCount;
  1022. private _enterCount;
  1023. private _downPointerIds;
  1024. private _isVisible;
  1025. /** Callback used to start pointer enter animation */
  1026. pointerEnterAnimation: () => void;
  1027. /** Callback used to start pointer out animation */
  1028. pointerOutAnimation: () => void;
  1029. /** Callback used to start pointer down animation */
  1030. pointerDownAnimation: () => void;
  1031. /** Callback used to start pointer up animation */
  1032. pointerUpAnimation: () => void;
  1033. /**
  1034. * An event triggered when the pointer move over the control.
  1035. */
  1036. onPointerMoveObservable: Observable<Vector3>;
  1037. /**
  1038. * An event triggered when the pointer move out of the control.
  1039. */
  1040. onPointerOutObservable: Observable<Control3D>;
  1041. /**
  1042. * An event triggered when the pointer taps the control
  1043. */
  1044. onPointerDownObservable: Observable<Vector3WithInfo>;
  1045. /**
  1046. * An event triggered when pointer up
  1047. */
  1048. onPointerUpObservable: Observable<Vector3WithInfo>;
  1049. /**
  1050. * An event triggered when a control is clicked on
  1051. */
  1052. onPointerClickObservable: Observable<Vector3WithInfo>;
  1053. /**
  1054. * An event triggered when pointer enters the control
  1055. */
  1056. onPointerEnterObservable: Observable<Control3D>;
  1057. /**
  1058. * Gets or sets the parent container
  1059. */
  1060. parent: Nullable<Container3D>;
  1061. private _behaviors;
  1062. /**
  1063. * Gets the list of attached behaviors
  1064. * @see http://doc.babylonjs.com/features/behaviour
  1065. */
  1066. readonly behaviors: Behavior<Control3D>[];
  1067. /**
  1068. * Attach a behavior to the control
  1069. * @see http://doc.babylonjs.com/features/behaviour
  1070. * @param behavior defines the behavior to attach
  1071. * @returns the current control
  1072. */
  1073. addBehavior(behavior: Behavior<Control3D>): Control3D;
  1074. /**
  1075. * Remove an attached behavior
  1076. * @see http://doc.babylonjs.com/features/behaviour
  1077. * @param behavior defines the behavior to attach
  1078. * @returns the current control
  1079. */
  1080. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  1081. /**
  1082. * Gets an attached behavior by name
  1083. * @param name defines the name of the behavior to look for
  1084. * @see http://doc.babylonjs.com/features/behaviour
  1085. * @returns null if behavior was not found else the requested behavior
  1086. */
  1087. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  1088. /** Gets or sets a boolean indicating if the control is visible */
  1089. isVisible: boolean;
  1090. /** Gets or sets the control position */
  1091. position: Vector3;
  1092. /**
  1093. * Creates a new control
  1094. * @param name defines the control name
  1095. */
  1096. constructor(
  1097. /** Defines the control name */
  1098. name?: string | undefined);
  1099. /**
  1100. * Gets a string representing the class name
  1101. */
  1102. readonly typeName: string;
  1103. protected _getTypeName(): string;
  1104. /**
  1105. * Gets the mesh used to render this control
  1106. */
  1107. readonly mesh: Nullable<Mesh>;
  1108. /**
  1109. * Link the control as child of the given mesh
  1110. * @param mesh defines the mesh to link to. Use null to unlink the control
  1111. * @returns the current control
  1112. */
  1113. linkToMesh(mesh: Nullable<AbstractMesh>): Control3D;
  1114. /**
  1115. * Get the attached mesh used to render the control
  1116. * @param scene defines the scene where the mesh must be attached
  1117. * @returns the attached mesh or null if none
  1118. */
  1119. prepareMesh(scene: Scene): Nullable<Mesh>;
  1120. /**
  1121. * Mesh creation.
  1122. * Can be overriden by children
  1123. * @param scene defines the scene where the mesh must be attached
  1124. * @returns the attached mesh or null if none
  1125. */
  1126. protected _createMesh(scene: Scene): Nullable<Mesh>;
  1127. /**
  1128. * Affect a material to the given mesh
  1129. * @param mesh defines the mesh which will represent the control
  1130. */
  1131. protected _affectMaterial(mesh: Mesh): void;
  1132. /** @hidden */
  1133. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  1134. /** @hidden */
  1135. _onPointerEnter(target: Control3D): boolean;
  1136. /** @hidden */
  1137. _onPointerOut(target: Control3D): void;
  1138. /** @hidden */
  1139. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  1140. /** @hidden */
  1141. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1142. /** @hidden */
  1143. forcePointerUp(pointerId?: Nullable<number>): void;
  1144. /** @hidden */
  1145. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  1146. /**
  1147. * Releases all associated resources
  1148. */
  1149. dispose(): void;
  1150. }
  1151. }
  1152. declare module BABYLON.GUI {
  1153. /**
  1154. * Class used to create containers for controls
  1155. */
  1156. class Container3D extends Control3D {
  1157. private _children;
  1158. /**
  1159. * Creates a new container
  1160. * @param name defines the container name
  1161. */
  1162. constructor(name?: string);
  1163. /**
  1164. * Gets a boolean indicating if the given control is in the children of this control
  1165. * @param control defines the control to check
  1166. * @returns true if the control is in the child list
  1167. */
  1168. containsControl(control: Control3D): boolean;
  1169. /**
  1170. * Adds a control to the children of this control
  1171. * @param control defines the control to add
  1172. * @returns the current container
  1173. */
  1174. addControl(control: Control3D): Container3D;
  1175. /**
  1176. * Removes the control from the children of this control
  1177. * @param control defines the control to remove
  1178. * @returns the current container
  1179. */
  1180. removeControl(control: Control3D): Container3D;
  1181. protected _getTypeName(): string;
  1182. /**
  1183. * Releases all associated resources
  1184. */
  1185. dispose(): void;
  1186. }
  1187. }
  1188. declare module BABYLON.GUI {
  1189. /**
  1190. * Class used to create a button in 3D
  1191. */
  1192. class Button3D extends Control3D {
  1193. /** @hidden */
  1194. protected _currentMaterial: Material;
  1195. private _facadeTexture;
  1196. private _content;
  1197. /**
  1198. * Creates a new button
  1199. * @param name defines the control name
  1200. */
  1201. constructor(name?: string);
  1202. /**
  1203. * Gets or sets the GUI 2D content used to display the button's facade
  1204. */
  1205. content: Control;
  1206. protected _getTypeName(): string;
  1207. protected _createMesh(scene: Scene): Mesh;
  1208. protected _affectMaterial(mesh: Mesh): void;
  1209. }
  1210. }
  1211. declare module BABYLON.GUI {
  1212. /**
  1213. * Class used to create a button in 3D
  1214. */
  1215. class HolographicButton extends Button3D {
  1216. /**
  1217. * Creates a new button
  1218. * @param name defines the control name
  1219. */
  1220. constructor(name?: string);
  1221. protected _getTypeName(): string;
  1222. protected _createMesh(scene: Scene): Mesh;
  1223. protected _affectMaterial(mesh: Mesh): void;
  1224. }
  1225. }