babylon.gui.d.ts 134 KB

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