babylon.gui.module.d.ts 113 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528
  1. /*BabylonJS GUI*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/Gulp/babylonjs
  4. declare module 'babylonjs-gui' {
  5. export * from "babylonjs-gui/2D";
  6. export * from "babylonjs-gui/3D";
  7. }
  8. declare module 'babylonjs-gui/2D' {
  9. export * from "babylonjs-gui/2D/controls";
  10. export * from "babylonjs-gui/2D/advancedDynamicTexture";
  11. export * from "babylonjs-gui/2D/math2D";
  12. export * from "babylonjs-gui/2D/measure";
  13. export * from "babylonjs-gui/2D/multiLinePoint";
  14. export * from "babylonjs-gui/2D/style";
  15. export * from "babylonjs-gui/2D/valueAndUnit";
  16. }
  17. declare module 'babylonjs-gui/3D' {
  18. export * from "babylonjs-gui/3D/controls";
  19. export * from "babylonjs-gui/3D/materials";
  20. export * from "babylonjs-gui/3D/gui3DManager";
  21. export * from "babylonjs-gui/3D/vector3WithInfo";
  22. }
  23. declare module 'babylonjs-gui/2D/controls' {
  24. export * from "babylonjs-gui/2D/controls/button";
  25. export * from "babylonjs-gui/2D/controls/checkbox";
  26. export * from "babylonjs-gui/2D/controls/colorpicker";
  27. export * from "babylonjs-gui/2D/controls/container";
  28. export * from "babylonjs-gui/2D/controls/control";
  29. export * from "babylonjs-gui/2D/controls/ellipse";
  30. export * from "babylonjs-gui/2D/controls/grid";
  31. export * from "babylonjs-gui/2D/controls/image";
  32. export * from "babylonjs-gui/2D/controls/inputText";
  33. export * from "babylonjs-gui/2D/controls/inputPassword";
  34. export * from "babylonjs-gui/2D/controls/line";
  35. export * from "babylonjs-gui/2D/controls/multiLine";
  36. export * from "babylonjs-gui/2D/controls/radioButton";
  37. export * from "babylonjs-gui/2D/controls/stackPanel";
  38. export * from "babylonjs-gui/2D/controls/textBlock";
  39. export * from "babylonjs-gui/2D/controls/virtualKeyboard";
  40. export * from "babylonjs-gui/2D/controls/slider";
  41. export * from "babylonjs-gui/2D/controls/rectangle";
  42. export * from "babylonjs-gui/2D/controls/statics";
  43. }
  44. declare module 'babylonjs-gui/2D/advancedDynamicTexture' {
  45. import { DynamicTexture, Nullable, Layer, Viewport, Scene, Vector3, Matrix, Vector2, AbstractMesh } from "babylonjs";
  46. import { Container } from "babylonjs-gui/2D/controls/container";
  47. import { Control } from "babylonjs-gui/2D/controls/control";
  48. import { Style } from "babylonjs-gui/2D/style";
  49. /**
  50. * Interface used to define a control that can receive focus
  51. */
  52. export interface IFocusableControl {
  53. /**
  54. * Function called when the control receives the focus
  55. */
  56. onFocus(): void;
  57. /**
  58. * Function called when the control loses the focus
  59. */
  60. onBlur(): void;
  61. /**
  62. * Function called to let the control handle keyboard events
  63. * @param evt defines the current keyboard event
  64. */
  65. processKeyboard(evt: KeyboardEvent): void;
  66. }
  67. /**
  68. * Class used to create texture to support 2D GUI elements
  69. * @see http://doc.babylonjs.com/how_to/gui
  70. */
  71. export class AdvancedDynamicTexture extends DynamicTexture {
  72. /** @hidden */
  73. _rootContainer: Container;
  74. /** @hidden */
  75. _lastPickedControl: Control;
  76. /** @hidden */
  77. _lastControlOver: {
  78. [pointerId: number]: Control;
  79. };
  80. /** @hidden */
  81. _lastControlDown: {
  82. [pointerId: number]: Control;
  83. };
  84. /** @hidden */
  85. _capturingControl: {
  86. [pointerId: number]: Control;
  87. };
  88. /** @hidden */
  89. _shouldBlockPointer: boolean;
  90. /** @hidden */
  91. _layerToDispose: Nullable<Layer>;
  92. /** @hidden */
  93. _linkedControls: Control[];
  94. /**
  95. * Gets or sets a boolean defining if alpha is stored as premultiplied
  96. */
  97. premulAlpha: boolean;
  98. /**
  99. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  100. * Useful when you want more antialiasing
  101. */
  102. renderScale: number;
  103. /** Gets or sets the background color */
  104. background: string;
  105. /**
  106. * Gets or sets the ideal width used to design controls.
  107. * The GUI will then rescale everything accordingly
  108. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  109. */
  110. idealWidth: number;
  111. /**
  112. * Gets or sets the ideal height used to design controls.
  113. * The GUI will then rescale everything accordingly
  114. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  115. */
  116. idealHeight: number;
  117. /**
  118. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  119. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  120. */
  121. useSmallestIdeal: boolean;
  122. /**
  123. * Gets or sets a boolean indicating if adaptive scaling must be used
  124. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  125. */
  126. renderAtIdealSize: boolean;
  127. /**
  128. * Gets the underlying layer used to render the texture when in fullscreen mode
  129. */
  130. readonly layer: Nullable<Layer>;
  131. /**
  132. * Gets the root container control
  133. */
  134. readonly rootContainer: Container;
  135. /**
  136. * Gets or sets the current focused control
  137. */
  138. focusedControl: Nullable<IFocusableControl>;
  139. /**
  140. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  141. */
  142. isForeground: boolean;
  143. /**
  144. * Creates a new AdvancedDynamicTexture
  145. * @param name defines the name of the texture
  146. * @param width defines the width of the texture
  147. * @param height defines the height of the texture
  148. * @param scene defines the hosting scene
  149. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  150. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  151. */
  152. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  153. /**
  154. * Function used to execute a function on all controls
  155. * @param func defines the function to execute
  156. * @param container defines the container where controls belong. If null the root container will be used
  157. */
  158. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  159. /**
  160. * Marks the texture as dirty forcing a complete update
  161. */
  162. markAsDirty(): void;
  163. /**
  164. * Helper function used to create a new style
  165. * @returns a new style
  166. * @see http://doc.babylonjs.com/how_to/gui#styles
  167. */
  168. createStyle(): Style;
  169. /**
  170. * Adds a new control to the root container
  171. * @param control defines the control to add
  172. * @returns the current texture
  173. */
  174. addControl(control: Control): AdvancedDynamicTexture;
  175. /**
  176. * Removes a control from the root container
  177. * @param control defines the control to remove
  178. * @returns the current texture
  179. */
  180. removeControl(control: Control): AdvancedDynamicTexture;
  181. /**
  182. * Release all resources
  183. */
  184. dispose(): void;
  185. /** @hidden */
  186. _getGlobalViewport(scene: Scene): Viewport;
  187. /**
  188. * Get screen coordinates for a vector3
  189. * @param position defines the position to project
  190. * @param worldMatrix defines the world matrix to use
  191. * @returns the projected position
  192. */
  193. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  194. /** @hidden */
  195. _cleanControlAfterRemovalFromList(list: {
  196. [pointerId: number]: Control;
  197. }, control: Control): void;
  198. /** @hidden */
  199. _cleanControlAfterRemoval(control: Control): void;
  200. /** Attach to all scene events required to support pointer events */
  201. attach(): void;
  202. /**
  203. * Connect the texture to a hosting mesh to enable interactions
  204. * @param mesh defines the mesh to attach to
  205. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  206. */
  207. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  208. /**
  209. * Move the focus to a specific control
  210. * @param control defines the control which will receive the focus
  211. */
  212. moveFocusToControl(control: IFocusableControl): void;
  213. /**
  214. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  215. * @param mesh defines the mesh which will receive the texture
  216. * @param width defines the texture width (1024 by default)
  217. * @param height defines the texture height (1024 by default)
  218. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  219. * @returns a new AdvancedDynamicTexture
  220. */
  221. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean): AdvancedDynamicTexture;
  222. /**
  223. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  224. * In this mode the texture will rely on a layer for its rendering.
  225. * This allows it to be treated like any other layer.
  226. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  227. * LayerMask is set through advancedTexture.layer.layerMask
  228. * @param name defines name for the texture
  229. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  230. * @param scene defines the hsoting scene
  231. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  232. * @returns a new AdvancedDynamicTexture
  233. */
  234. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  235. }
  236. }
  237. declare module 'babylonjs-gui/2D/math2D' {
  238. import { Vector2, Nullable } from "babylonjs";
  239. /**
  240. * Class used to transport Vector2 information for pointer events
  241. */
  242. export class Vector2WithInfo extends Vector2 {
  243. /** defines the current mouse button index */
  244. buttonIndex: number;
  245. /**
  246. * Creates a new Vector2WithInfo
  247. * @param source defines the vector2 data to transport
  248. * @param buttonIndex defines the current mouse button index
  249. */
  250. constructor(source: Vector2,
  251. /** defines the current mouse button index */
  252. buttonIndex?: number);
  253. }
  254. /** Class used to provide 2D matrix features */
  255. export class Matrix2D {
  256. /** Gets the internal array of 6 floats used to store matrix data */
  257. m: Float32Array;
  258. /**
  259. * Creates a new matrix
  260. * @param m00 defines value for (0, 0)
  261. * @param m01 defines value for (0, 1)
  262. * @param m10 defines value for (1, 0)
  263. * @param m11 defines value for (1, 1)
  264. * @param m20 defines value for (2, 0)
  265. * @param m21 defines value for (2, 1)
  266. */
  267. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  268. /**
  269. * Fills the matrix from direct values
  270. * @param m00 defines value for (0, 0)
  271. * @param m01 defines value for (0, 1)
  272. * @param m10 defines value for (1, 0)
  273. * @param m11 defines value for (1, 1)
  274. * @param m20 defines value for (2, 0)
  275. * @param m21 defines value for (2, 1)
  276. * @returns the current modified matrix
  277. */
  278. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  279. /**
  280. * Gets matrix determinant
  281. * @returns the determinant
  282. */
  283. determinant(): number;
  284. /**
  285. * Inverses the matrix and stores it in a target matrix
  286. * @param result defines the target matrix
  287. * @returns the current matrix
  288. */
  289. invertToRef(result: Matrix2D): Matrix2D;
  290. /**
  291. * Multiplies the current matrix with another one
  292. * @param other defines the second operand
  293. * @param result defines the target matrix
  294. * @returns the current matrix
  295. */
  296. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  297. /**
  298. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  299. * @param x defines the x coordinate to transform
  300. * @param y defines the x coordinate to transform
  301. * @param result defines the target vector2
  302. * @returns the current matrix
  303. */
  304. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  305. /**
  306. * Creates an identity matrix
  307. * @returns a new matrix
  308. */
  309. static Identity(): Matrix2D;
  310. /**
  311. * Creates a translation matrix and stores it in a target matrix
  312. * @param x defines the x coordinate of the translation
  313. * @param y defines the y coordinate of the translation
  314. * @param result defines the target matrix
  315. */
  316. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  317. /**
  318. * Creates a scaling matrix and stores it in a target matrix
  319. * @param x defines the x coordinate of the scaling
  320. * @param y defines the y coordinate of the scaling
  321. * @param result defines the target matrix
  322. */
  323. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  324. /**
  325. * Creates a rotation matrix and stores it in a target matrix
  326. * @param angle defines the rotation angle
  327. * @param result defines the target matrix
  328. */
  329. static RotationToRef(angle: number, result: Matrix2D): void;
  330. /**
  331. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  332. * @param tx defines the x coordinate of the translation
  333. * @param ty defines the y coordinate of the translation
  334. * @param angle defines the rotation angle
  335. * @param scaleX defines the x coordinate of the scaling
  336. * @param scaleY defines the y coordinate of the scaling
  337. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  338. * @param result defines the target matrix
  339. */
  340. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  341. }
  342. }
  343. declare module 'babylonjs-gui/2D/measure' {
  344. /**
  345. * Class used to store 2D control sizes
  346. */
  347. export class Measure {
  348. /** defines left coordinate */
  349. left: number;
  350. /** defines top coordinate */
  351. top: number;
  352. /** defines width dimension */
  353. width: number;
  354. /** defines height dimension */
  355. height: number;
  356. /**
  357. * Creates a new measure
  358. * @param left defines left coordinate
  359. * @param top defines top coordinate
  360. * @param width defines width dimension
  361. * @param height defines height dimension
  362. */
  363. constructor(
  364. /** defines left coordinate */
  365. left: number,
  366. /** defines top coordinate */
  367. top: number,
  368. /** defines width dimension */
  369. width: number,
  370. /** defines height dimension */
  371. height: number);
  372. /**
  373. * Copy from another measure
  374. * @param other defines the other measure to copy from
  375. */
  376. copyFrom(other: Measure): void;
  377. /**
  378. * Check equality between this measure and another one
  379. * @param other defines the other measures
  380. * @returns true if both measures are equals
  381. */
  382. isEqualsTo(other: Measure): boolean;
  383. /**
  384. * Creates an empty measure
  385. * @returns a new measure
  386. */
  387. static Empty(): Measure;
  388. }
  389. }
  390. declare module 'babylonjs-gui/2D/multiLinePoint' {
  391. import { MultiLine } from "babylonjs-gui/2D/controls/multiLine";
  392. import { Control } from "babylonjs-gui/2D/controls/control";
  393. import { AbstractMesh, Nullable, Vector2 } from "babylonjs";
  394. /**
  395. * Class used to store a point for a MultiLine object.
  396. * The point can be pure 2D coordinates, a mesh or a control
  397. */
  398. export class MultiLinePoint {
  399. /** @hidden */
  400. _point: Vector2;
  401. /**
  402. * Creates a new MultiLinePoint
  403. * @param multiLine defines the source MultiLine object
  404. */
  405. constructor(multiLine: MultiLine);
  406. /** Gets or sets x coordinate */
  407. x: string | number;
  408. /** Gets or sets y coordinate */
  409. y: string | number;
  410. /** Gets or sets the control associated with this point */
  411. control: Nullable<Control>;
  412. /** Gets or sets the mesh associated with this point */
  413. mesh: Nullable<AbstractMesh>;
  414. /**
  415. * Gets a translation vector
  416. * @returns the translation vector
  417. */
  418. translate(): Vector2;
  419. /** Release associated resources */
  420. dispose(): void;
  421. }
  422. }
  423. declare module 'babylonjs-gui/2D/style' {
  424. import { IDisposable, Observable } from "babylonjs";
  425. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  426. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  427. /**
  428. * Define a style used by control to automatically setup properties based on a template.
  429. * Only support font related properties so far
  430. */
  431. export class Style implements IDisposable {
  432. /** @hidden */
  433. _host: AdvancedDynamicTexture;
  434. /** @hidden */
  435. _fontSize: ValueAndUnit;
  436. /**
  437. * Observable raised when the style values are changed
  438. */
  439. onChangedObservable: Observable<Style>;
  440. /**
  441. * Creates a new style object
  442. * @param host defines the AdvancedDynamicTexture which hosts this style
  443. */
  444. constructor(host: AdvancedDynamicTexture);
  445. /**
  446. * Gets or sets the font size
  447. */
  448. fontSize: string | number;
  449. /**
  450. * Gets or sets the font family
  451. */
  452. fontFamily: string;
  453. /**
  454. * Gets or sets the font style
  455. */
  456. fontStyle: string;
  457. /** Gets or sets font weight */
  458. fontWeight: string;
  459. /** Dispose all associated resources */
  460. dispose(): void;
  461. }
  462. }
  463. declare module 'babylonjs-gui/2D/valueAndUnit' {
  464. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  465. /**
  466. * Class used to specific a value and its associated unit
  467. */
  468. export class ValueAndUnit {
  469. /** defines the unit to store */
  470. unit: number;
  471. /** defines a boolean indicating if the value can be negative */
  472. negativeValueAllowed: boolean;
  473. /**
  474. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  475. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  476. */
  477. ignoreAdaptiveScaling: boolean;
  478. /**
  479. * Creates a new ValueAndUnit
  480. * @param value defines the value to store
  481. * @param unit defines the unit to store
  482. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  483. */
  484. constructor(value: number,
  485. /** defines the unit to store */
  486. unit?: number,
  487. /** defines a boolean indicating if the value can be negative */
  488. negativeValueAllowed?: boolean);
  489. /** Gets a boolean indicating if the value is a percentage */
  490. readonly isPercentage: boolean;
  491. /** Gets a boolean indicating if the value is store as pixel */
  492. readonly isPixel: boolean;
  493. /** Gets direct internal value */
  494. readonly internalValue: number;
  495. /**
  496. * Gets value as pixel
  497. * @param host defines the root host
  498. * @param refValue defines the reference value for percentages
  499. * @returns the value as pixel
  500. */
  501. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  502. /**
  503. * Gets the value accordingly to its unit
  504. * @param host defines the root host
  505. * @returns the value
  506. */
  507. getValue(host: AdvancedDynamicTexture): number;
  508. /**
  509. * Gets a string representation of the value
  510. * @param host defines the root host
  511. * @returns a string
  512. */
  513. toString(host: AdvancedDynamicTexture): string;
  514. /**
  515. * Store a value parsed from a string
  516. * @param source defines the source string
  517. * @returns true if the value was successfully parsed
  518. */
  519. fromString(source: string | number): boolean;
  520. /** UNITMODE_PERCENTAGE */
  521. static readonly UNITMODE_PERCENTAGE: number;
  522. /** UNITMODE_PIXEL */
  523. static readonly UNITMODE_PIXEL: number;
  524. }
  525. }
  526. declare module 'babylonjs-gui/3D/controls' {
  527. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  528. export * from "babylonjs-gui/3D/controls/button3D";
  529. export * from "babylonjs-gui/3D/controls/container3D";
  530. export * from "babylonjs-gui/3D/controls/control3D";
  531. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  532. export * from "babylonjs-gui/3D/controls/holographicButton";
  533. export * from "babylonjs-gui/3D/controls/meshButton3D";
  534. export * from "babylonjs-gui/3D/controls/planePanel";
  535. export * from "babylonjs-gui/3D/controls/scatterPanel";
  536. export * from "babylonjs-gui/3D/controls/spherePanel";
  537. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  538. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  539. }
  540. declare module 'babylonjs-gui/3D/materials' {
  541. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  542. }
  543. declare module 'babylonjs-gui/3D/gui3DManager' {
  544. import { IDisposable, Scene, Nullable, UtilityLayerRenderer, Observable, Vector3, Material } from "babylonjs";
  545. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  546. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  547. /**
  548. * Class used to manage 3D user interface
  549. * @see http://doc.babylonjs.com/how_to/gui3d
  550. */
  551. export class GUI3DManager implements IDisposable {
  552. /** @hidden */
  553. _lastPickedControl: Control3D;
  554. /** @hidden */
  555. _lastControlOver: {
  556. [pointerId: number]: Control3D;
  557. };
  558. /** @hidden */
  559. _lastControlDown: {
  560. [pointerId: number]: Control3D;
  561. };
  562. /**
  563. * Observable raised when the point picked by the pointer events changed
  564. */
  565. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  566. /** @hidden */
  567. _sharedMaterials: {
  568. [key: string]: Material;
  569. };
  570. /** Gets the hosting scene */
  571. readonly scene: Scene;
  572. /** Gets associated utility layer */
  573. readonly utilityLayer: Nullable<UtilityLayerRenderer>;
  574. /**
  575. * Creates a new GUI3DManager
  576. * @param scene
  577. */
  578. constructor(scene?: Scene);
  579. /**
  580. * Gets the root container
  581. */
  582. readonly rootContainer: Container3D;
  583. /**
  584. * Gets a boolean indicating if the given control is in the root child list
  585. * @param control defines the control to check
  586. * @returns true if the control is in the root child list
  587. */
  588. containsControl(control: Control3D): boolean;
  589. /**
  590. * Adds a control to the root child list
  591. * @param control defines the control to add
  592. * @returns the current manager
  593. */
  594. addControl(control: Control3D): GUI3DManager;
  595. /**
  596. * Removes a control from the root child list
  597. * @param control defines the control to remove
  598. * @returns the current container
  599. */
  600. removeControl(control: Control3D): GUI3DManager;
  601. /**
  602. * Releases all associated resources
  603. */
  604. dispose(): void;
  605. }
  606. }
  607. declare module 'babylonjs-gui/3D/vector3WithInfo' {
  608. import { Vector3 } from "babylonjs";
  609. /**
  610. * Class used to transport Vector3 information for pointer events
  611. */
  612. export class Vector3WithInfo extends Vector3 {
  613. /** defines the current mouse button index */
  614. buttonIndex: number;
  615. /**
  616. * Creates a new Vector3WithInfo
  617. * @param source defines the vector3 data to transport
  618. * @param buttonIndex defines the current mouse button index
  619. */
  620. constructor(source: Vector3,
  621. /** defines the current mouse button index */
  622. buttonIndex?: number);
  623. }
  624. }
  625. declare module 'babylonjs-gui/2D/controls/button' {
  626. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  627. import { Control } from "babylonjs-gui/2D/controls/control";
  628. import { Vector2 } from "babylonjs";
  629. /**
  630. * Class used to create 2D buttons
  631. */
  632. export class Button extends Rectangle {
  633. name?: string | undefined;
  634. /**
  635. * Function called to generate a pointer enter animation
  636. */
  637. pointerEnterAnimation: () => void;
  638. /**
  639. * Function called to generate a pointer out animation
  640. */
  641. pointerOutAnimation: () => void;
  642. /**
  643. * Function called to generate a pointer down animation
  644. */
  645. pointerDownAnimation: () => void;
  646. /**
  647. * Function called to generate a pointer up animation
  648. */
  649. pointerUpAnimation: () => void;
  650. /**
  651. * Creates a new Button
  652. * @param name defines the name of the button
  653. */
  654. constructor(name?: string | undefined);
  655. protected _getTypeName(): string;
  656. /** @hidden */
  657. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  658. /** @hidden */
  659. _onPointerEnter(target: Control): boolean;
  660. /** @hidden */
  661. _onPointerOut(target: Control): void;
  662. /** @hidden */
  663. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  664. /** @hidden */
  665. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  666. /**
  667. * Creates a new button made with an image and a text
  668. * @param name defines the name of the button
  669. * @param text defines the text of the button
  670. * @param imageUrl defines the url of the image
  671. * @returns a new Button
  672. */
  673. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  674. /**
  675. * Creates a new button made with an image
  676. * @param name defines the name of the button
  677. * @param imageUrl defines the url of the image
  678. * @returns a new Button
  679. */
  680. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  681. /**
  682. * Creates a new button made with a text
  683. * @param name defines the name of the button
  684. * @param text defines the text of the button
  685. * @returns a new Button
  686. */
  687. static CreateSimpleButton(name: string, text: string): Button;
  688. /**
  689. * Creates a new button made with an image and a centered text
  690. * @param name defines the name of the button
  691. * @param text defines the text of the button
  692. * @param imageUrl defines the url of the image
  693. * @returns a new Button
  694. */
  695. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  696. }
  697. }
  698. declare module 'babylonjs-gui/2D/controls/checkbox' {
  699. import { Control } from "babylonjs-gui/2D/controls/control";
  700. import { Measure } from "babylonjs-gui/2D/measure";
  701. import { Observable, Vector2 } from "babylonjs";
  702. /**
  703. * Class used to represent a 2D checkbox
  704. */
  705. export class Checkbox extends Control {
  706. name?: string | undefined;
  707. /** Gets or sets border thickness */
  708. thickness: number;
  709. /**
  710. * Observable raised when isChecked property changes
  711. */
  712. onIsCheckedChangedObservable: Observable<boolean>;
  713. /** Gets or sets a value indicating the ratio between overall size and check size */
  714. checkSizeRatio: number;
  715. /** Gets or sets background color */
  716. background: string;
  717. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  718. isChecked: boolean;
  719. /**
  720. * Creates a new CheckBox
  721. * @param name defines the control name
  722. */
  723. constructor(name?: string | undefined);
  724. protected _getTypeName(): string;
  725. /** @hidden */
  726. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  727. /** @hidden */
  728. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  729. }
  730. }
  731. declare module 'babylonjs-gui/2D/controls/colorpicker' {
  732. import { Control } from "babylonjs-gui/2D/controls/control";
  733. import { Color3, Observable, Vector2 } from "babylonjs";
  734. import { Measure } from "babylonjs-gui/2D/measure";
  735. /** Class used to create color pickers */
  736. export class ColorPicker extends Control {
  737. name?: string | undefined;
  738. /**
  739. * Observable raised when the value changes
  740. */
  741. onValueChangedObservable: Observable<Color3>;
  742. /** Gets or sets the color of the color picker */
  743. value: Color3;
  744. /** Gets or sets control width */
  745. width: string | number;
  746. /** Gets or sets control height */
  747. height: string | number;
  748. /** Gets or sets control size */
  749. size: string | number;
  750. /**
  751. * Creates a new ColorPicker
  752. * @param name defines the control name
  753. */
  754. constructor(name?: string | undefined);
  755. protected _getTypeName(): string;
  756. /** @hidden */
  757. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  758. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  759. _onPointerMove(target: Control, coordinates: Vector2): void;
  760. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  761. }
  762. }
  763. declare module 'babylonjs-gui/2D/controls/container' {
  764. import { Control } from "babylonjs-gui/2D/controls/control";
  765. import { Measure } from "babylonjs-gui/2D/measure";
  766. import { Nullable } from "babylonjs";
  767. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  768. /**
  769. * Root class for 2D containers
  770. * @see http://doc.babylonjs.com/how_to/gui#containers
  771. */
  772. export class Container extends Control {
  773. name?: string | undefined;
  774. /** @hidden */
  775. protected _children: Control[];
  776. /** @hidden */
  777. protected _measureForChildren: Measure;
  778. /** @hidden */
  779. protected _background: string;
  780. /** @hidden */
  781. protected _adaptWidthToChildren: boolean;
  782. /** @hidden */
  783. protected _adaptHeightToChildren: boolean;
  784. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  785. adaptHeightToChildren: boolean;
  786. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  787. adaptWidthToChildren: boolean;
  788. /** Gets or sets background color */
  789. background: string;
  790. /** Gets the list of children */
  791. readonly children: Control[];
  792. /**
  793. * Creates a new Container
  794. * @param name defines the name of the container
  795. */
  796. constructor(name?: string | undefined);
  797. protected _getTypeName(): string;
  798. /**
  799. * Gets a child using its name
  800. * @param name defines the child name to look for
  801. * @returns the child control if found
  802. */
  803. getChildByName(name: string): Nullable<Control>;
  804. /**
  805. * Gets a child using its type and its name
  806. * @param name defines the child name to look for
  807. * @param type defines the child type to look for
  808. * @returns the child control if found
  809. */
  810. getChildByType(name: string, type: string): Nullable<Control>;
  811. /**
  812. * Search for a specific control in children
  813. * @param control defines the control to look for
  814. * @returns true if the control is in child list
  815. */
  816. containsControl(control: Control): boolean;
  817. /**
  818. * Adds a new control to the current container
  819. * @param control defines the control to add
  820. * @returns the current container
  821. */
  822. addControl(control: Nullable<Control>): Container;
  823. /**
  824. * Removes a control from the current container
  825. * @param control defines the control to remove
  826. * @returns the current container
  827. */
  828. removeControl(control: Control): Container;
  829. /** @hidden */
  830. _reOrderControl(control: Control): void;
  831. /** @hidden */
  832. _markMatrixAsDirty(): void;
  833. /** @hidden */
  834. _markAllAsDirty(): void;
  835. /** @hidden */
  836. protected _localDraw(context: CanvasRenderingContext2D): void;
  837. /** @hidden */
  838. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  839. /** @hidden */
  840. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  841. /** @hidden */
  842. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  843. /** @hidden */
  844. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  845. /** @hidden */
  846. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  847. /** Releases associated resources */
  848. dispose(): void;
  849. }
  850. }
  851. declare module 'babylonjs-gui/2D/controls/control' {
  852. import { Container } from "babylonjs-gui/2D/controls/container";
  853. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  854. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  855. import { Nullable, Vector2, AbstractMesh, Observable, Vector3, Scene } from "babylonjs";
  856. import { Measure } from "babylonjs-gui/2D/measure";
  857. import { Style } from "babylonjs-gui/2D/style";
  858. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/2D/math2D";
  859. /**
  860. * Root class used for all 2D controls
  861. * @see http://doc.babylonjs.com/how_to/gui#controls
  862. */
  863. export class Control {
  864. /** defines the name of the control */
  865. name?: string | undefined;
  866. /** @hidden */
  867. _root: Nullable<Container>;
  868. /** @hidden */
  869. _host: AdvancedDynamicTexture;
  870. /** Gets or sets the control parent */
  871. parent: Nullable<Container>;
  872. /** @hidden */
  873. _currentMeasure: Measure;
  874. /** @hidden */
  875. _width: ValueAndUnit;
  876. /** @hidden */
  877. _height: ValueAndUnit;
  878. /** @hidden */
  879. protected _fontOffset: {
  880. ascent: number;
  881. height: number;
  882. descent: number;
  883. };
  884. /** @hidden */
  885. protected _horizontalAlignment: number;
  886. /** @hidden */
  887. protected _verticalAlignment: number;
  888. /** @hidden */
  889. _tempParentMeasure: Measure;
  890. /** @hidden */
  891. protected _cachedParentMeasure: Measure;
  892. /** @hidden */
  893. _left: ValueAndUnit;
  894. /** @hidden */
  895. _top: ValueAndUnit;
  896. /** @hidden */
  897. protected _invertTransformMatrix: Matrix2D;
  898. /** @hidden */
  899. protected _transformedPosition: Vector2;
  900. /** @hidden */
  901. _linkedMesh: Nullable<AbstractMesh>;
  902. /** @hidden */
  903. _tag: any;
  904. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  905. isHitTestVisible: boolean;
  906. /** Gets or sets a boolean indicating if the control can block pointer events */
  907. isPointerBlocker: boolean;
  908. /** Gets or sets a boolean indicating if the control can be focusable */
  909. isFocusInvisible: boolean;
  910. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  911. shadowOffsetX: number;
  912. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  913. shadowOffsetY: number;
  914. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  915. shadowBlur: number;
  916. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  917. shadowColor: string;
  918. /** @hidden */
  919. protected _linkOffsetX: ValueAndUnit;
  920. /** @hidden */
  921. protected _linkOffsetY: ValueAndUnit;
  922. /** Gets the control type name */
  923. readonly typeName: string;
  924. /**
  925. * An event triggered when the pointer move over the control.
  926. */
  927. onPointerMoveObservable: Observable<Vector2>;
  928. /**
  929. * An event triggered when the pointer move out of the control.
  930. */
  931. onPointerOutObservable: Observable<Control>;
  932. /**
  933. * An event triggered when the pointer taps the control
  934. */
  935. onPointerDownObservable: Observable<Vector2WithInfo>;
  936. /**
  937. * An event triggered when pointer up
  938. */
  939. onPointerUpObservable: Observable<Vector2WithInfo>;
  940. /**
  941. * An event triggered when a control is clicked on
  942. */
  943. onPointerClickObservable: Observable<Vector2WithInfo>;
  944. /**
  945. * An event triggered when pointer enters the control
  946. */
  947. onPointerEnterObservable: Observable<Control>;
  948. /**
  949. * An event triggered when the control is marked as dirty
  950. */
  951. onDirtyObservable: Observable<Control>;
  952. /**
  953. * An event triggered after the control is drawn
  954. */
  955. onAfterDrawObservable: Observable<Control>;
  956. /** Gets or set information about font offsets (used to render and align text) */
  957. fontOffset: {
  958. ascent: number;
  959. height: number;
  960. descent: number;
  961. };
  962. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  963. alpha: number;
  964. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  965. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  966. */
  967. scaleX: number;
  968. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  969. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  970. */
  971. scaleY: number;
  972. /** Gets or sets the rotation angle (0 by default)
  973. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  974. */
  975. rotation: number;
  976. /** Gets or sets the transformation center on Y axis (0 by default)
  977. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  978. */
  979. transformCenterY: number;
  980. /** Gets or sets the transformation center on X axis (0 by default)
  981. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  982. */
  983. transformCenterX: number;
  984. /**
  985. * Gets or sets the horizontal alignment
  986. * @see http://doc.babylonjs.com/how_to/gui#alignments
  987. */
  988. horizontalAlignment: number;
  989. /**
  990. * Gets or sets the vertical alignment
  991. * @see http://doc.babylonjs.com/how_to/gui#alignments
  992. */
  993. verticalAlignment: number;
  994. /**
  995. * Gets or sets control width
  996. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  997. */
  998. width: string | number;
  999. /**
  1000. * Gets control width in pixel
  1001. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1002. */
  1003. readonly widthInPixels: number;
  1004. /**
  1005. * Gets or sets control height
  1006. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1007. */
  1008. height: string | number;
  1009. /**
  1010. * Gets control height in pixel
  1011. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1012. */
  1013. readonly heightInPixels: number;
  1014. /** Gets or set font family */
  1015. fontFamily: string;
  1016. /** Gets or sets font style */
  1017. fontStyle: string;
  1018. /** Gets or sets font weight */
  1019. fontWeight: string;
  1020. /**
  1021. * Gets or sets style
  1022. * @see http://doc.babylonjs.com/how_to/gui#styles
  1023. */
  1024. style: Nullable<Style>;
  1025. /** @hidden */
  1026. readonly _isFontSizeInPercentage: boolean;
  1027. /** Gets font size in pixels */
  1028. readonly fontSizeInPixels: number;
  1029. /** Gets or sets font size */
  1030. fontSize: string | number;
  1031. /** Gets or sets foreground color */
  1032. color: string;
  1033. /** Gets or sets z index which is used to reorder controls on the z axis */
  1034. zIndex: number;
  1035. /** Gets or sets a boolean indicating if the control can be rendered */
  1036. notRenderable: boolean;
  1037. /** Gets or sets a boolean indicating if the control is visible */
  1038. isVisible: boolean;
  1039. /** Gets a boolean indicating that the control needs to update its rendering */
  1040. readonly isDirty: boolean;
  1041. /**
  1042. * Gets or sets a value indicating the padding to use on the left of the control
  1043. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1044. */
  1045. paddingLeft: string | number;
  1046. /**
  1047. * Gets a value indicating the padding in pixels to use on the left of the control
  1048. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1049. */
  1050. readonly paddingLeftInPixels: number;
  1051. /**
  1052. * Gets or sets a value indicating the padding to use on the right of the control
  1053. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1054. */
  1055. paddingRight: string | number;
  1056. /**
  1057. * Gets a value indicating the padding in pixels to use on the right of the control
  1058. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1059. */
  1060. readonly paddingRightInPixels: number;
  1061. /**
  1062. * Gets or sets a value indicating the padding to use on the top of the control
  1063. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1064. */
  1065. paddingTop: string | number;
  1066. /**
  1067. * Gets a value indicating the padding in pixels to use on the top of the control
  1068. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1069. */
  1070. readonly paddingTopInPixels: number;
  1071. /**
  1072. * Gets or sets a value indicating the padding to use on the bottom of the control
  1073. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1074. */
  1075. paddingBottom: string | number;
  1076. /**
  1077. * Gets a value indicating the padding in pixels to use on the bottom of the control
  1078. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1079. */
  1080. readonly paddingBottomInPixels: number;
  1081. /**
  1082. * Gets or sets a value indicating the left coordinate of the control
  1083. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1084. */
  1085. left: string | number;
  1086. /**
  1087. * Gets a value indicating the left coordinate in pixels of the control
  1088. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1089. */
  1090. readonly leftInPixels: number;
  1091. /**
  1092. * Gets or sets a value indicating the top coordinate of the control
  1093. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1094. */
  1095. top: string | number;
  1096. /**
  1097. * Gets a value indicating the top coordinate in pixels of the control
  1098. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1099. */
  1100. readonly topInPixels: number;
  1101. /**
  1102. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1103. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1104. */
  1105. linkOffsetX: string | number;
  1106. /**
  1107. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  1108. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1109. */
  1110. readonly linkOffsetXInPixels: number;
  1111. /**
  1112. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1113. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1114. */
  1115. linkOffsetY: string | number;
  1116. /**
  1117. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  1118. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1119. */
  1120. readonly linkOffsetYInPixels: number;
  1121. /** Gets the center coordinate on X axis */
  1122. readonly centerX: number;
  1123. /** Gets the center coordinate on Y axis */
  1124. readonly centerY: number;
  1125. /**
  1126. * Creates a new control
  1127. * @param name defines the name of the control
  1128. */
  1129. constructor(
  1130. /** defines the name of the control */
  1131. name?: string | undefined);
  1132. /** @hidden */
  1133. protected _getTypeName(): string;
  1134. /** @hidden */
  1135. _resetFontCache(): void;
  1136. /**
  1137. * Gets coordinates in local control space
  1138. * @param globalCoordinates defines the coordinates to transform
  1139. * @returns the new coordinates in local space
  1140. */
  1141. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1142. /**
  1143. * Gets coordinates in local control space
  1144. * @param globalCoordinates defines the coordinates to transform
  1145. * @param result defines the target vector2 where to store the result
  1146. * @returns the current control
  1147. */
  1148. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  1149. /**
  1150. * Gets coordinates in parent local control space
  1151. * @param globalCoordinates defines the coordinates to transform
  1152. * @returns the new coordinates in parent local space
  1153. */
  1154. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1155. /**
  1156. * Move the current control to a vector3 position projected onto the screen.
  1157. * @param position defines the target position
  1158. * @param scene defines the hosting scene
  1159. */
  1160. moveToVector3(position: Vector3, scene: Scene): void;
  1161. /**
  1162. * Link current control with a target mesh
  1163. * @param mesh defines the mesh to link with
  1164. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1165. */
  1166. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  1167. /** @hidden */
  1168. _moveToProjectedPosition(projectedPosition: Vector3): void;
  1169. /** @hidden */
  1170. _markMatrixAsDirty(): void;
  1171. /** @hidden */
  1172. _markAsDirty(): void;
  1173. /** @hidden */
  1174. _markAllAsDirty(): void;
  1175. /** @hidden */
  1176. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  1177. /** @hidden */
  1178. protected _transform(context: CanvasRenderingContext2D): void;
  1179. /** @hidden */
  1180. protected _applyStates(context: CanvasRenderingContext2D): void;
  1181. /** @hidden */
  1182. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1183. /** @hidden */
  1184. protected _clip(context: CanvasRenderingContext2D): void;
  1185. /** @hidden */
  1186. _measure(): void;
  1187. /** @hidden */
  1188. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1189. /** @hidden */
  1190. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1191. /** @hidden */
  1192. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1193. /** @hidden */
  1194. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1195. /**
  1196. * Tests if a given coordinates belong to the current control
  1197. * @param x defines x coordinate to test
  1198. * @param y defines y coordinate to test
  1199. * @returns true if the coordinates are inside the control
  1200. */
  1201. contains(x: number, y: number): boolean;
  1202. /** @hidden */
  1203. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1204. /** @hidden */
  1205. _onPointerMove(target: Control, coordinates: Vector2): void;
  1206. /** @hidden */
  1207. _onPointerEnter(target: Control): boolean;
  1208. /** @hidden */
  1209. _onPointerOut(target: Control): void;
  1210. /** @hidden */
  1211. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1212. /** @hidden */
  1213. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1214. /** @hidden */
  1215. _forcePointerUp(pointerId?: Nullable<number>): void;
  1216. /** @hidden */
  1217. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1218. /** Releases associated resources */
  1219. dispose(): void;
  1220. /** HORIZONTAL_ALIGNMENT_LEFT */
  1221. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1222. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1223. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1224. /** HORIZONTAL_ALIGNMENT_CENTER */
  1225. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1226. /** VERTICAL_ALIGNMENT_TOP */
  1227. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1228. /** VERTICAL_ALIGNMENT_BOTTOM */
  1229. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1230. /** VERTICAL_ALIGNMENT_CENTER */
  1231. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1232. /** @hidden */
  1233. static _GetFontOffset(font: string): {
  1234. ascent: number;
  1235. height: number;
  1236. descent: number;
  1237. };
  1238. /**
  1239. * Creates a stack panel that can be used to render headers
  1240. * @param control defines the control to associate with the header
  1241. * @param text defines the text of the header
  1242. * @param size defines the size of the header
  1243. * @param options defines options used to configure the header
  1244. * @returns a new StackPanel
  1245. * @ignore
  1246. * @hidden
  1247. */
  1248. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1249. isHorizontal: boolean;
  1250. controlFirst: boolean;
  1251. }) => any;
  1252. /** @hidden */
  1253. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1254. }
  1255. }
  1256. declare module 'babylonjs-gui/2D/controls/ellipse' {
  1257. import { Container } from "babylonjs-gui/2D/controls/container";
  1258. import { Measure } from "babylonjs-gui/2D/measure";
  1259. /** Class used to create 2D ellipse containers */
  1260. export class Ellipse extends Container {
  1261. name?: string | undefined;
  1262. /** Gets or sets border thickness */
  1263. thickness: number;
  1264. /**
  1265. * Creates a new Ellipse
  1266. * @param name defines the control name
  1267. */
  1268. constructor(name?: string | undefined);
  1269. protected _getTypeName(): string;
  1270. protected _localDraw(context: CanvasRenderingContext2D): void;
  1271. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1272. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1273. }
  1274. }
  1275. declare module 'babylonjs-gui/2D/controls/grid' {
  1276. import { Container } from "babylonjs-gui/2D/controls/container";
  1277. import { Control } from "babylonjs-gui/2D/controls/control";
  1278. import { Measure } from "babylonjs-gui/2D/measure";
  1279. /**
  1280. * Class used to create a 2D grid container
  1281. */
  1282. export class Grid extends Container {
  1283. name?: string | undefined;
  1284. /** Gets the list of children */
  1285. readonly children: Control[];
  1286. /**
  1287. * Adds a new row to the grid
  1288. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1289. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1290. * @returns the current grid
  1291. */
  1292. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1293. /**
  1294. * Adds a new column to the grid
  1295. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1296. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1297. * @returns the current grid
  1298. */
  1299. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1300. /**
  1301. * Update a row definition
  1302. * @param index defines the index of the row to update
  1303. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1304. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1305. * @returns the current grid
  1306. */
  1307. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1308. /**
  1309. * Update a column definition
  1310. * @param index defines the index of the column to update
  1311. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1312. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1313. * @returns the current grid
  1314. */
  1315. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1316. /**
  1317. * Remove a column definition at specified index
  1318. * @param index defines the index of the column to remove
  1319. * @returns the current grid
  1320. */
  1321. removeColumnDefinition(index: number): Grid;
  1322. /**
  1323. * Remove a row definition at specified index
  1324. * @param index defines the index of the row to remove
  1325. * @returns the current grid
  1326. */
  1327. removeRowDefinition(index: number): Grid;
  1328. /**
  1329. * Adds a new control to the current grid
  1330. * @param control defines the control to add
  1331. * @param row defines the row where to add the control (0 by default)
  1332. * @param column defines the column where to add the control (0 by default)
  1333. * @returns the current grid
  1334. */
  1335. addControl(control: Control, row?: number, column?: number): Grid;
  1336. /**
  1337. * Removes a control from the current container
  1338. * @param control defines the control to remove
  1339. * @returns the current container
  1340. */
  1341. removeControl(control: Control): Container;
  1342. /**
  1343. * Creates a new Grid
  1344. * @param name defines control name
  1345. */
  1346. constructor(name?: string | undefined);
  1347. protected _getTypeName(): string;
  1348. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1349. /** Releases associated resources */
  1350. dispose(): void;
  1351. }
  1352. }
  1353. declare module 'babylonjs-gui/2D/controls/image' {
  1354. import { Control } from "babylonjs-gui/2D/controls/control";
  1355. import { Nullable } from "babylonjs";
  1356. import { Measure } from "babylonjs-gui/2D/measure";
  1357. /**
  1358. * Class used to create 2D images
  1359. */
  1360. class GUIImage extends Control {
  1361. name?: string | undefined;
  1362. /**
  1363. * Gets or sets the left coordinate in the source image
  1364. */
  1365. sourceLeft: number;
  1366. /**
  1367. * Gets or sets the top coordinate in the source image
  1368. */
  1369. sourceTop: number;
  1370. /**
  1371. * Gets or sets the width to capture in the source image
  1372. */
  1373. sourceWidth: number;
  1374. /**
  1375. * Gets or sets the height to capture in the source image
  1376. */
  1377. sourceHeight: number;
  1378. /**
  1379. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1380. * @see http://doc.babylonjs.com/how_to/gui#image
  1381. */
  1382. autoScale: boolean;
  1383. /** Gets or sets the streching mode used by the image */
  1384. stretch: number;
  1385. /**
  1386. * Gets or sets the internal DOM image used to render the control
  1387. */
  1388. domImage: HTMLImageElement;
  1389. /**
  1390. * Gets or sets image source url
  1391. */
  1392. source: Nullable<string>;
  1393. /**
  1394. * Gets or sets the cell width to use when animation sheet is enabled
  1395. * @see http://doc.babylonjs.com/how_to/gui#image
  1396. */
  1397. cellWidth: number;
  1398. /**
  1399. * Gets or sets the cell height to use when animation sheet is enabled
  1400. * @see http://doc.babylonjs.com/how_to/gui#image
  1401. */
  1402. cellHeight: number;
  1403. /**
  1404. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1405. * @see http://doc.babylonjs.com/how_to/gui#image
  1406. */
  1407. cellId: number;
  1408. /**
  1409. * Creates a new Image
  1410. * @param name defines the control name
  1411. * @param url defines the image url
  1412. */
  1413. constructor(name?: string | undefined, url?: Nullable<string>);
  1414. protected _getTypeName(): string;
  1415. /** Force the control to synchronize with its content */
  1416. synchronizeSizeWithContent(): void;
  1417. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1418. /** STRETCH_NONE */
  1419. static readonly STRETCH_NONE: number;
  1420. /** STRETCH_FILL */
  1421. static readonly STRETCH_FILL: number;
  1422. /** STRETCH_UNIFORM */
  1423. static readonly STRETCH_UNIFORM: number;
  1424. /** STRETCH_EXTEND */
  1425. static readonly STRETCH_EXTEND: number;
  1426. }
  1427. export { GUIImage as Image };
  1428. }
  1429. declare module 'babylonjs-gui/2D/controls/inputText' {
  1430. import { Control } from "babylonjs-gui/2D/controls/control";
  1431. import { IFocusableControl } from "babylonjs-gui/2D/advancedDynamicTexture";
  1432. import { Observable, Vector2 } from "babylonjs";
  1433. import { Measure } from "babylonjs-gui/2D/measure";
  1434. /**
  1435. * Class used to create input text control
  1436. */
  1437. export class InputText extends Control implements IFocusableControl {
  1438. name?: string | undefined;
  1439. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1440. promptMessage: string;
  1441. /** Observable raised when the text changes */
  1442. onTextChangedObservable: Observable<InputText>;
  1443. /** Observable raised just before an entered character is to be added */
  1444. onBeforeKeyAddObservable: Observable<InputText>;
  1445. /** Observable raised when the control gets the focus */
  1446. onFocusObservable: Observable<InputText>;
  1447. /** Observable raised when the control loses the focus */
  1448. onBlurObservable: Observable<InputText>;
  1449. /** Gets or sets the maximum width allowed by the control */
  1450. maxWidth: string | number;
  1451. /** Gets the maximum width allowed by the control in pixels */
  1452. readonly maxWidthInPixels: number;
  1453. /** Gets or sets control margin */
  1454. margin: string;
  1455. /** Gets control margin in pixels */
  1456. readonly marginInPixels: number;
  1457. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1458. autoStretchWidth: boolean;
  1459. /** Gets or sets border thickness */
  1460. thickness: number;
  1461. /** Gets or sets the background color when focused */
  1462. focusedBackground: string;
  1463. /** Gets or sets the background color */
  1464. background: string;
  1465. /** Gets or sets the placeholder color */
  1466. placeholderColor: string;
  1467. /** Gets or sets the text displayed when the control is empty */
  1468. placeholderText: string;
  1469. /** Gets or sets the dead key flag */
  1470. deadKey: boolean;
  1471. /** Gets or sets if the current key should be added */
  1472. addKey: boolean;
  1473. /** Gets or sets the value of the current key being entered */
  1474. currentKey: string;
  1475. /** Gets or sets the text displayed in the control */
  1476. text: string;
  1477. /** Gets or sets control width */
  1478. width: string | number;
  1479. /**
  1480. * Creates a new InputText
  1481. * @param name defines the control name
  1482. * @param text defines the text of the control
  1483. */
  1484. constructor(name?: string | undefined, text?: string);
  1485. /** @hidden */
  1486. onBlur(): void;
  1487. /** @hidden */
  1488. onFocus(): void;
  1489. protected _getTypeName(): string;
  1490. /** @hidden */
  1491. processKey(keyCode: number, key?: string): void;
  1492. /** @hidden */
  1493. processKeyboard(evt: KeyboardEvent): void;
  1494. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1495. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1496. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1497. protected _beforeRenderText(text: string): string;
  1498. dispose(): void;
  1499. }
  1500. }
  1501. declare module 'babylonjs-gui/2D/controls/inputPassword' {
  1502. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1503. /**
  1504. * Class used to create a password control
  1505. */
  1506. export class InputPassword extends InputText {
  1507. protected _beforeRenderText(text: string): string;
  1508. }
  1509. }
  1510. declare module 'babylonjs-gui/2D/controls/line' {
  1511. import { Control } from "babylonjs-gui/2D/controls/control";
  1512. import { Vector3, Scene } from "babylonjs";
  1513. import { Measure } from "babylonjs-gui/2D/measure";
  1514. /** Class used to render 2D lines */
  1515. export class Line extends Control {
  1516. name?: string | undefined;
  1517. /** Gets or sets the dash pattern */
  1518. dash: Array<number>;
  1519. /** Gets or sets the control connected with the line end */
  1520. connectedControl: Control;
  1521. /** Gets or sets start coordinates on X axis */
  1522. x1: string | number;
  1523. /** Gets or sets start coordinates on Y axis */
  1524. y1: string | number;
  1525. /** Gets or sets end coordinates on X axis */
  1526. x2: string | number;
  1527. /** Gets or sets end coordinates on Y axis */
  1528. y2: string | number;
  1529. /** Gets or sets line width */
  1530. lineWidth: number;
  1531. /** Gets or sets horizontal alignment */
  1532. horizontalAlignment: number;
  1533. /** Gets or sets vertical alignment */
  1534. verticalAlignment: number;
  1535. /**
  1536. * Creates a new Line
  1537. * @param name defines the control name
  1538. */
  1539. constructor(name?: string | undefined);
  1540. protected _getTypeName(): string;
  1541. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1542. _measure(): void;
  1543. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1544. /**
  1545. * Move one end of the line given 3D cartesian coordinates.
  1546. * @param position Targeted world position
  1547. * @param scene Scene
  1548. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1549. */
  1550. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  1551. /**
  1552. * Move one end of the line to a position in screen absolute space.
  1553. * @param projectedPosition Position in screen absolute space (X, Y)
  1554. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1555. */
  1556. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  1557. }
  1558. }
  1559. declare module 'babylonjs-gui/2D/controls/multiLine' {
  1560. import { Control } from "babylonjs-gui/2D/controls/control";
  1561. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  1562. import { AbstractMesh } from "babylonjs";
  1563. import { Measure } from "babylonjs-gui/2D/measure";
  1564. /**
  1565. * Class used to create multi line control
  1566. */
  1567. export class MultiLine extends Control {
  1568. name?: string | undefined;
  1569. /**
  1570. * Creates a new MultiLine
  1571. * @param name defines the control name
  1572. */
  1573. constructor(name?: string | undefined);
  1574. /** Gets or sets dash pattern */
  1575. dash: Array<number>;
  1576. /**
  1577. * Gets point stored at specified index
  1578. * @param index defines the index to look for
  1579. * @returns the requested point if found
  1580. */
  1581. getAt(index: number): MultiLinePoint;
  1582. /** Function called when a point is updated */
  1583. onPointUpdate: () => void;
  1584. /**
  1585. * Adds new points to the point collection
  1586. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1587. * @returns the list of created MultiLinePoint
  1588. */
  1589. add(...items: (AbstractMesh | Control | {
  1590. x: string | number;
  1591. y: string | number;
  1592. })[]): MultiLinePoint[];
  1593. /**
  1594. * Adds a new point to the point collection
  1595. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1596. * @returns the created MultiLinePoint
  1597. */
  1598. push(item?: (AbstractMesh | Control | {
  1599. x: string | number;
  1600. y: string | number;
  1601. })): MultiLinePoint;
  1602. /**
  1603. * Remove a specific value or point from the active point collection
  1604. * @param value defines the value or point to remove
  1605. */
  1606. remove(value: number | MultiLinePoint): void;
  1607. /** Gets or sets line width */
  1608. lineWidth: number;
  1609. horizontalAlignment: number;
  1610. verticalAlignment: number;
  1611. protected _getTypeName(): string;
  1612. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1613. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1614. _measure(): void;
  1615. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1616. dispose(): void;
  1617. }
  1618. }
  1619. declare module 'babylonjs-gui/2D/controls/radioButton' {
  1620. import { Control } from "babylonjs-gui/2D/controls/control";
  1621. import { Observable, Vector2 } from "babylonjs";
  1622. import { Measure } from "babylonjs-gui/2D/measure";
  1623. /**
  1624. * Class used to create radio button controls
  1625. */
  1626. export class RadioButton extends Control {
  1627. name?: string | undefined;
  1628. /** Gets or sets border thickness */
  1629. thickness: number;
  1630. /** Gets or sets group name */
  1631. group: string;
  1632. /** Observable raised when isChecked is changed */
  1633. onIsCheckedChangedObservable: Observable<boolean>;
  1634. /** Gets or sets a value indicating the ratio between overall size and check size */
  1635. checkSizeRatio: number;
  1636. /** Gets or sets background color */
  1637. background: string;
  1638. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1639. isChecked: boolean;
  1640. /**
  1641. * Creates a new RadioButton
  1642. * @param name defines the control name
  1643. */
  1644. constructor(name?: string | undefined);
  1645. protected _getTypeName(): string;
  1646. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1647. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1648. }
  1649. }
  1650. declare module 'babylonjs-gui/2D/controls/stackPanel' {
  1651. import { Container } from "babylonjs-gui/2D/controls/container";
  1652. import { Measure } from "babylonjs-gui/2D/measure";
  1653. /**
  1654. * Class used to create a 2D stack panel container
  1655. */
  1656. export class StackPanel extends Container {
  1657. name?: string | undefined;
  1658. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1659. isVertical: boolean;
  1660. /** Gets or sets panel width */
  1661. width: string | number;
  1662. /** Gets or sets panel height */
  1663. height: string | number;
  1664. /**
  1665. * Creates a new StackPanel
  1666. * @param name defines control name
  1667. */
  1668. constructor(name?: string | undefined);
  1669. protected _getTypeName(): string;
  1670. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1671. }
  1672. }
  1673. declare module 'babylonjs-gui/2D/controls/textBlock' {
  1674. import { Observable } from "babylonjs";
  1675. import { Measure } from "babylonjs-gui/2D/measure";
  1676. import { Control } from "babylonjs-gui/2D/controls/control";
  1677. /**
  1678. * Enum that determines the text-wrapping mode to use.
  1679. */
  1680. export enum TextWrapping {
  1681. /**
  1682. * Clip the text when it's larger than Control.width; this is the default mode.
  1683. */
  1684. Clip = 0,
  1685. /**
  1686. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  1687. */
  1688. WordWrap = 1,
  1689. /**
  1690. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  1691. */
  1692. Ellipsis = 2
  1693. }
  1694. /**
  1695. * Class used to create text block control
  1696. */
  1697. export class TextBlock extends Control {
  1698. /**
  1699. * Defines the name of the control
  1700. */
  1701. name?: string | undefined;
  1702. /**
  1703. * An event triggered after the text is changed
  1704. */
  1705. onTextChangedObservable: Observable<TextBlock>;
  1706. /**
  1707. * An event triggered after the text was broken up into lines
  1708. */
  1709. onLinesReadyObservable: Observable<TextBlock>;
  1710. /**
  1711. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  1712. */
  1713. readonly lines: any[];
  1714. /**
  1715. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1716. */
  1717. resizeToFit: boolean;
  1718. /**
  1719. * Gets or sets a boolean indicating if text must be wrapped
  1720. */
  1721. textWrapping: TextWrapping | boolean;
  1722. /**
  1723. * Gets or sets text to display
  1724. */
  1725. text: string;
  1726. /**
  1727. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1728. */
  1729. textHorizontalAlignment: number;
  1730. /**
  1731. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1732. */
  1733. textVerticalAlignment: number;
  1734. /**
  1735. * Gets or sets line spacing value
  1736. */
  1737. lineSpacing: string | number;
  1738. /**
  1739. * Gets or sets outlineWidth of the text to display
  1740. */
  1741. outlineWidth: number;
  1742. /**
  1743. * Gets or sets outlineColor of the text to display
  1744. */
  1745. outlineColor: string;
  1746. /**
  1747. * Creates a new TextBlock object
  1748. * @param name defines the name of the control
  1749. * @param text defines the text to display (emptry string by default)
  1750. */
  1751. constructor(
  1752. /**
  1753. * Defines the name of the control
  1754. */
  1755. name?: string | undefined, text?: string);
  1756. protected _getTypeName(): string;
  1757. /** @hidden */
  1758. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1759. protected _applyStates(context: CanvasRenderingContext2D): void;
  1760. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1761. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  1762. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  1763. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  1764. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  1765. protected _renderLines(context: CanvasRenderingContext2D): void;
  1766. /**
  1767. * Given a width constraint applied on the text block, find the expected height
  1768. * @returns expected height
  1769. */
  1770. computeExpectedHeight(): number;
  1771. dispose(): void;
  1772. }
  1773. }
  1774. declare module 'babylonjs-gui/2D/controls/virtualKeyboard' {
  1775. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1776. import { Observable, Nullable } from "babylonjs";
  1777. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1778. /**
  1779. * Class used to store key control properties
  1780. */
  1781. export class KeyPropertySet {
  1782. /** Width */
  1783. width?: string;
  1784. /** Height */
  1785. height?: string;
  1786. /** Left padding */
  1787. paddingLeft?: string;
  1788. /** Right padding */
  1789. paddingRight?: string;
  1790. /** Top padding */
  1791. paddingTop?: string;
  1792. /** Bottom padding */
  1793. paddingBottom?: string;
  1794. /** Foreground color */
  1795. color?: string;
  1796. /** Background color */
  1797. background?: string;
  1798. }
  1799. /**
  1800. * Class used to create virtual keyboard
  1801. */
  1802. export class VirtualKeyboard extends StackPanel {
  1803. /** Observable raised when a key is pressed */
  1804. onKeyPressObservable: Observable<string>;
  1805. /** Gets or sets default key button width */
  1806. defaultButtonWidth: string;
  1807. /** Gets or sets default key button height */
  1808. defaultButtonHeight: string;
  1809. /** Gets or sets default key button left padding */
  1810. defaultButtonPaddingLeft: string;
  1811. /** Gets or sets default key button right padding */
  1812. defaultButtonPaddingRight: string;
  1813. /** Gets or sets default key button top padding */
  1814. defaultButtonPaddingTop: string;
  1815. /** Gets or sets default key button bottom padding */
  1816. defaultButtonPaddingBottom: string;
  1817. /** Gets or sets default key button foreground color */
  1818. defaultButtonColor: string;
  1819. /** Gets or sets default key button background color */
  1820. defaultButtonBackground: string;
  1821. /** Gets or sets shift button foreground color */
  1822. shiftButtonColor: string;
  1823. /** Gets or sets shift button thickness*/
  1824. selectedShiftThickness: number;
  1825. /** Gets shift key state */
  1826. shiftState: number;
  1827. protected _getTypeName(): string;
  1828. /**
  1829. * Adds a new row of keys
  1830. * @param keys defines the list of keys to add
  1831. * @param propertySets defines the associated property sets
  1832. */
  1833. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  1834. /**
  1835. * Set the shift key to a specific state
  1836. * @param shiftState defines the new shift state
  1837. */
  1838. applyShiftState(shiftState: number): void;
  1839. /** Gets the input text control attached with the keyboard */
  1840. readonly connectedInputText: Nullable<InputText>;
  1841. /**
  1842. * Connects the keyboard with an input text control
  1843. * @param input defines the target control
  1844. */
  1845. connect(input: InputText): void;
  1846. /**
  1847. * Disconnects the keyboard from an input text control
  1848. */
  1849. disconnect(): void;
  1850. /**
  1851. * Creates a new keyboard using a default layout
  1852. * @returns a new VirtualKeyboard
  1853. */
  1854. static CreateDefaultLayout(): VirtualKeyboard;
  1855. }
  1856. }
  1857. declare module 'babylonjs-gui/2D/controls/slider' {
  1858. import { Control } from "babylonjs-gui/2D/controls/control";
  1859. import { Observable, Vector2 } from "babylonjs";
  1860. import { Measure } from "babylonjs-gui/2D/measure";
  1861. /**
  1862. * Class used to create slider controls
  1863. */
  1864. export class Slider extends Control {
  1865. name?: string | undefined;
  1866. /** Observable raised when the sldier value changes */
  1867. onValueChangedObservable: Observable<number>;
  1868. /** Gets or sets border color */
  1869. borderColor: string;
  1870. /** Gets or sets background color */
  1871. background: string;
  1872. /** Gets or sets main bar offset */
  1873. barOffset: string | number;
  1874. /** Gets main bar offset in pixels*/
  1875. readonly barOffsetInPixels: number;
  1876. /** Gets or sets thumb width */
  1877. thumbWidth: string | number;
  1878. /** Gets thumb width in pixels */
  1879. readonly thumbWidthInPixels: number;
  1880. /** Gets or sets minimum value */
  1881. minimum: number;
  1882. /** Gets or sets maximum value */
  1883. maximum: number;
  1884. /** Gets or sets current value */
  1885. value: number;
  1886. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  1887. isVertical: boolean;
  1888. /** Gets or sets a boolean indicating if the thumb should be round or square */
  1889. isThumbCircle: boolean;
  1890. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  1891. isThumbClamped: boolean;
  1892. /**
  1893. * Creates a new Slider
  1894. * @param name defines the control name
  1895. */
  1896. constructor(name?: string | undefined);
  1897. protected _getTypeName(): string;
  1898. protected _getThumbThickness(type: string, backgroundLength: number): number;
  1899. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1900. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1901. _onPointerMove(target: Control, coordinates: Vector2): void;
  1902. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1903. }
  1904. }
  1905. declare module 'babylonjs-gui/2D/controls/rectangle' {
  1906. import { Container } from "babylonjs-gui/2D/controls/container";
  1907. import { Measure } from "babylonjs-gui/2D/measure";
  1908. /** Class used to create rectangle container */
  1909. export class Rectangle extends Container {
  1910. name?: string | undefined;
  1911. /** Gets or sets border thickness */
  1912. thickness: number;
  1913. /** Gets or sets the corner radius angle */
  1914. cornerRadius: number;
  1915. /**
  1916. * Creates a new Rectangle
  1917. * @param name defines the control name
  1918. */
  1919. constructor(name?: string | undefined);
  1920. protected _getTypeName(): string;
  1921. protected _localDraw(context: CanvasRenderingContext2D): void;
  1922. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1923. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1924. }
  1925. }
  1926. declare module 'babylonjs-gui/2D/controls/statics' {
  1927. /**
  1928. * Forcing an export so that this code will execute
  1929. * @hidden
  1930. */
  1931. const name = "Statics";
  1932. export { name };
  1933. }
  1934. declare module 'babylonjs-gui/3D/controls/abstractButton3D' {
  1935. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  1936. import { TransformNode, Scene } from "babylonjs";
  1937. /**
  1938. * Class used as a root to all buttons
  1939. */
  1940. export class AbstractButton3D extends Control3D {
  1941. /**
  1942. * Creates a new button
  1943. * @param name defines the control name
  1944. */
  1945. constructor(name?: string);
  1946. protected _getTypeName(): string;
  1947. protected _createNode(scene: Scene): TransformNode;
  1948. }
  1949. }
  1950. declare module 'babylonjs-gui/3D/controls/button3D' {
  1951. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  1952. import { Material, int, Scene, TransformNode, AbstractMesh } from "babylonjs";
  1953. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  1954. import { Control } from "babylonjs-gui/2D/controls/control";
  1955. /**
  1956. * Class used to create a button in 3D
  1957. */
  1958. export class Button3D extends AbstractButton3D {
  1959. /** @hidden */
  1960. protected _currentMaterial: Material;
  1961. /**
  1962. * Gets or sets the texture resolution used to render content (512 by default)
  1963. */
  1964. contentResolution: int;
  1965. /**
  1966. * Gets or sets the texture scale ratio used to render content (2 by default)
  1967. */
  1968. contentScaleRatio: number;
  1969. protected _disposeFacadeTexture(): void;
  1970. protected _resetContent(): void;
  1971. /**
  1972. * Creates a new button
  1973. * @param name defines the control name
  1974. */
  1975. constructor(name?: string);
  1976. /**
  1977. * Gets or sets the GUI 2D content used to display the button's facade
  1978. */
  1979. content: Control;
  1980. /**
  1981. * Apply the facade texture (created from the content property).
  1982. * This function can be overloaded by child classes
  1983. * @param facadeTexture defines the AdvancedDynamicTexture to use
  1984. */
  1985. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  1986. protected _getTypeName(): string;
  1987. protected _createNode(scene: Scene): TransformNode;
  1988. protected _affectMaterial(mesh: AbstractMesh): void;
  1989. /**
  1990. * Releases all associated resources
  1991. */
  1992. dispose(): void;
  1993. }
  1994. }
  1995. declare module 'babylonjs-gui/3D/controls/container3D' {
  1996. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  1997. import { Scene, Nullable, TransformNode } from "babylonjs";
  1998. /**
  1999. * Class used to create containers for controls
  2000. */
  2001. export class Container3D extends Control3D {
  2002. /**
  2003. * Gets the list of child controls
  2004. */
  2005. protected _children: Control3D[];
  2006. /**
  2007. * Gets the list of child controls
  2008. */
  2009. readonly children: Array<Control3D>;
  2010. /**
  2011. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2012. * This is helpful to optimize layout operation when adding multiple children in a row
  2013. */
  2014. blockLayout: boolean;
  2015. /**
  2016. * Creates a new container
  2017. * @param name defines the container name
  2018. */
  2019. constructor(name?: string);
  2020. /**
  2021. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2022. * @returns the current container
  2023. */
  2024. updateLayout(): Container3D;
  2025. /**
  2026. * Gets a boolean indicating if the given control is in the children of this control
  2027. * @param control defines the control to check
  2028. * @returns true if the control is in the child list
  2029. */
  2030. containsControl(control: Control3D): boolean;
  2031. /**
  2032. * Adds a control to the children of this control
  2033. * @param control defines the control to add
  2034. * @returns the current container
  2035. */
  2036. addControl(control: Control3D): Container3D;
  2037. /**
  2038. * This function will be called everytime a new control is added
  2039. */
  2040. protected _arrangeChildren(): void;
  2041. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2042. /**
  2043. * Removes a control from the children of this control
  2044. * @param control defines the control to remove
  2045. * @returns the current container
  2046. */
  2047. removeControl(control: Control3D): Container3D;
  2048. protected _getTypeName(): string;
  2049. /**
  2050. * Releases all associated resources
  2051. */
  2052. dispose(): void;
  2053. /** Control rotation will remain unchanged */
  2054. static readonly UNSET_ORIENTATION: number;
  2055. /** Control will rotate to make it look at sphere central axis */
  2056. static readonly FACEORIGIN_ORIENTATION: number;
  2057. /** Control will rotate to make it look back at sphere central axis */
  2058. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2059. /** Control will rotate to look at z axis (0, 0, 1) */
  2060. static readonly FACEFORWARD_ORIENTATION: number;
  2061. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2062. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2063. }
  2064. }
  2065. declare module 'babylonjs-gui/3D/controls/control3D' {
  2066. import { IDisposable, IBehaviorAware, Nullable, TransformNode, Vector3, Observable, Behavior, AbstractMesh, Scene } from "babylonjs";
  2067. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  2068. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  2069. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2070. /**
  2071. * Class used as base class for controls
  2072. */
  2073. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  2074. /** Defines the control name */
  2075. name?: string | undefined;
  2076. /** @hidden */
  2077. _host: GUI3DManager;
  2078. /** Gets or sets the control position in world space */
  2079. position: Vector3;
  2080. /** Gets or sets the control scaling in world space */
  2081. scaling: Vector3;
  2082. /** Callback used to start pointer enter animation */
  2083. pointerEnterAnimation: () => void;
  2084. /** Callback used to start pointer out animation */
  2085. pointerOutAnimation: () => void;
  2086. /** Callback used to start pointer down animation */
  2087. pointerDownAnimation: () => void;
  2088. /** Callback used to start pointer up animation */
  2089. pointerUpAnimation: () => void;
  2090. /**
  2091. * An event triggered when the pointer move over the control
  2092. */
  2093. onPointerMoveObservable: Observable<Vector3>;
  2094. /**
  2095. * An event triggered when the pointer move out of the control
  2096. */
  2097. onPointerOutObservable: Observable<Control3D>;
  2098. /**
  2099. * An event triggered when the pointer taps the control
  2100. */
  2101. onPointerDownObservable: Observable<Vector3WithInfo>;
  2102. /**
  2103. * An event triggered when pointer is up
  2104. */
  2105. onPointerUpObservable: Observable<Vector3WithInfo>;
  2106. /**
  2107. * An event triggered when a control is clicked on (with a mouse)
  2108. */
  2109. onPointerClickObservable: Observable<Vector3WithInfo>;
  2110. /**
  2111. * An event triggered when pointer enters the control
  2112. */
  2113. onPointerEnterObservable: Observable<Control3D>;
  2114. /**
  2115. * Gets or sets the parent container
  2116. */
  2117. parent: Nullable<Container3D>;
  2118. /**
  2119. * Gets the list of attached behaviors
  2120. * @see http://doc.babylonjs.com/features/behaviour
  2121. */
  2122. readonly behaviors: Behavior<Control3D>[];
  2123. /**
  2124. * Attach a behavior to the control
  2125. * @see http://doc.babylonjs.com/features/behaviour
  2126. * @param behavior defines the behavior to attach
  2127. * @returns the current control
  2128. */
  2129. addBehavior(behavior: Behavior<Control3D>): Control3D;
  2130. /**
  2131. * Remove an attached behavior
  2132. * @see http://doc.babylonjs.com/features/behaviour
  2133. * @param behavior defines the behavior to attach
  2134. * @returns the current control
  2135. */
  2136. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  2137. /**
  2138. * Gets an attached behavior by name
  2139. * @param name defines the name of the behavior to look for
  2140. * @see http://doc.babylonjs.com/features/behaviour
  2141. * @returns null if behavior was not found else the requested behavior
  2142. */
  2143. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  2144. /** Gets or sets a boolean indicating if the control is visible */
  2145. isVisible: boolean;
  2146. /**
  2147. * Creates a new control
  2148. * @param name defines the control name
  2149. */
  2150. constructor(
  2151. /** Defines the control name */
  2152. name?: string | undefined);
  2153. /**
  2154. * Gets a string representing the class name
  2155. */
  2156. readonly typeName: string;
  2157. protected _getTypeName(): string;
  2158. /**
  2159. * Gets the transform node used by this control
  2160. */
  2161. readonly node: Nullable<TransformNode>;
  2162. /**
  2163. * Gets the mesh used to render this control
  2164. */
  2165. readonly mesh: Nullable<AbstractMesh>;
  2166. /**
  2167. * Link the control as child of the given node
  2168. * @param node defines the node to link to. Use null to unlink the control
  2169. * @returns the current control
  2170. */
  2171. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  2172. /** @hidden **/
  2173. _prepareNode(scene: Scene): void;
  2174. /**
  2175. * Node creation.
  2176. * Can be overriden by children
  2177. * @param scene defines the scene where the node must be attached
  2178. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  2179. */
  2180. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2181. /**
  2182. * Affect a material to the given mesh
  2183. * @param mesh defines the mesh which will represent the control
  2184. */
  2185. protected _affectMaterial(mesh: AbstractMesh): void;
  2186. /** @hidden */
  2187. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  2188. /** @hidden */
  2189. _onPointerEnter(target: Control3D): boolean;
  2190. /** @hidden */
  2191. _onPointerOut(target: Control3D): void;
  2192. /** @hidden */
  2193. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  2194. /** @hidden */
  2195. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2196. /** @hidden */
  2197. forcePointerUp(pointerId?: Nullable<number>): void;
  2198. /** @hidden */
  2199. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  2200. /** @hidden */
  2201. _disposeNode(): void;
  2202. /**
  2203. * Releases all associated resources
  2204. */
  2205. dispose(): void;
  2206. }
  2207. }
  2208. declare module 'babylonjs-gui/3D/controls/cylinderPanel' {
  2209. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2210. import { float, Vector3 } from "babylonjs";
  2211. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2212. /**
  2213. * Class used to create a container panel deployed on the surface of a cylinder
  2214. */
  2215. export class CylinderPanel extends VolumeBasedPanel {
  2216. /**
  2217. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  2218. */
  2219. radius: float;
  2220. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2221. }
  2222. }
  2223. declare module 'babylonjs-gui/3D/controls/holographicButton' {
  2224. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2225. import { Mesh, StandardMaterial, Scene, TransformNode } from "babylonjs";
  2226. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  2227. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2228. /**
  2229. * Class used to create a holographic button in 3D
  2230. */
  2231. export class HolographicButton extends Button3D {
  2232. /**
  2233. * Gets or sets text for the button
  2234. */
  2235. text: string;
  2236. /**
  2237. * Gets or sets the image url for the button
  2238. */
  2239. imageUrl: string;
  2240. /**
  2241. * Gets the back material used by this button
  2242. */
  2243. readonly backMaterial: FluentMaterial;
  2244. /**
  2245. * Gets the front material used by this button
  2246. */
  2247. readonly frontMaterial: FluentMaterial;
  2248. /**
  2249. * Gets the plate material used by this button
  2250. */
  2251. readonly plateMaterial: StandardMaterial;
  2252. /**
  2253. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  2254. */
  2255. readonly shareMaterials: boolean;
  2256. /**
  2257. * Creates a new button
  2258. * @param name defines the control name
  2259. */
  2260. constructor(name?: string, shareMaterials?: boolean);
  2261. protected _getTypeName(): string;
  2262. protected _createNode(scene: Scene): TransformNode;
  2263. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2264. protected _affectMaterial(mesh: Mesh): void;
  2265. /**
  2266. * Releases all associated resources
  2267. */
  2268. dispose(): void;
  2269. }
  2270. }
  2271. declare module 'babylonjs-gui/3D/controls/meshButton3D' {
  2272. import { Scene, TransformNode, AbstractMesh, Mesh } from "babylonjs";
  2273. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2274. /**
  2275. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  2276. */
  2277. export class MeshButton3D extends Button3D {
  2278. /** @hidden */
  2279. protected _currentMesh: Mesh;
  2280. /**
  2281. * Creates a new 3D button based on a mesh
  2282. * @param mesh mesh to become a 3D button
  2283. * @param name defines the control name
  2284. */
  2285. constructor(mesh: Mesh, name?: string);
  2286. protected _getTypeName(): string;
  2287. protected _createNode(scene: Scene): TransformNode;
  2288. protected _affectMaterial(mesh: AbstractMesh): void;
  2289. }
  2290. }
  2291. declare module 'babylonjs-gui/3D/controls/planePanel' {
  2292. import { Vector3 } from "babylonjs";
  2293. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2294. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2295. /**
  2296. * Class used to create a container panel deployed on the surface of a plane
  2297. */
  2298. export class PlanePanel extends VolumeBasedPanel {
  2299. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2300. }
  2301. }
  2302. declare module 'babylonjs-gui/3D/controls/scatterPanel' {
  2303. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2304. import { float, Vector3 } from "babylonjs";
  2305. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2306. /**
  2307. * Class used to create a container panel where items get randomized planar mapping
  2308. */
  2309. export class ScatterPanel extends VolumeBasedPanel {
  2310. /**
  2311. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  2312. */
  2313. iteration: float;
  2314. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2315. protected _finalProcessing(): void;
  2316. }
  2317. }
  2318. declare module 'babylonjs-gui/3D/controls/spherePanel' {
  2319. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2320. import { float, Vector3 } from "babylonjs";
  2321. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2322. /**
  2323. * Class used to create a container panel deployed on the surface of a sphere
  2324. */
  2325. export class SpherePanel extends VolumeBasedPanel {
  2326. /**
  2327. * Gets or sets the radius of the sphere where to project controls (5 by default)
  2328. */
  2329. radius: float;
  2330. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2331. }
  2332. }
  2333. declare module 'babylonjs-gui/3D/controls/stackPanel3D' {
  2334. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2335. /**
  2336. * Class used to create a stack panel in 3D on XY plane
  2337. */
  2338. export class StackPanel3D extends Container3D {
  2339. /**
  2340. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  2341. */
  2342. isVertical: boolean;
  2343. /**
  2344. * Gets or sets the distance between elements
  2345. */
  2346. margin: number;
  2347. /**
  2348. * Creates new StackPanel
  2349. * @param isVertical
  2350. */
  2351. constructor(isVertical?: boolean);
  2352. protected _arrangeChildren(): void;
  2353. }
  2354. }
  2355. declare module 'babylonjs-gui/3D/controls/volumeBasedPanel' {
  2356. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2357. import { int, Vector3 } from "babylonjs";
  2358. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2359. /**
  2360. * Abstract class used to create a container panel deployed on the surface of a volume
  2361. */
  2362. export abstract class VolumeBasedPanel extends Container3D {
  2363. protected _cellWidth: number;
  2364. protected _cellHeight: number;
  2365. /**
  2366. * Gets or sets the distance between elements
  2367. */
  2368. margin: number;
  2369. /**
  2370. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  2371. * | Value | Type | Description |
  2372. * | ----- | ----------------------------------- | ----------- |
  2373. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  2374. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  2375. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  2376. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  2377. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  2378. */
  2379. orientation: number;
  2380. /**
  2381. * Gets or sets the number of columns requested (10 by default).
  2382. * The panel will automatically compute the number of rows based on number of child controls.
  2383. */
  2384. columns: int;
  2385. /**
  2386. * Gets or sets a the number of rows requested.
  2387. * The panel will automatically compute the number of columns based on number of child controls.
  2388. */
  2389. rows: int;
  2390. /**
  2391. * Creates new VolumeBasedPanel
  2392. */
  2393. constructor();
  2394. protected _arrangeChildren(): void;
  2395. /** Child classes must implement this function to provide correct control positioning */
  2396. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2397. /** Child classes can implement this function to provide additional processing */
  2398. protected _finalProcessing(): void;
  2399. }
  2400. }
  2401. declare module 'babylonjs-gui/3D/materials/fluentMaterial' {
  2402. import { MaterialDefines, PushMaterial, Color3, Color4, Vector3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, Matrix, Mesh } from "babylonjs";
  2403. /** @hidden */
  2404. export class FluentMaterialDefines extends MaterialDefines {
  2405. INNERGLOW: boolean;
  2406. BORDER: boolean;
  2407. HOVERLIGHT: boolean;
  2408. constructor();
  2409. }
  2410. /**
  2411. * Class used to render controls with fluent desgin
  2412. */
  2413. export class FluentMaterial extends PushMaterial {
  2414. /**
  2415. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  2416. */
  2417. innerGlowColorIntensity: number;
  2418. /**
  2419. * Gets or sets the inner glow color (white by default)
  2420. */
  2421. innerGlowColor: Color3;
  2422. /**
  2423. * Gets or sets alpha value (default is 1.0)
  2424. */
  2425. alpha: number;
  2426. /**
  2427. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  2428. */
  2429. albedoColor: Color3;
  2430. /**
  2431. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  2432. */
  2433. renderBorders: boolean;
  2434. /**
  2435. * Gets or sets border width (default is 0.5)
  2436. */
  2437. borderWidth: number;
  2438. /**
  2439. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  2440. */
  2441. edgeSmoothingValue: number;
  2442. /**
  2443. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  2444. */
  2445. borderMinValue: number;
  2446. /**
  2447. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  2448. */
  2449. renderHoverLight: boolean;
  2450. /**
  2451. * Gets or sets the radius used to render the hover light (default is 0.15)
  2452. */
  2453. hoverRadius: number;
  2454. /**
  2455. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  2456. */
  2457. hoverColor: Color4;
  2458. /**
  2459. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  2460. */
  2461. hoverPosition: Vector3;
  2462. /**
  2463. * Creates a new Fluent material
  2464. * @param name defines the name of the material
  2465. * @param scene defines the hosting scene
  2466. */
  2467. constructor(name: string, scene: Scene);
  2468. needAlphaBlending(): boolean;
  2469. needAlphaTesting(): boolean;
  2470. getAlphaTestTexture(): Nullable<BaseTexture>;
  2471. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  2472. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  2473. getActiveTextures(): BaseTexture[];
  2474. hasTexture(texture: BaseTexture): boolean;
  2475. dispose(forceDisposeEffect?: boolean): void;
  2476. clone(name: string): FluentMaterial;
  2477. serialize(): any;
  2478. getClassName(): string;
  2479. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  2480. }
  2481. }