babylon.gui.d.ts 139 KB

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