babylon.gui.d.ts 137 KB

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