babylon.gui.module.d.ts 49 KB

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