babylon.gui.d.ts 140 KB

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