babylon.gui.module.d.ts 236 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268
  1. /*BabylonJS GUI*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/Gulp/babylonjs
  4. declare module 'babylonjs-gui' {
  5. export * from "babylonjs-gui/2D";
  6. export * from "babylonjs-gui/3D";
  7. }
  8. declare module 'babylonjs-gui/2D' {
  9. export * from "babylonjs-gui/2D/controls";
  10. export * from "babylonjs-gui/2D/advancedDynamicTexture";
  11. export * from "babylonjs-gui/2D/math2D";
  12. export * from "babylonjs-gui/2D/measure";
  13. export * from "babylonjs-gui/2D/multiLinePoint";
  14. export * from "babylonjs-gui/2D/style";
  15. export * from "babylonjs-gui/2D/valueAndUnit";
  16. }
  17. declare module 'babylonjs-gui/3D' {
  18. export * from "babylonjs-gui/3D/controls";
  19. export * from "babylonjs-gui/3D/materials";
  20. export * from "babylonjs-gui/3D/charting";
  21. export * from "babylonjs-gui/3D/gui3DManager";
  22. export * from "babylonjs-gui/3D/vector3WithInfo";
  23. }
  24. declare module 'babylonjs-gui/2D/controls' {
  25. export * from "babylonjs-gui/2D/controls/button";
  26. export * from "babylonjs-gui/2D/controls/checkbox";
  27. export * from "babylonjs-gui/2D/controls/colorpicker";
  28. export * from "babylonjs-gui/2D/controls/container";
  29. export * from "babylonjs-gui/2D/controls/control";
  30. export * from "babylonjs-gui/2D/controls/ellipse";
  31. export * from "babylonjs-gui/2D/controls/grid";
  32. export * from "babylonjs-gui/2D/controls/image";
  33. export * from "babylonjs-gui/2D/controls/inputText";
  34. export * from "babylonjs-gui/2D/controls/inputPassword";
  35. export * from "babylonjs-gui/2D/controls/line";
  36. export * from "babylonjs-gui/2D/controls/multiLine";
  37. export * from "babylonjs-gui/2D/controls/radioButton";
  38. export * from "babylonjs-gui/2D/controls/stackPanel";
  39. export * from "babylonjs-gui/2D/controls/textBlock";
  40. export * from "babylonjs-gui/2D/controls/virtualKeyboard";
  41. export * from "babylonjs-gui/2D/controls/slider";
  42. export * from "babylonjs-gui/2D/controls/rectangle";
  43. export * from "babylonjs-gui/2D/controls/displayGrid";
  44. export * from "babylonjs-gui/2D/controls/statics";
  45. }
  46. declare module 'babylonjs-gui/2D/advancedDynamicTexture' {
  47. import { DynamicTexture, Nullable, Layer, Viewport, Scene, Vector3, Matrix, Vector2, AbstractMesh } from "babylonjs";
  48. import { Container } from "babylonjs-gui/2D/controls/container";
  49. import { Control } from "babylonjs-gui/2D/controls/control";
  50. import { Style } from "babylonjs-gui/2D/style";
  51. /**
  52. * Interface used to define a control that can receive focus
  53. */
  54. export interface IFocusableControl {
  55. /**
  56. * Function called when the control receives the focus
  57. */
  58. onFocus(): void;
  59. /**
  60. * Function called when the control loses the focus
  61. */
  62. onBlur(): void;
  63. /**
  64. * Function called to let the control handle keyboard events
  65. * @param evt defines the current keyboard event
  66. */
  67. processKeyboard(evt: KeyboardEvent): void;
  68. }
  69. /**
  70. * Class used to create texture to support 2D GUI elements
  71. * @see http://doc.babylonjs.com/how_to/gui
  72. */
  73. export class AdvancedDynamicTexture extends DynamicTexture {
  74. /** @hidden */
  75. _rootContainer: Container;
  76. /** @hidden */
  77. _lastPickedControl: Control;
  78. /** @hidden */
  79. _lastControlOver: {
  80. [pointerId: number]: Control;
  81. };
  82. /** @hidden */
  83. _lastControlDown: {
  84. [pointerId: number]: Control;
  85. };
  86. /** @hidden */
  87. _capturingControl: {
  88. [pointerId: number]: Control;
  89. };
  90. /** @hidden */
  91. _shouldBlockPointer: boolean;
  92. /** @hidden */
  93. _layerToDispose: Nullable<Layer>;
  94. /** @hidden */
  95. _linkedControls: Control[];
  96. /**
  97. * Gets or sets a boolean defining if alpha is stored as premultiplied
  98. */
  99. premulAlpha: boolean;
  100. /**
  101. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  102. * Useful when you want more antialiasing
  103. */
  104. renderScale: number;
  105. /** Gets or sets the background color */
  106. background: string;
  107. /**
  108. * Gets or sets the ideal width used to design controls.
  109. * The GUI will then rescale everything accordingly
  110. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  111. */
  112. idealWidth: number;
  113. /**
  114. * Gets or sets the ideal height used to design controls.
  115. * The GUI will then rescale everything accordingly
  116. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  117. */
  118. idealHeight: number;
  119. /**
  120. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  121. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  122. */
  123. useSmallestIdeal: boolean;
  124. /**
  125. * Gets or sets a boolean indicating if adaptive scaling must be used
  126. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  127. */
  128. renderAtIdealSize: boolean;
  129. /**
  130. * Gets the underlying layer used to render the texture when in fullscreen mode
  131. */
  132. readonly layer: Nullable<Layer>;
  133. /**
  134. * Gets the root container control
  135. */
  136. readonly rootContainer: Container;
  137. /**
  138. * Gets or sets the current focused control
  139. */
  140. focusedControl: Nullable<IFocusableControl>;
  141. /**
  142. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  143. */
  144. isForeground: boolean;
  145. /**
  146. * Creates a new AdvancedDynamicTexture
  147. * @param name defines the name of the texture
  148. * @param width defines the width of the texture
  149. * @param height defines the height of the texture
  150. * @param scene defines the hosting scene
  151. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  152. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  153. */
  154. constructor(name: string, width: number | undefined, height: number | undefined, scene: Nullable<Scene>, generateMipMaps?: boolean, samplingMode?: number);
  155. /**
  156. * Function used to execute a function on all controls
  157. * @param func defines the function to execute
  158. * @param container defines the container where controls belong. If null the root container will be used
  159. */
  160. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  161. /**
  162. * Marks the texture as dirty forcing a complete update
  163. */
  164. markAsDirty(): void;
  165. /**
  166. * Helper function used to create a new style
  167. * @returns a new style
  168. * @see http://doc.babylonjs.com/how_to/gui#styles
  169. */
  170. createStyle(): Style;
  171. /**
  172. * Adds a new control to the root container
  173. * @param control defines the control to add
  174. * @returns the current texture
  175. */
  176. addControl(control: Control): AdvancedDynamicTexture;
  177. /**
  178. * Removes a control from the root container
  179. * @param control defines the control to remove
  180. * @returns the current texture
  181. */
  182. removeControl(control: Control): AdvancedDynamicTexture;
  183. /**
  184. * Release all resources
  185. */
  186. dispose(): void;
  187. /** @hidden */
  188. _getGlobalViewport(scene: Scene): Viewport;
  189. /**
  190. * Get screen coordinates for a vector3
  191. * @param position defines the position to project
  192. * @param worldMatrix defines the world matrix to use
  193. * @returns the projected position
  194. */
  195. getProjectedPosition(position: Vector3, worldMatrix: Matrix): Vector2;
  196. /** @hidden */
  197. _cleanControlAfterRemovalFromList(list: {
  198. [pointerId: number]: Control;
  199. }, control: Control): void;
  200. /** @hidden */
  201. _cleanControlAfterRemoval(control: Control): void;
  202. /** Attach to all scene events required to support pointer events */
  203. attach(): void;
  204. /**
  205. * Connect the texture to a hosting mesh to enable interactions
  206. * @param mesh defines the mesh to attach to
  207. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  208. */
  209. attachToMesh(mesh: AbstractMesh, supportPointerMove?: boolean): void;
  210. /**
  211. * Move the focus to a specific control
  212. * @param control defines the control which will receive the focus
  213. */
  214. moveFocusToControl(control: IFocusableControl): void;
  215. /**
  216. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  217. * @param mesh defines the mesh which will receive the texture
  218. * @param width defines the texture width (1024 by default)
  219. * @param height defines the texture height (1024 by default)
  220. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  221. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  222. * @returns a new AdvancedDynamicTexture
  223. */
  224. static CreateForMesh(mesh: AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  225. /**
  226. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  227. * In this mode the texture will rely on a layer for its rendering.
  228. * This allows it to be treated like any other layer.
  229. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  230. * LayerMask is set through advancedTexture.layer.layerMask
  231. * @param name defines name for the texture
  232. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  233. * @param scene defines the hsoting scene
  234. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  235. * @returns a new AdvancedDynamicTexture
  236. */
  237. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: Nullable<Scene>, sampling?: number): AdvancedDynamicTexture;
  238. }
  239. }
  240. declare module 'babylonjs-gui/2D/math2D' {
  241. import { Vector2, Nullable } from "babylonjs";
  242. /**
  243. * Class used to transport Vector2 information for pointer events
  244. */
  245. export class Vector2WithInfo extends Vector2 {
  246. /** defines the current mouse button index */
  247. buttonIndex: number;
  248. /**
  249. * Creates a new Vector2WithInfo
  250. * @param source defines the vector2 data to transport
  251. * @param buttonIndex defines the current mouse button index
  252. */
  253. constructor(source: Vector2,
  254. /** defines the current mouse button index */
  255. buttonIndex?: number);
  256. }
  257. /** Class used to provide 2D matrix features */
  258. export class Matrix2D {
  259. /** Gets the internal array of 6 floats used to store matrix data */
  260. m: Float32Array;
  261. /**
  262. * Creates a new matrix
  263. * @param m00 defines value for (0, 0)
  264. * @param m01 defines value for (0, 1)
  265. * @param m10 defines value for (1, 0)
  266. * @param m11 defines value for (1, 1)
  267. * @param m20 defines value for (2, 0)
  268. * @param m21 defines value for (2, 1)
  269. */
  270. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  271. /**
  272. * Fills the matrix from direct values
  273. * @param m00 defines value for (0, 0)
  274. * @param m01 defines value for (0, 1)
  275. * @param m10 defines value for (1, 0)
  276. * @param m11 defines value for (1, 1)
  277. * @param m20 defines value for (2, 0)
  278. * @param m21 defines value for (2, 1)
  279. * @returns the current modified matrix
  280. */
  281. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  282. /**
  283. * Gets matrix determinant
  284. * @returns the determinant
  285. */
  286. determinant(): number;
  287. /**
  288. * Inverses the matrix and stores it in a target matrix
  289. * @param result defines the target matrix
  290. * @returns the current matrix
  291. */
  292. invertToRef(result: Matrix2D): Matrix2D;
  293. /**
  294. * Multiplies the current matrix with another one
  295. * @param other defines the second operand
  296. * @param result defines the target matrix
  297. * @returns the current matrix
  298. */
  299. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  300. /**
  301. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  302. * @param x defines the x coordinate to transform
  303. * @param y defines the x coordinate to transform
  304. * @param result defines the target vector2
  305. * @returns the current matrix
  306. */
  307. transformCoordinates(x: number, y: number, result: Vector2): Matrix2D;
  308. /**
  309. * Creates an identity matrix
  310. * @returns a new matrix
  311. */
  312. static Identity(): Matrix2D;
  313. /**
  314. * Creates a translation matrix and stores it in a target matrix
  315. * @param x defines the x coordinate of the translation
  316. * @param y defines the y coordinate of the translation
  317. * @param result defines the target matrix
  318. */
  319. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  320. /**
  321. * Creates a scaling matrix and stores it in a target matrix
  322. * @param x defines the x coordinate of the scaling
  323. * @param y defines the y coordinate of the scaling
  324. * @param result defines the target matrix
  325. */
  326. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  327. /**
  328. * Creates a rotation matrix and stores it in a target matrix
  329. * @param angle defines the rotation angle
  330. * @param result defines the target matrix
  331. */
  332. static RotationToRef(angle: number, result: Matrix2D): void;
  333. /**
  334. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  335. * @param tx defines the x coordinate of the translation
  336. * @param ty defines the y coordinate of the translation
  337. * @param angle defines the rotation angle
  338. * @param scaleX defines the x coordinate of the scaling
  339. * @param scaleY defines the y coordinate of the scaling
  340. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  341. * @param result defines the target matrix
  342. */
  343. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: Nullable<Matrix2D>, result: Matrix2D): void;
  344. }
  345. }
  346. declare module 'babylonjs-gui/2D/measure' {
  347. /**
  348. * Class used to store 2D control sizes
  349. */
  350. export class Measure {
  351. /** defines left coordinate */
  352. left: number;
  353. /** defines top coordinate */
  354. top: number;
  355. /** defines width dimension */
  356. width: number;
  357. /** defines height dimension */
  358. height: number;
  359. /**
  360. * Creates a new measure
  361. * @param left defines left coordinate
  362. * @param top defines top coordinate
  363. * @param width defines width dimension
  364. * @param height defines height dimension
  365. */
  366. constructor(
  367. /** defines left coordinate */
  368. left: number,
  369. /** defines top coordinate */
  370. top: number,
  371. /** defines width dimension */
  372. width: number,
  373. /** defines height dimension */
  374. height: number);
  375. /**
  376. * Copy from another measure
  377. * @param other defines the other measure to copy from
  378. */
  379. copyFrom(other: Measure): void;
  380. /**
  381. * Check equality between this measure and another one
  382. * @param other defines the other measures
  383. * @returns true if both measures are equals
  384. */
  385. isEqualsTo(other: Measure): boolean;
  386. /**
  387. * Creates an empty measure
  388. * @returns a new measure
  389. */
  390. static Empty(): Measure;
  391. }
  392. }
  393. declare module 'babylonjs-gui/2D/multiLinePoint' {
  394. import { MultiLine } from "babylonjs-gui/2D/controls/multiLine";
  395. import { Control } from "babylonjs-gui/2D/controls/control";
  396. import { AbstractMesh, Nullable, Vector2 } from "babylonjs";
  397. /**
  398. * Class used to store a point for a MultiLine object.
  399. * The point can be pure 2D coordinates, a mesh or a control
  400. */
  401. export class MultiLinePoint {
  402. /** @hidden */
  403. _point: Vector2;
  404. /**
  405. * Creates a new MultiLinePoint
  406. * @param multiLine defines the source MultiLine object
  407. */
  408. constructor(multiLine: MultiLine);
  409. /** Gets or sets x coordinate */
  410. x: string | number;
  411. /** Gets or sets y coordinate */
  412. y: string | number;
  413. /** Gets or sets the control associated with this point */
  414. control: Nullable<Control>;
  415. /** Gets or sets the mesh associated with this point */
  416. mesh: Nullable<AbstractMesh>;
  417. /**
  418. * Gets a translation vector
  419. * @returns the translation vector
  420. */
  421. translate(): Vector2;
  422. /** Release associated resources */
  423. dispose(): void;
  424. }
  425. }
  426. declare module 'babylonjs-gui/2D/style' {
  427. import { IDisposable, Observable } from "babylonjs";
  428. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  429. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  430. /**
  431. * Define a style used by control to automatically setup properties based on a template.
  432. * Only support font related properties so far
  433. */
  434. export class Style implements IDisposable {
  435. /** @hidden */
  436. _host: AdvancedDynamicTexture;
  437. /** @hidden */
  438. _fontSize: ValueAndUnit;
  439. /**
  440. * Observable raised when the style values are changed
  441. */
  442. onChangedObservable: Observable<Style>;
  443. /**
  444. * Creates a new style object
  445. * @param host defines the AdvancedDynamicTexture which hosts this style
  446. */
  447. constructor(host: AdvancedDynamicTexture);
  448. /**
  449. * Gets or sets the font size
  450. */
  451. fontSize: string | number;
  452. /**
  453. * Gets or sets the font family
  454. */
  455. fontFamily: string;
  456. /**
  457. * Gets or sets the font style
  458. */
  459. fontStyle: string;
  460. /** Gets or sets font weight */
  461. fontWeight: string;
  462. /** Dispose all associated resources */
  463. dispose(): void;
  464. }
  465. }
  466. declare module 'babylonjs-gui/2D/valueAndUnit' {
  467. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  468. /**
  469. * Class used to specific a value and its associated unit
  470. */
  471. export class ValueAndUnit {
  472. /** defines the unit to store */
  473. unit: number;
  474. /** defines a boolean indicating if the value can be negative */
  475. negativeValueAllowed: boolean;
  476. /**
  477. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  478. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  479. */
  480. ignoreAdaptiveScaling: boolean;
  481. /**
  482. * Creates a new ValueAndUnit
  483. * @param value defines the value to store
  484. * @param unit defines the unit to store
  485. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  486. */
  487. constructor(value: number,
  488. /** defines the unit to store */
  489. unit?: number,
  490. /** defines a boolean indicating if the value can be negative */
  491. negativeValueAllowed?: boolean);
  492. /** Gets a boolean indicating if the value is a percentage */
  493. readonly isPercentage: boolean;
  494. /** Gets a boolean indicating if the value is store as pixel */
  495. readonly isPixel: boolean;
  496. /** Gets direct internal value */
  497. readonly internalValue: number;
  498. /**
  499. * Gets value as pixel
  500. * @param host defines the root host
  501. * @param refValue defines the reference value for percentages
  502. * @returns the value as pixel
  503. */
  504. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  505. /**
  506. * Gets the value accordingly to its unit
  507. * @param host defines the root host
  508. * @returns the value
  509. */
  510. getValue(host: AdvancedDynamicTexture): number;
  511. /**
  512. * Gets a string representation of the value
  513. * @param host defines the root host
  514. * @returns a string
  515. */
  516. toString(host: AdvancedDynamicTexture): string;
  517. /**
  518. * Store a value parsed from a string
  519. * @param source defines the source string
  520. * @returns true if the value was successfully parsed
  521. */
  522. fromString(source: string | number): boolean;
  523. /** UNITMODE_PERCENTAGE */
  524. static readonly UNITMODE_PERCENTAGE: number;
  525. /** UNITMODE_PIXEL */
  526. static readonly UNITMODE_PIXEL: number;
  527. }
  528. }
  529. declare module 'babylonjs-gui/3D/controls' {
  530. export * from "babylonjs-gui/3D/controls/abstractButton3D";
  531. export * from "babylonjs-gui/3D/controls/button3D";
  532. export * from "babylonjs-gui/3D/controls/container3D";
  533. export * from "babylonjs-gui/3D/controls/control3D";
  534. export * from "babylonjs-gui/3D/controls/cylinderPanel";
  535. export * from "babylonjs-gui/3D/controls/holographicButton";
  536. export * from "babylonjs-gui/3D/controls/meshButton3D";
  537. export * from "babylonjs-gui/3D/controls/planePanel";
  538. export * from "babylonjs-gui/3D/controls/scatterPanel";
  539. export * from "babylonjs-gui/3D/controls/spherePanel";
  540. export * from "babylonjs-gui/3D/controls/stackPanel3D";
  541. export * from "babylonjs-gui/3D/controls/volumeBasedPanel";
  542. }
  543. declare module 'babylonjs-gui/3D/materials' {
  544. export * from "babylonjs-gui/3D/materials/fluentMaterial";
  545. }
  546. declare module 'babylonjs-gui/3D/charting' {
  547. export * from "babylonjs-gui/3D/charting/dataSeries";
  548. export * from "babylonjs-gui/3D/charting/chart";
  549. export * from "babylonjs-gui/3D/charting/barGraph";
  550. }
  551. declare module 'babylonjs-gui/3D/gui3DManager' {
  552. import { IDisposable, Scene, Nullable, UtilityLayerRenderer, Observable, Vector3, Material } from "babylonjs";
  553. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  554. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  555. /**
  556. * Class used to manage 3D user interface
  557. * @see http://doc.babylonjs.com/how_to/gui3d
  558. */
  559. export class GUI3DManager implements IDisposable {
  560. /** @hidden */
  561. _lastPickedControl: Control3D;
  562. /** @hidden */
  563. _lastControlOver: {
  564. [pointerId: number]: Control3D;
  565. };
  566. /** @hidden */
  567. _lastControlDown: {
  568. [pointerId: number]: Control3D;
  569. };
  570. /**
  571. * Observable raised when the point picked by the pointer events changed
  572. */
  573. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  574. /** @hidden */
  575. _sharedMaterials: {
  576. [key: string]: Material;
  577. };
  578. /** Gets the hosting scene */
  579. readonly scene: Scene;
  580. /** Gets associated utility layer */
  581. readonly utilityLayer: Nullable<UtilityLayerRenderer>;
  582. /**
  583. * Creates a new GUI3DManager
  584. * @param scene
  585. */
  586. constructor(scene?: Scene);
  587. /**
  588. * Gets the root container
  589. */
  590. readonly rootContainer: Container3D;
  591. /**
  592. * Gets a boolean indicating if the given control is in the root child list
  593. * @param control defines the control to check
  594. * @returns true if the control is in the root child list
  595. */
  596. containsControl(control: Control3D): boolean;
  597. /**
  598. * Adds a control to the root child list
  599. * @param control defines the control to add
  600. * @returns the current manager
  601. */
  602. addControl(control: Control3D): GUI3DManager;
  603. /**
  604. * Removes a control from the root child list
  605. * @param control defines the control to remove
  606. * @returns the current container
  607. */
  608. removeControl(control: Control3D): GUI3DManager;
  609. /**
  610. * Releases all associated resources
  611. */
  612. dispose(): void;
  613. }
  614. }
  615. declare module 'babylonjs-gui/3D/vector3WithInfo' {
  616. import { Vector3 } from "babylonjs";
  617. /**
  618. * Class used to transport Vector3 information for pointer events
  619. */
  620. export class Vector3WithInfo extends Vector3 {
  621. /** defines the current mouse button index */
  622. buttonIndex: number;
  623. /**
  624. * Creates a new Vector3WithInfo
  625. * @param source defines the vector3 data to transport
  626. * @param buttonIndex defines the current mouse button index
  627. */
  628. constructor(source: Vector3,
  629. /** defines the current mouse button index */
  630. buttonIndex?: number);
  631. }
  632. }
  633. declare module 'babylonjs-gui/2D/controls/button' {
  634. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  635. import { Control } from "babylonjs-gui/2D/controls/control";
  636. import { Vector2 } from "babylonjs";
  637. /**
  638. * Class used to create 2D buttons
  639. */
  640. export class Button extends Rectangle {
  641. name?: string | undefined;
  642. /**
  643. * Function called to generate a pointer enter animation
  644. */
  645. pointerEnterAnimation: () => void;
  646. /**
  647. * Function called to generate a pointer out animation
  648. */
  649. pointerOutAnimation: () => void;
  650. /**
  651. * Function called to generate a pointer down animation
  652. */
  653. pointerDownAnimation: () => void;
  654. /**
  655. * Function called to generate a pointer up animation
  656. */
  657. pointerUpAnimation: () => void;
  658. /**
  659. * Creates a new Button
  660. * @param name defines the name of the button
  661. */
  662. constructor(name?: string | undefined);
  663. protected _getTypeName(): string;
  664. /** @hidden */
  665. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  666. /** @hidden */
  667. _onPointerEnter(target: Control): boolean;
  668. /** @hidden */
  669. _onPointerOut(target: Control): void;
  670. /** @hidden */
  671. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  672. /** @hidden */
  673. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  674. /**
  675. * Creates a new button made with an image and a text
  676. * @param name defines the name of the button
  677. * @param text defines the text of the button
  678. * @param imageUrl defines the url of the image
  679. * @returns a new Button
  680. */
  681. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  682. /**
  683. * Creates a new button made with an image
  684. * @param name defines the name of the button
  685. * @param imageUrl defines the url of the image
  686. * @returns a new Button
  687. */
  688. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  689. /**
  690. * Creates a new button made with a text
  691. * @param name defines the name of the button
  692. * @param text defines the text of the button
  693. * @returns a new Button
  694. */
  695. static CreateSimpleButton(name: string, text: string): Button;
  696. /**
  697. * Creates a new button made with an image and a centered text
  698. * @param name defines the name of the button
  699. * @param text defines the text of the button
  700. * @param imageUrl defines the url of the image
  701. * @returns a new Button
  702. */
  703. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  704. }
  705. }
  706. declare module 'babylonjs-gui/2D/controls/checkbox' {
  707. import { Control } from "babylonjs-gui/2D/controls/control";
  708. import { Measure } from "babylonjs-gui/2D/measure";
  709. import { Observable, Vector2 } from "babylonjs";
  710. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  711. /**
  712. * Class used to represent a 2D checkbox
  713. */
  714. export class Checkbox extends Control {
  715. name?: string | undefined;
  716. /** Gets or sets border thickness */
  717. thickness: number;
  718. /**
  719. * Observable raised when isChecked property changes
  720. */
  721. onIsCheckedChangedObservable: Observable<boolean>;
  722. /** Gets or sets a value indicating the ratio between overall size and check size */
  723. checkSizeRatio: number;
  724. /** Gets or sets background color */
  725. background: string;
  726. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  727. isChecked: boolean;
  728. /**
  729. * Creates a new CheckBox
  730. * @param name defines the control name
  731. */
  732. constructor(name?: string | undefined);
  733. protected _getTypeName(): string;
  734. /** @hidden */
  735. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  736. /** @hidden */
  737. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  738. /**
  739. * Utility function to easily create a checkbox with a header
  740. * @param title defines the label to use for the header
  741. * @param onValueChanged defines the callback to call when value changes
  742. * @returns a StackPanel containing the checkbox and a textBlock
  743. */
  744. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  745. }
  746. }
  747. declare module 'babylonjs-gui/2D/controls/colorpicker' {
  748. import { Control } from "babylonjs-gui/2D/controls/control";
  749. import { Color3, Observable, Vector2 } from "babylonjs";
  750. import { Measure } from "babylonjs-gui/2D/measure";
  751. /** Class used to create color pickers */
  752. export class ColorPicker extends Control {
  753. name?: string | undefined;
  754. /**
  755. * Observable raised when the value changes
  756. */
  757. onValueChangedObservable: Observable<Color3>;
  758. /** Gets or sets the color of the color picker */
  759. value: Color3;
  760. /** Gets or sets control width */
  761. width: string | number;
  762. /** Gets or sets control height */
  763. height: string | number;
  764. /** Gets or sets control size */
  765. size: string | number;
  766. /**
  767. * Creates a new ColorPicker
  768. * @param name defines the control name
  769. */
  770. constructor(name?: string | undefined);
  771. protected _getTypeName(): string;
  772. /** @hidden */
  773. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  774. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  775. _onPointerMove(target: Control, coordinates: Vector2): void;
  776. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  777. }
  778. }
  779. declare module 'babylonjs-gui/2D/controls/container' {
  780. import { Control } from "babylonjs-gui/2D/controls/control";
  781. import { Measure } from "babylonjs-gui/2D/measure";
  782. import { Nullable } from "babylonjs";
  783. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  784. /**
  785. * Root class for 2D containers
  786. * @see http://doc.babylonjs.com/how_to/gui#containers
  787. */
  788. export class Container extends Control {
  789. name?: string | undefined;
  790. /** @hidden */
  791. protected _children: Control[];
  792. /** @hidden */
  793. protected _measureForChildren: Measure;
  794. /** @hidden */
  795. protected _background: string;
  796. /** @hidden */
  797. protected _adaptWidthToChildren: boolean;
  798. /** @hidden */
  799. protected _adaptHeightToChildren: boolean;
  800. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  801. adaptHeightToChildren: boolean;
  802. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  803. adaptWidthToChildren: boolean;
  804. /** Gets or sets background color */
  805. background: string;
  806. /** Gets the list of children */
  807. readonly children: Control[];
  808. /**
  809. * Creates a new Container
  810. * @param name defines the name of the container
  811. */
  812. constructor(name?: string | undefined);
  813. protected _getTypeName(): string;
  814. /**
  815. * Gets a child using its name
  816. * @param name defines the child name to look for
  817. * @returns the child control if found
  818. */
  819. getChildByName(name: string): Nullable<Control>;
  820. /**
  821. * Gets a child using its type and its name
  822. * @param name defines the child name to look for
  823. * @param type defines the child type to look for
  824. * @returns the child control if found
  825. */
  826. getChildByType(name: string, type: string): Nullable<Control>;
  827. /**
  828. * Search for a specific control in children
  829. * @param control defines the control to look for
  830. * @returns true if the control is in child list
  831. */
  832. containsControl(control: Control): boolean;
  833. /**
  834. * Adds a new control to the current container
  835. * @param control defines the control to add
  836. * @returns the current container
  837. */
  838. addControl(control: Nullable<Control>): Container;
  839. /**
  840. * Removes all controls from the current container
  841. * @returns the current container
  842. */
  843. clearControls(): Container;
  844. /**
  845. * Removes a control from the current container
  846. * @param control defines the control to remove
  847. * @returns the current container
  848. */
  849. removeControl(control: Control): Container;
  850. /** @hidden */
  851. _reOrderControl(control: Control): void;
  852. /** @hidden */
  853. _markMatrixAsDirty(): void;
  854. /** @hidden */
  855. _markAllAsDirty(): void;
  856. /** @hidden */
  857. protected _localDraw(context: CanvasRenderingContext2D): void;
  858. /** @hidden */
  859. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  860. /** @hidden */
  861. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  862. /** @hidden */
  863. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  864. /** @hidden */
  865. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  866. /** @hidden */
  867. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  868. /** Releases associated resources */
  869. dispose(): void;
  870. }
  871. }
  872. declare module 'babylonjs-gui/2D/controls/control' {
  873. import { Container } from "babylonjs-gui/2D/controls/container";
  874. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  875. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  876. import { Nullable, Vector2, AbstractMesh, Observable, Vector3, Scene } from "babylonjs";
  877. import { Measure } from "babylonjs-gui/2D/measure";
  878. import { Style } from "babylonjs-gui/2D/style";
  879. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/2D/math2D";
  880. /**
  881. * Root class used for all 2D controls
  882. * @see http://doc.babylonjs.com/how_to/gui#controls
  883. */
  884. export class Control {
  885. /** defines the name of the control */
  886. name?: string | undefined;
  887. /** @hidden */
  888. _root: Nullable<Container>;
  889. /** @hidden */
  890. _host: AdvancedDynamicTexture;
  891. /** Gets or sets the control parent */
  892. parent: Nullable<Container>;
  893. /** @hidden */
  894. _currentMeasure: Measure;
  895. /** @hidden */
  896. _width: ValueAndUnit;
  897. /** @hidden */
  898. _height: ValueAndUnit;
  899. /** @hidden */
  900. protected _fontOffset: {
  901. ascent: number;
  902. height: number;
  903. descent: number;
  904. };
  905. /** @hidden */
  906. protected _horizontalAlignment: number;
  907. /** @hidden */
  908. protected _verticalAlignment: number;
  909. /** @hidden */
  910. _tempParentMeasure: Measure;
  911. /** @hidden */
  912. protected _cachedParentMeasure: Measure;
  913. /** @hidden */
  914. _left: ValueAndUnit;
  915. /** @hidden */
  916. _top: ValueAndUnit;
  917. /** @hidden */
  918. protected _invertTransformMatrix: Matrix2D;
  919. /** @hidden */
  920. protected _transformedPosition: Vector2;
  921. /** @hidden */
  922. _linkedMesh: Nullable<AbstractMesh>;
  923. /** @hidden */
  924. _tag: any;
  925. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  926. isHitTestVisible: boolean;
  927. /** Gets or sets a boolean indicating if the control can block pointer events */
  928. isPointerBlocker: boolean;
  929. /** Gets or sets a boolean indicating if the control can be focusable */
  930. isFocusInvisible: boolean;
  931. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  932. shadowOffsetX: number;
  933. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  934. shadowOffsetY: number;
  935. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  936. shadowBlur: number;
  937. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  938. shadowColor: string;
  939. /** @hidden */
  940. protected _linkOffsetX: ValueAndUnit;
  941. /** @hidden */
  942. protected _linkOffsetY: ValueAndUnit;
  943. /** Gets the control type name */
  944. readonly typeName: string;
  945. /**
  946. * An event triggered when the pointer move over the control.
  947. */
  948. onPointerMoveObservable: Observable<Vector2>;
  949. /**
  950. * An event triggered when the pointer move out of the control.
  951. */
  952. onPointerOutObservable: Observable<Control>;
  953. /**
  954. * An event triggered when the pointer taps the control
  955. */
  956. onPointerDownObservable: Observable<Vector2WithInfo>;
  957. /**
  958. * An event triggered when pointer up
  959. */
  960. onPointerUpObservable: Observable<Vector2WithInfo>;
  961. /**
  962. * An event triggered when a control is clicked on
  963. */
  964. onPointerClickObservable: Observable<Vector2WithInfo>;
  965. /**
  966. * An event triggered when pointer enters the control
  967. */
  968. onPointerEnterObservable: Observable<Control>;
  969. /**
  970. * An event triggered when the control is marked as dirty
  971. */
  972. onDirtyObservable: Observable<Control>;
  973. /**
  974. * An event triggered after the control is drawn
  975. */
  976. onAfterDrawObservable: Observable<Control>;
  977. /** Gets or set information about font offsets (used to render and align text) */
  978. fontOffset: {
  979. ascent: number;
  980. height: number;
  981. descent: number;
  982. };
  983. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  984. alpha: number;
  985. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  986. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  987. */
  988. scaleX: number;
  989. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  990. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  991. */
  992. scaleY: number;
  993. /** Gets or sets the rotation angle (0 by default)
  994. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  995. */
  996. rotation: number;
  997. /** Gets or sets the transformation center on Y axis (0 by default)
  998. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  999. */
  1000. transformCenterY: number;
  1001. /** Gets or sets the transformation center on X axis (0 by default)
  1002. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  1003. */
  1004. transformCenterX: number;
  1005. /**
  1006. * Gets or sets the horizontal alignment
  1007. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1008. */
  1009. horizontalAlignment: number;
  1010. /**
  1011. * Gets or sets the vertical alignment
  1012. * @see http://doc.babylonjs.com/how_to/gui#alignments
  1013. */
  1014. verticalAlignment: number;
  1015. /**
  1016. * Gets or sets control width
  1017. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1018. */
  1019. width: string | number;
  1020. /**
  1021. * Gets control width in pixel
  1022. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1023. */
  1024. readonly widthInPixels: number;
  1025. /**
  1026. * Gets or sets control height
  1027. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1028. */
  1029. height: string | number;
  1030. /**
  1031. * Gets control height in pixel
  1032. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1033. */
  1034. readonly heightInPixels: number;
  1035. /** Gets or set font family */
  1036. fontFamily: string;
  1037. /** Gets or sets font style */
  1038. fontStyle: string;
  1039. /** Gets or sets font weight */
  1040. fontWeight: string;
  1041. /**
  1042. * Gets or sets style
  1043. * @see http://doc.babylonjs.com/how_to/gui#styles
  1044. */
  1045. style: Nullable<Style>;
  1046. /** @hidden */
  1047. readonly _isFontSizeInPercentage: boolean;
  1048. /** Gets font size in pixels */
  1049. readonly fontSizeInPixels: number;
  1050. /** Gets or sets font size */
  1051. fontSize: string | number;
  1052. /** Gets or sets foreground color */
  1053. color: string;
  1054. /** Gets or sets z index which is used to reorder controls on the z axis */
  1055. zIndex: number;
  1056. /** Gets or sets a boolean indicating if the control can be rendered */
  1057. notRenderable: boolean;
  1058. /** Gets or sets a boolean indicating if the control is visible */
  1059. isVisible: boolean;
  1060. /** Gets a boolean indicating that the control needs to update its rendering */
  1061. readonly isDirty: boolean;
  1062. /**
  1063. * Gets or sets a value indicating the padding to use on the left of the control
  1064. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1065. */
  1066. paddingLeft: string | number;
  1067. /**
  1068. * Gets a value indicating the padding in pixels to use on the left of the control
  1069. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1070. */
  1071. readonly paddingLeftInPixels: number;
  1072. /**
  1073. * Gets or sets a value indicating the padding to use on the right of the control
  1074. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1075. */
  1076. paddingRight: string | number;
  1077. /**
  1078. * Gets a value indicating the padding in pixels to use on the right of the control
  1079. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1080. */
  1081. readonly paddingRightInPixels: number;
  1082. /**
  1083. * Gets or sets a value indicating the padding to use on the top of the control
  1084. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1085. */
  1086. paddingTop: string | number;
  1087. /**
  1088. * Gets a value indicating the padding in pixels to use on the top of the control
  1089. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1090. */
  1091. readonly paddingTopInPixels: number;
  1092. /**
  1093. * Gets or sets a value indicating the padding to use on the bottom of the control
  1094. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1095. */
  1096. paddingBottom: string | number;
  1097. /**
  1098. * Gets a value indicating the padding in pixels to use on the bottom of the control
  1099. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1100. */
  1101. readonly paddingBottomInPixels: number;
  1102. /**
  1103. * Gets or sets a value indicating the left coordinate of the control
  1104. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1105. */
  1106. left: string | number;
  1107. /**
  1108. * Gets a value indicating the left coordinate in pixels of the control
  1109. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1110. */
  1111. readonly leftInPixels: number;
  1112. /**
  1113. * Gets or sets a value indicating the top coordinate of the control
  1114. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1115. */
  1116. top: string | number;
  1117. /**
  1118. * Gets a value indicating the top coordinate in pixels of the control
  1119. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  1120. */
  1121. readonly topInPixels: number;
  1122. /**
  1123. * Gets or sets a value indicating the offset on X axis to the linked mesh
  1124. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1125. */
  1126. linkOffsetX: string | number;
  1127. /**
  1128. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  1129. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1130. */
  1131. readonly linkOffsetXInPixels: number;
  1132. /**
  1133. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  1134. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1135. */
  1136. linkOffsetY: string | number;
  1137. /**
  1138. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  1139. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1140. */
  1141. readonly linkOffsetYInPixels: number;
  1142. /** Gets the center coordinate on X axis */
  1143. readonly centerX: number;
  1144. /** Gets the center coordinate on Y axis */
  1145. readonly centerY: number;
  1146. /**
  1147. * Creates a new control
  1148. * @param name defines the name of the control
  1149. */
  1150. constructor(
  1151. /** defines the name of the control */
  1152. name?: string | undefined);
  1153. /** @hidden */
  1154. protected _getTypeName(): string;
  1155. /** @hidden */
  1156. _resetFontCache(): void;
  1157. /**
  1158. * Gets coordinates in local control space
  1159. * @param globalCoordinates defines the coordinates to transform
  1160. * @returns the new coordinates in local space
  1161. */
  1162. getLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1163. /**
  1164. * Gets coordinates in local control space
  1165. * @param globalCoordinates defines the coordinates to transform
  1166. * @param result defines the target vector2 where to store the result
  1167. * @returns the current control
  1168. */
  1169. getLocalCoordinatesToRef(globalCoordinates: Vector2, result: Vector2): Control;
  1170. /**
  1171. * Gets coordinates in parent local control space
  1172. * @param globalCoordinates defines the coordinates to transform
  1173. * @returns the new coordinates in parent local space
  1174. */
  1175. getParentLocalCoordinates(globalCoordinates: Vector2): Vector2;
  1176. /**
  1177. * Move the current control to a vector3 position projected onto the screen.
  1178. * @param position defines the target position
  1179. * @param scene defines the hosting scene
  1180. */
  1181. moveToVector3(position: Vector3, scene: Scene): void;
  1182. /**
  1183. * Link current control with a target mesh
  1184. * @param mesh defines the mesh to link with
  1185. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  1186. */
  1187. linkWithMesh(mesh: Nullable<AbstractMesh>): void;
  1188. /** @hidden */
  1189. _moveToProjectedPosition(projectedPosition: Vector3): void;
  1190. /** @hidden */
  1191. _markMatrixAsDirty(): void;
  1192. /** @hidden */
  1193. _markAsDirty(): void;
  1194. /** @hidden */
  1195. _markAllAsDirty(): void;
  1196. /** @hidden */
  1197. _link(root: Nullable<Container>, host: AdvancedDynamicTexture): void;
  1198. /** @hidden */
  1199. protected _transform(context: CanvasRenderingContext2D): void;
  1200. /** @hidden */
  1201. protected _applyStates(context: CanvasRenderingContext2D): void;
  1202. /** @hidden */
  1203. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  1204. /** @hidden */
  1205. protected _clip(context: CanvasRenderingContext2D): void;
  1206. /** @hidden */
  1207. _measure(): void;
  1208. /** @hidden */
  1209. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1210. /** @hidden */
  1211. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1212. /** @hidden */
  1213. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1214. /** @hidden */
  1215. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1216. /**
  1217. * Tests if a given coordinates belong to the current control
  1218. * @param x defines x coordinate to test
  1219. * @param y defines y coordinate to test
  1220. * @returns true if the coordinates are inside the control
  1221. */
  1222. contains(x: number, y: number): boolean;
  1223. /** @hidden */
  1224. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  1225. /** @hidden */
  1226. _onPointerMove(target: Control, coordinates: Vector2): void;
  1227. /** @hidden */
  1228. _onPointerEnter(target: Control): boolean;
  1229. /** @hidden */
  1230. _onPointerOut(target: Control): void;
  1231. /** @hidden */
  1232. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1233. /** @hidden */
  1234. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1235. /** @hidden */
  1236. _forcePointerUp(pointerId?: Nullable<number>): void;
  1237. /** @hidden */
  1238. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  1239. /** Releases associated resources */
  1240. dispose(): void;
  1241. /** HORIZONTAL_ALIGNMENT_LEFT */
  1242. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  1243. /** HORIZONTAL_ALIGNMENT_RIGHT */
  1244. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  1245. /** HORIZONTAL_ALIGNMENT_CENTER */
  1246. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  1247. /** VERTICAL_ALIGNMENT_TOP */
  1248. static readonly VERTICAL_ALIGNMENT_TOP: number;
  1249. /** VERTICAL_ALIGNMENT_BOTTOM */
  1250. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  1251. /** VERTICAL_ALIGNMENT_CENTER */
  1252. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  1253. /** @hidden */
  1254. static _GetFontOffset(font: string): {
  1255. ascent: number;
  1256. height: number;
  1257. descent: number;
  1258. };
  1259. /**
  1260. * Creates a stack panel that can be used to render headers
  1261. * @param control defines the control to associate with the header
  1262. * @param text defines the text of the header
  1263. * @param size defines the size of the header
  1264. * @param options defines options used to configure the header
  1265. * @returns a new StackPanel
  1266. * @ignore
  1267. * @hidden
  1268. */
  1269. static AddHeader: (control: Control, text: string, size: string | number, options: {
  1270. isHorizontal: boolean;
  1271. controlFirst: boolean;
  1272. }) => any;
  1273. /** @hidden */
  1274. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  1275. }
  1276. }
  1277. declare module 'babylonjs-gui/2D/controls/ellipse' {
  1278. import { Container } from "babylonjs-gui/2D/controls/container";
  1279. import { Measure } from "babylonjs-gui/2D/measure";
  1280. /** Class used to create 2D ellipse containers */
  1281. export class Ellipse extends Container {
  1282. name?: string | undefined;
  1283. /** Gets or sets border thickness */
  1284. thickness: number;
  1285. /**
  1286. * Creates a new Ellipse
  1287. * @param name defines the control name
  1288. */
  1289. constructor(name?: string | undefined);
  1290. protected _getTypeName(): string;
  1291. protected _localDraw(context: CanvasRenderingContext2D): void;
  1292. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1293. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1294. }
  1295. }
  1296. declare module 'babylonjs-gui/2D/controls/grid' {
  1297. import { Container } from "babylonjs-gui/2D/controls/container";
  1298. import { Control } from "babylonjs-gui/2D/controls/control";
  1299. import { Measure } from "babylonjs-gui/2D/measure";
  1300. /**
  1301. * Class used to create a 2D grid container
  1302. */
  1303. export class Grid extends Container {
  1304. name?: string | undefined;
  1305. /** Gets the list of children */
  1306. readonly children: Control[];
  1307. /**
  1308. * Adds a new row to the grid
  1309. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1310. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  1311. * @returns the current grid
  1312. */
  1313. addRowDefinition(height: number, isPixel?: boolean): Grid;
  1314. /**
  1315. * Adds a new column to the grid
  1316. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1317. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1318. * @returns the current grid
  1319. */
  1320. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  1321. /**
  1322. * Update a row definition
  1323. * @param index defines the index of the row to update
  1324. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  1325. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  1326. * @returns the current grid
  1327. */
  1328. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  1329. /**
  1330. * Update a column definition
  1331. * @param index defines the index of the column to update
  1332. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  1333. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  1334. * @returns the current grid
  1335. */
  1336. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  1337. /**
  1338. * Remove a column definition at specified index
  1339. * @param index defines the index of the column to remove
  1340. * @returns the current grid
  1341. */
  1342. removeColumnDefinition(index: number): Grid;
  1343. /**
  1344. * Remove a row definition at specified index
  1345. * @param index defines the index of the row to remove
  1346. * @returns the current grid
  1347. */
  1348. removeRowDefinition(index: number): Grid;
  1349. /**
  1350. * Adds a new control to the current grid
  1351. * @param control defines the control to add
  1352. * @param row defines the row where to add the control (0 by default)
  1353. * @param column defines the column where to add the control (0 by default)
  1354. * @returns the current grid
  1355. */
  1356. addControl(control: Control, row?: number, column?: number): Grid;
  1357. /**
  1358. * Removes a control from the current container
  1359. * @param control defines the control to remove
  1360. * @returns the current container
  1361. */
  1362. removeControl(control: Control): Container;
  1363. /**
  1364. * Creates a new Grid
  1365. * @param name defines control name
  1366. */
  1367. constructor(name?: string | undefined);
  1368. protected _getTypeName(): string;
  1369. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1370. /** Releases associated resources */
  1371. dispose(): void;
  1372. }
  1373. }
  1374. declare module 'babylonjs-gui/2D/controls/image' {
  1375. import { Control } from "babylonjs-gui/2D/controls/control";
  1376. import { Nullable } from "babylonjs";
  1377. import { Measure } from "babylonjs-gui/2D/measure";
  1378. /**
  1379. * Class used to create 2D images
  1380. */
  1381. class GUIImage extends Control {
  1382. name?: string | undefined;
  1383. /**
  1384. * Gets or sets the left coordinate in the source image
  1385. */
  1386. sourceLeft: number;
  1387. /**
  1388. * Gets or sets the top coordinate in the source image
  1389. */
  1390. sourceTop: number;
  1391. /**
  1392. * Gets or sets the width to capture in the source image
  1393. */
  1394. sourceWidth: number;
  1395. /**
  1396. * Gets or sets the height to capture in the source image
  1397. */
  1398. sourceHeight: number;
  1399. /**
  1400. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1401. * @see http://doc.babylonjs.com/how_to/gui#image
  1402. */
  1403. autoScale: boolean;
  1404. /** Gets or sets the streching mode used by the image */
  1405. stretch: number;
  1406. /**
  1407. * Gets or sets the internal DOM image used to render the control
  1408. */
  1409. domImage: HTMLImageElement;
  1410. /**
  1411. * Gets or sets image source url
  1412. */
  1413. source: Nullable<string>;
  1414. /**
  1415. * Gets or sets the cell width to use when animation sheet is enabled
  1416. * @see http://doc.babylonjs.com/how_to/gui#image
  1417. */
  1418. cellWidth: number;
  1419. /**
  1420. * Gets or sets the cell height to use when animation sheet is enabled
  1421. * @see http://doc.babylonjs.com/how_to/gui#image
  1422. */
  1423. cellHeight: number;
  1424. /**
  1425. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1426. * @see http://doc.babylonjs.com/how_to/gui#image
  1427. */
  1428. cellId: number;
  1429. /**
  1430. * Creates a new Image
  1431. * @param name defines the control name
  1432. * @param url defines the image url
  1433. */
  1434. constructor(name?: string | undefined, url?: Nullable<string>);
  1435. protected _getTypeName(): string;
  1436. /** Force the control to synchronize with its content */
  1437. synchronizeSizeWithContent(): void;
  1438. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1439. /** STRETCH_NONE */
  1440. static readonly STRETCH_NONE: number;
  1441. /** STRETCH_FILL */
  1442. static readonly STRETCH_FILL: number;
  1443. /** STRETCH_UNIFORM */
  1444. static readonly STRETCH_UNIFORM: number;
  1445. /** STRETCH_EXTEND */
  1446. static readonly STRETCH_EXTEND: number;
  1447. }
  1448. export { GUIImage as Image };
  1449. }
  1450. declare module 'babylonjs-gui/2D/controls/inputText' {
  1451. import { Control } from "babylonjs-gui/2D/controls/control";
  1452. import { IFocusableControl } from "babylonjs-gui/2D/advancedDynamicTexture";
  1453. import { Observable, Vector2 } from "babylonjs";
  1454. import { Measure } from "babylonjs-gui/2D/measure";
  1455. /**
  1456. * Class used to create input text control
  1457. */
  1458. export class InputText extends Control implements IFocusableControl {
  1459. name?: string | undefined;
  1460. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1461. promptMessage: string;
  1462. /** Observable raised when the text changes */
  1463. onTextChangedObservable: Observable<InputText>;
  1464. /** Observable raised just before an entered character is to be added */
  1465. onBeforeKeyAddObservable: Observable<InputText>;
  1466. /** Observable raised when the control gets the focus */
  1467. onFocusObservable: Observable<InputText>;
  1468. /** Observable raised when the control loses the focus */
  1469. onBlurObservable: Observable<InputText>;
  1470. /** Gets or sets the maximum width allowed by the control */
  1471. maxWidth: string | number;
  1472. /** Gets the maximum width allowed by the control in pixels */
  1473. readonly maxWidthInPixels: number;
  1474. /** Gets or sets control margin */
  1475. margin: string;
  1476. /** Gets control margin in pixels */
  1477. readonly marginInPixels: number;
  1478. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1479. autoStretchWidth: boolean;
  1480. /** Gets or sets border thickness */
  1481. thickness: number;
  1482. /** Gets or sets the background color when focused */
  1483. focusedBackground: string;
  1484. /** Gets or sets the background color */
  1485. background: string;
  1486. /** Gets or sets the placeholder color */
  1487. placeholderColor: string;
  1488. /** Gets or sets the text displayed when the control is empty */
  1489. placeholderText: string;
  1490. /** Gets or sets the dead key flag */
  1491. deadKey: boolean;
  1492. /** Gets or sets if the current key should be added */
  1493. addKey: boolean;
  1494. /** Gets or sets the value of the current key being entered */
  1495. currentKey: string;
  1496. /** Gets or sets the text displayed in the control */
  1497. text: string;
  1498. /** Gets or sets control width */
  1499. width: string | number;
  1500. /**
  1501. * Creates a new InputText
  1502. * @param name defines the control name
  1503. * @param text defines the text of the control
  1504. */
  1505. constructor(name?: string | undefined, text?: string);
  1506. /** @hidden */
  1507. onBlur(): void;
  1508. /** @hidden */
  1509. onFocus(): void;
  1510. protected _getTypeName(): string;
  1511. /** @hidden */
  1512. processKey(keyCode: number, key?: string): void;
  1513. /** @hidden */
  1514. processKeyboard(evt: KeyboardEvent): void;
  1515. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1516. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1517. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1518. protected _beforeRenderText(text: string): string;
  1519. dispose(): void;
  1520. }
  1521. }
  1522. declare module 'babylonjs-gui/2D/controls/inputPassword' {
  1523. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1524. /**
  1525. * Class used to create a password control
  1526. */
  1527. export class InputPassword extends InputText {
  1528. protected _beforeRenderText(text: string): string;
  1529. }
  1530. }
  1531. declare module 'babylonjs-gui/2D/controls/line' {
  1532. import { Control } from "babylonjs-gui/2D/controls/control";
  1533. import { Vector3, Scene } from "babylonjs";
  1534. import { Measure } from "babylonjs-gui/2D/measure";
  1535. /** Class used to render 2D lines */
  1536. export class Line extends Control {
  1537. name?: string | undefined;
  1538. /** Gets or sets the dash pattern */
  1539. dash: Array<number>;
  1540. /** Gets or sets the control connected with the line end */
  1541. connectedControl: Control;
  1542. /** Gets or sets start coordinates on X axis */
  1543. x1: string | number;
  1544. /** Gets or sets start coordinates on Y axis */
  1545. y1: string | number;
  1546. /** Gets or sets end coordinates on X axis */
  1547. x2: string | number;
  1548. /** Gets or sets end coordinates on Y axis */
  1549. y2: string | number;
  1550. /** Gets or sets line width */
  1551. lineWidth: number;
  1552. /** Gets or sets horizontal alignment */
  1553. horizontalAlignment: number;
  1554. /** Gets or sets vertical alignment */
  1555. verticalAlignment: number;
  1556. /**
  1557. * Creates a new Line
  1558. * @param name defines the control name
  1559. */
  1560. constructor(name?: string | undefined);
  1561. protected _getTypeName(): string;
  1562. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1563. _measure(): void;
  1564. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1565. /**
  1566. * Move one end of the line given 3D cartesian coordinates.
  1567. * @param position Targeted world position
  1568. * @param scene Scene
  1569. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1570. */
  1571. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  1572. /**
  1573. * Move one end of the line to a position in screen absolute space.
  1574. * @param projectedPosition Position in screen absolute space (X, Y)
  1575. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1576. */
  1577. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  1578. }
  1579. }
  1580. declare module 'babylonjs-gui/2D/controls/multiLine' {
  1581. import { Control } from "babylonjs-gui/2D/controls/control";
  1582. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  1583. import { AbstractMesh } from "babylonjs";
  1584. import { Measure } from "babylonjs-gui/2D/measure";
  1585. /**
  1586. * Class used to create multi line control
  1587. */
  1588. export class MultiLine extends Control {
  1589. name?: string | undefined;
  1590. /**
  1591. * Creates a new MultiLine
  1592. * @param name defines the control name
  1593. */
  1594. constructor(name?: string | undefined);
  1595. /** Gets or sets dash pattern */
  1596. dash: Array<number>;
  1597. /**
  1598. * Gets point stored at specified index
  1599. * @param index defines the index to look for
  1600. * @returns the requested point if found
  1601. */
  1602. getAt(index: number): MultiLinePoint;
  1603. /** Function called when a point is updated */
  1604. onPointUpdate: () => void;
  1605. /**
  1606. * Adds new points to the point collection
  1607. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1608. * @returns the list of created MultiLinePoint
  1609. */
  1610. add(...items: (AbstractMesh | Control | {
  1611. x: string | number;
  1612. y: string | number;
  1613. })[]): MultiLinePoint[];
  1614. /**
  1615. * Adds a new point to the point collection
  1616. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1617. * @returns the created MultiLinePoint
  1618. */
  1619. push(item?: (AbstractMesh | Control | {
  1620. x: string | number;
  1621. y: string | number;
  1622. })): MultiLinePoint;
  1623. /**
  1624. * Remove a specific value or point from the active point collection
  1625. * @param value defines the value or point to remove
  1626. */
  1627. remove(value: number | MultiLinePoint): void;
  1628. /** Gets or sets line width */
  1629. lineWidth: number;
  1630. horizontalAlignment: number;
  1631. verticalAlignment: number;
  1632. protected _getTypeName(): string;
  1633. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1634. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1635. _measure(): void;
  1636. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1637. dispose(): void;
  1638. }
  1639. }
  1640. declare module 'babylonjs-gui/2D/controls/radioButton' {
  1641. import { Control } from "babylonjs-gui/2D/controls/control";
  1642. import { Observable, Vector2 } from "babylonjs";
  1643. import { Measure } from "babylonjs-gui/2D/measure";
  1644. /**
  1645. * Class used to create radio button controls
  1646. */
  1647. export class RadioButton extends Control {
  1648. name?: string | undefined;
  1649. /** Gets or sets border thickness */
  1650. thickness: number;
  1651. /** Gets or sets group name */
  1652. group: string;
  1653. /** Observable raised when isChecked is changed */
  1654. onIsCheckedChangedObservable: Observable<boolean>;
  1655. /** Gets or sets a value indicating the ratio between overall size and check size */
  1656. checkSizeRatio: number;
  1657. /** Gets or sets background color */
  1658. background: string;
  1659. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1660. isChecked: boolean;
  1661. /**
  1662. * Creates a new RadioButton
  1663. * @param name defines the control name
  1664. */
  1665. constructor(name?: string | undefined);
  1666. protected _getTypeName(): string;
  1667. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1668. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1669. }
  1670. }
  1671. declare module 'babylonjs-gui/2D/controls/stackPanel' {
  1672. import { Container } from "babylonjs-gui/2D/controls/container";
  1673. import { Measure } from "babylonjs-gui/2D/measure";
  1674. /**
  1675. * Class used to create a 2D stack panel container
  1676. */
  1677. export class StackPanel extends Container {
  1678. name?: string | undefined;
  1679. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1680. isVertical: boolean;
  1681. /** Gets or sets panel width */
  1682. width: string | number;
  1683. /** Gets or sets panel height */
  1684. height: string | number;
  1685. /**
  1686. * Creates a new StackPanel
  1687. * @param name defines control name
  1688. */
  1689. constructor(name?: string | undefined);
  1690. protected _getTypeName(): string;
  1691. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1692. }
  1693. }
  1694. declare module 'babylonjs-gui/2D/controls/textBlock' {
  1695. import { Observable } from "babylonjs";
  1696. import { Measure } from "babylonjs-gui/2D/measure";
  1697. import { Control } from "babylonjs-gui/2D/controls/control";
  1698. /**
  1699. * Enum that determines the text-wrapping mode to use.
  1700. */
  1701. export enum TextWrapping {
  1702. /**
  1703. * Clip the text when it's larger than Control.width; this is the default mode.
  1704. */
  1705. Clip = 0,
  1706. /**
  1707. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  1708. */
  1709. WordWrap = 1,
  1710. /**
  1711. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  1712. */
  1713. Ellipsis = 2
  1714. }
  1715. /**
  1716. * Class used to create text block control
  1717. */
  1718. export class TextBlock extends Control {
  1719. /**
  1720. * Defines the name of the control
  1721. */
  1722. name?: string | undefined;
  1723. /**
  1724. * An event triggered after the text is changed
  1725. */
  1726. onTextChangedObservable: Observable<TextBlock>;
  1727. /**
  1728. * An event triggered after the text was broken up into lines
  1729. */
  1730. onLinesReadyObservable: Observable<TextBlock>;
  1731. /**
  1732. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  1733. */
  1734. readonly lines: any[];
  1735. /**
  1736. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  1737. */
  1738. resizeToFit: boolean;
  1739. /**
  1740. * Gets or sets a boolean indicating if text must be wrapped
  1741. */
  1742. textWrapping: TextWrapping | boolean;
  1743. /**
  1744. * Gets or sets text to display
  1745. */
  1746. text: string;
  1747. /**
  1748. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  1749. */
  1750. textHorizontalAlignment: number;
  1751. /**
  1752. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  1753. */
  1754. textVerticalAlignment: number;
  1755. /**
  1756. * Gets or sets line spacing value
  1757. */
  1758. lineSpacing: string | number;
  1759. /**
  1760. * Gets or sets outlineWidth of the text to display
  1761. */
  1762. outlineWidth: number;
  1763. /**
  1764. * Gets or sets outlineColor of the text to display
  1765. */
  1766. outlineColor: string;
  1767. /**
  1768. * Creates a new TextBlock object
  1769. * @param name defines the name of the control
  1770. * @param text defines the text to display (emptry string by default)
  1771. */
  1772. constructor(
  1773. /**
  1774. * Defines the name of the control
  1775. */
  1776. name?: string | undefined, text?: string);
  1777. protected _getTypeName(): string;
  1778. /** @hidden */
  1779. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1780. protected _applyStates(context: CanvasRenderingContext2D): void;
  1781. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1782. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  1783. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  1784. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  1785. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  1786. protected _renderLines(context: CanvasRenderingContext2D): void;
  1787. /**
  1788. * Given a width constraint applied on the text block, find the expected height
  1789. * @returns expected height
  1790. */
  1791. computeExpectedHeight(): number;
  1792. dispose(): void;
  1793. }
  1794. }
  1795. declare module 'babylonjs-gui/2D/controls/virtualKeyboard' {
  1796. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1797. import { Observable, Nullable } from "babylonjs";
  1798. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1799. /**
  1800. * Class used to store key control properties
  1801. */
  1802. export class KeyPropertySet {
  1803. /** Width */
  1804. width?: string;
  1805. /** Height */
  1806. height?: string;
  1807. /** Left padding */
  1808. paddingLeft?: string;
  1809. /** Right padding */
  1810. paddingRight?: string;
  1811. /** Top padding */
  1812. paddingTop?: string;
  1813. /** Bottom padding */
  1814. paddingBottom?: string;
  1815. /** Foreground color */
  1816. color?: string;
  1817. /** Background color */
  1818. background?: string;
  1819. }
  1820. /**
  1821. * Class used to create virtual keyboard
  1822. */
  1823. export class VirtualKeyboard extends StackPanel {
  1824. /** Observable raised when a key is pressed */
  1825. onKeyPressObservable: Observable<string>;
  1826. /** Gets or sets default key button width */
  1827. defaultButtonWidth: string;
  1828. /** Gets or sets default key button height */
  1829. defaultButtonHeight: string;
  1830. /** Gets or sets default key button left padding */
  1831. defaultButtonPaddingLeft: string;
  1832. /** Gets or sets default key button right padding */
  1833. defaultButtonPaddingRight: string;
  1834. /** Gets or sets default key button top padding */
  1835. defaultButtonPaddingTop: string;
  1836. /** Gets or sets default key button bottom padding */
  1837. defaultButtonPaddingBottom: string;
  1838. /** Gets or sets default key button foreground color */
  1839. defaultButtonColor: string;
  1840. /** Gets or sets default key button background color */
  1841. defaultButtonBackground: string;
  1842. /** Gets or sets shift button foreground color */
  1843. shiftButtonColor: string;
  1844. /** Gets or sets shift button thickness*/
  1845. selectedShiftThickness: number;
  1846. /** Gets shift key state */
  1847. shiftState: number;
  1848. protected _getTypeName(): string;
  1849. /**
  1850. * Adds a new row of keys
  1851. * @param keys defines the list of keys to add
  1852. * @param propertySets defines the associated property sets
  1853. */
  1854. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  1855. /**
  1856. * Set the shift key to a specific state
  1857. * @param shiftState defines the new shift state
  1858. */
  1859. applyShiftState(shiftState: number): void;
  1860. /** Gets the input text control attached with the keyboard */
  1861. readonly connectedInputText: Nullable<InputText>;
  1862. /**
  1863. * Connects the keyboard with an input text control
  1864. * @param input defines the target control
  1865. */
  1866. connect(input: InputText): void;
  1867. /**
  1868. * Disconnects the keyboard from an input text control
  1869. */
  1870. disconnect(): void;
  1871. /**
  1872. * Creates a new keyboard using a default layout
  1873. * @returns a new VirtualKeyboard
  1874. */
  1875. static CreateDefaultLayout(): VirtualKeyboard;
  1876. }
  1877. }
  1878. declare module 'babylonjs-gui/2D/controls/slider' {
  1879. import { Control } from "babylonjs-gui/2D/controls/control";
  1880. import { Observable, Vector2 } from "babylonjs";
  1881. import { Measure } from "babylonjs-gui/2D/measure";
  1882. /**
  1883. * Class used to create slider controls
  1884. */
  1885. export class Slider extends Control {
  1886. name?: string | undefined;
  1887. /** Observable raised when the sldier value changes */
  1888. onValueChangedObservable: Observable<number>;
  1889. /** Gets or sets border color */
  1890. borderColor: string;
  1891. /** Gets or sets background color */
  1892. background: string;
  1893. /** Gets or sets main bar offset */
  1894. barOffset: string | number;
  1895. /** Gets main bar offset in pixels*/
  1896. readonly barOffsetInPixels: number;
  1897. /** Gets or sets thumb width */
  1898. thumbWidth: string | number;
  1899. /** Gets thumb width in pixels */
  1900. readonly thumbWidthInPixels: number;
  1901. /** Gets or sets minimum value */
  1902. minimum: number;
  1903. /** Gets or sets maximum value */
  1904. maximum: number;
  1905. /** Gets or sets current value */
  1906. value: number;
  1907. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  1908. isVertical: boolean;
  1909. /** Gets or sets a boolean indicating if the thumb should be round or square */
  1910. isThumbCircle: boolean;
  1911. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  1912. isThumbClamped: boolean;
  1913. /**
  1914. * Creates a new Slider
  1915. * @param name defines the control name
  1916. */
  1917. constructor(name?: string | undefined);
  1918. protected _getTypeName(): string;
  1919. protected _getThumbThickness(type: string, backgroundLength: number): number;
  1920. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1921. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1922. _onPointerMove(target: Control, coordinates: Vector2): void;
  1923. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1924. }
  1925. }
  1926. declare module 'babylonjs-gui/2D/controls/rectangle' {
  1927. import { Container } from "babylonjs-gui/2D/controls/container";
  1928. import { Measure } from "babylonjs-gui/2D/measure";
  1929. /** Class used to create rectangle container */
  1930. export class Rectangle extends Container {
  1931. name?: string | undefined;
  1932. /** Gets or sets border thickness */
  1933. thickness: number;
  1934. /** Gets or sets the corner radius angle */
  1935. cornerRadius: number;
  1936. /**
  1937. * Creates a new Rectangle
  1938. * @param name defines the control name
  1939. */
  1940. constructor(name?: string | undefined);
  1941. protected _getTypeName(): string;
  1942. protected _localDraw(context: CanvasRenderingContext2D): void;
  1943. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1944. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  1945. }
  1946. }
  1947. declare module 'babylonjs-gui/2D/controls/displayGrid' {
  1948. import { Control } from "babylonjs-gui/2D/controls";
  1949. import { Measure } from "babylonjs-gui/2D";
  1950. /** Class used to render a grid */
  1951. export class DisplayGrid extends Control {
  1952. name?: string | undefined;
  1953. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  1954. displayMinorLines: boolean;
  1955. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  1956. displayMajorLines: boolean;
  1957. /** Gets or sets background color (Black by default) */
  1958. background: string;
  1959. /** Gets or sets the width of each cell (20 by default) */
  1960. cellWidth: number;
  1961. /** Gets or sets the height of each cell (20 by default) */
  1962. cellHeight: number;
  1963. /** Gets or sets the tickness of minor lines (1 by default) */
  1964. minorLineTickness: number;
  1965. /** Gets or sets the color of minor lines (DarkGray by default) */
  1966. minorLineColor: string;
  1967. /** Gets or sets the tickness of major lines (2 by default) */
  1968. majorLineTickness: number;
  1969. /** Gets or sets the color of major lines (White by default) */
  1970. majorLineColor: string;
  1971. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  1972. majorLineFrequency: number;
  1973. /**
  1974. * Creates a new GridDisplayRectangle
  1975. * @param name defines the control name
  1976. */
  1977. constructor(name?: string | undefined);
  1978. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1979. protected _getTypeName(): string;
  1980. }
  1981. }
  1982. declare module 'babylonjs-gui/2D/controls/statics' {
  1983. /**
  1984. * Forcing an export so that this code will execute
  1985. * @hidden
  1986. */
  1987. const name = "Statics";
  1988. export { name };
  1989. }
  1990. declare module 'babylonjs-gui/3D/controls/abstractButton3D' {
  1991. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  1992. import { TransformNode, Scene } from "babylonjs";
  1993. /**
  1994. * Class used as a root to all buttons
  1995. */
  1996. export class AbstractButton3D extends Control3D {
  1997. /**
  1998. * Creates a new button
  1999. * @param name defines the control name
  2000. */
  2001. constructor(name?: string);
  2002. protected _getTypeName(): string;
  2003. protected _createNode(scene: Scene): TransformNode;
  2004. }
  2005. }
  2006. declare module 'babylonjs-gui/3D/controls/button3D' {
  2007. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  2008. import { Material, int, Scene, TransformNode, AbstractMesh } from "babylonjs";
  2009. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2010. import { Control } from "babylonjs-gui/2D/controls/control";
  2011. /**
  2012. * Class used to create a button in 3D
  2013. */
  2014. export class Button3D extends AbstractButton3D {
  2015. /** @hidden */
  2016. protected _currentMaterial: Material;
  2017. /**
  2018. * Gets or sets the texture resolution used to render content (512 by default)
  2019. */
  2020. contentResolution: int;
  2021. /**
  2022. * Gets or sets the texture scale ratio used to render content (2 by default)
  2023. */
  2024. contentScaleRatio: number;
  2025. protected _disposeFacadeTexture(): void;
  2026. protected _resetContent(): void;
  2027. /**
  2028. * Creates a new button
  2029. * @param name defines the control name
  2030. */
  2031. constructor(name?: string);
  2032. /**
  2033. * Gets or sets the GUI 2D content used to display the button's facade
  2034. */
  2035. content: Control;
  2036. /**
  2037. * Apply the facade texture (created from the content property).
  2038. * This function can be overloaded by child classes
  2039. * @param facadeTexture defines the AdvancedDynamicTexture to use
  2040. */
  2041. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2042. protected _getTypeName(): string;
  2043. protected _createNode(scene: Scene): TransformNode;
  2044. protected _affectMaterial(mesh: AbstractMesh): void;
  2045. /**
  2046. * Releases all associated resources
  2047. */
  2048. dispose(): void;
  2049. }
  2050. }
  2051. declare module 'babylonjs-gui/3D/controls/container3D' {
  2052. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2053. import { Scene, Nullable, TransformNode } from "babylonjs";
  2054. /**
  2055. * Class used to create containers for controls
  2056. */
  2057. export class Container3D extends Control3D {
  2058. /**
  2059. * Gets the list of child controls
  2060. */
  2061. protected _children: Control3D[];
  2062. /**
  2063. * Gets the list of child controls
  2064. */
  2065. readonly children: Array<Control3D>;
  2066. /**
  2067. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2068. * This is helpful to optimize layout operation when adding multiple children in a row
  2069. */
  2070. blockLayout: boolean;
  2071. /**
  2072. * Creates a new container
  2073. * @param name defines the container name
  2074. */
  2075. constructor(name?: string);
  2076. /**
  2077. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2078. * @returns the current container
  2079. */
  2080. updateLayout(): Container3D;
  2081. /**
  2082. * Gets a boolean indicating if the given control is in the children of this control
  2083. * @param control defines the control to check
  2084. * @returns true if the control is in the child list
  2085. */
  2086. containsControl(control: Control3D): boolean;
  2087. /**
  2088. * Adds a control to the children of this control
  2089. * @param control defines the control to add
  2090. * @returns the current container
  2091. */
  2092. addControl(control: Control3D): Container3D;
  2093. /**
  2094. * This function will be called everytime a new control is added
  2095. */
  2096. protected _arrangeChildren(): void;
  2097. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2098. /**
  2099. * Removes a control from the children of this control
  2100. * @param control defines the control to remove
  2101. * @returns the current container
  2102. */
  2103. removeControl(control: Control3D): Container3D;
  2104. protected _getTypeName(): string;
  2105. /**
  2106. * Releases all associated resources
  2107. */
  2108. dispose(): void;
  2109. /** Control rotation will remain unchanged */
  2110. static readonly UNSET_ORIENTATION: number;
  2111. /** Control will rotate to make it look at sphere central axis */
  2112. static readonly FACEORIGIN_ORIENTATION: number;
  2113. /** Control will rotate to make it look back at sphere central axis */
  2114. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2115. /** Control will rotate to look at z axis (0, 0, 1) */
  2116. static readonly FACEFORWARD_ORIENTATION: number;
  2117. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2118. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2119. }
  2120. }
  2121. declare module 'babylonjs-gui/3D/controls/control3D' {
  2122. import { IDisposable, IBehaviorAware, Nullable, TransformNode, Vector3, Observable, Behavior, AbstractMesh, Scene } from "babylonjs";
  2123. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  2124. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  2125. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2126. /**
  2127. * Class used as base class for controls
  2128. */
  2129. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  2130. /** Defines the control name */
  2131. name?: string | undefined;
  2132. /** @hidden */
  2133. _host: GUI3DManager;
  2134. /** Gets or sets the control position in world space */
  2135. position: Vector3;
  2136. /** Gets or sets the control scaling in world space */
  2137. scaling: Vector3;
  2138. /** Callback used to start pointer enter animation */
  2139. pointerEnterAnimation: () => void;
  2140. /** Callback used to start pointer out animation */
  2141. pointerOutAnimation: () => void;
  2142. /** Callback used to start pointer down animation */
  2143. pointerDownAnimation: () => void;
  2144. /** Callback used to start pointer up animation */
  2145. pointerUpAnimation: () => void;
  2146. /**
  2147. * An event triggered when the pointer move over the control
  2148. */
  2149. onPointerMoveObservable: Observable<Vector3>;
  2150. /**
  2151. * An event triggered when the pointer move out of the control
  2152. */
  2153. onPointerOutObservable: Observable<Control3D>;
  2154. /**
  2155. * An event triggered when the pointer taps the control
  2156. */
  2157. onPointerDownObservable: Observable<Vector3WithInfo>;
  2158. /**
  2159. * An event triggered when pointer is up
  2160. */
  2161. onPointerUpObservable: Observable<Vector3WithInfo>;
  2162. /**
  2163. * An event triggered when a control is clicked on (with a mouse)
  2164. */
  2165. onPointerClickObservable: Observable<Vector3WithInfo>;
  2166. /**
  2167. * An event triggered when pointer enters the control
  2168. */
  2169. onPointerEnterObservable: Observable<Control3D>;
  2170. /**
  2171. * Gets or sets the parent container
  2172. */
  2173. parent: Nullable<Container3D>;
  2174. /**
  2175. * Gets the list of attached behaviors
  2176. * @see http://doc.babylonjs.com/features/behaviour
  2177. */
  2178. readonly behaviors: Behavior<Control3D>[];
  2179. /**
  2180. * Attach a behavior to the control
  2181. * @see http://doc.babylonjs.com/features/behaviour
  2182. * @param behavior defines the behavior to attach
  2183. * @returns the current control
  2184. */
  2185. addBehavior(behavior: Behavior<Control3D>): Control3D;
  2186. /**
  2187. * Remove an attached behavior
  2188. * @see http://doc.babylonjs.com/features/behaviour
  2189. * @param behavior defines the behavior to attach
  2190. * @returns the current control
  2191. */
  2192. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  2193. /**
  2194. * Gets an attached behavior by name
  2195. * @param name defines the name of the behavior to look for
  2196. * @see http://doc.babylonjs.com/features/behaviour
  2197. * @returns null if behavior was not found else the requested behavior
  2198. */
  2199. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  2200. /** Gets or sets a boolean indicating if the control is visible */
  2201. isVisible: boolean;
  2202. /**
  2203. * Creates a new control
  2204. * @param name defines the control name
  2205. */
  2206. constructor(
  2207. /** Defines the control name */
  2208. name?: string | undefined);
  2209. /**
  2210. * Gets a string representing the class name
  2211. */
  2212. readonly typeName: string;
  2213. protected _getTypeName(): string;
  2214. /**
  2215. * Gets the transform node used by this control
  2216. */
  2217. readonly node: Nullable<TransformNode>;
  2218. /**
  2219. * Gets the mesh used to render this control
  2220. */
  2221. readonly mesh: Nullable<AbstractMesh>;
  2222. /**
  2223. * Link the control as child of the given node
  2224. * @param node defines the node to link to. Use null to unlink the control
  2225. * @returns the current control
  2226. */
  2227. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  2228. /** @hidden **/
  2229. _prepareNode(scene: Scene): void;
  2230. /**
  2231. * Node creation.
  2232. * Can be overriden by children
  2233. * @param scene defines the scene where the node must be attached
  2234. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  2235. */
  2236. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2237. /**
  2238. * Affect a material to the given mesh
  2239. * @param mesh defines the mesh which will represent the control
  2240. */
  2241. protected _affectMaterial(mesh: AbstractMesh): void;
  2242. /** @hidden */
  2243. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  2244. /** @hidden */
  2245. _onPointerEnter(target: Control3D): boolean;
  2246. /** @hidden */
  2247. _onPointerOut(target: Control3D): void;
  2248. /** @hidden */
  2249. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  2250. /** @hidden */
  2251. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2252. /** @hidden */
  2253. forcePointerUp(pointerId?: Nullable<number>): void;
  2254. /** @hidden */
  2255. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  2256. /** @hidden */
  2257. _disposeNode(): void;
  2258. /**
  2259. * Releases all associated resources
  2260. */
  2261. dispose(): void;
  2262. }
  2263. }
  2264. declare module 'babylonjs-gui/3D/controls/cylinderPanel' {
  2265. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2266. import { float, Vector3 } from "babylonjs";
  2267. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2268. /**
  2269. * Class used to create a container panel deployed on the surface of a cylinder
  2270. */
  2271. export class CylinderPanel extends VolumeBasedPanel {
  2272. /**
  2273. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  2274. */
  2275. radius: float;
  2276. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2277. }
  2278. }
  2279. declare module 'babylonjs-gui/3D/controls/holographicButton' {
  2280. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2281. import { Mesh, StandardMaterial, Scene, TransformNode } from "babylonjs";
  2282. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  2283. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2284. /**
  2285. * Class used to create a holographic button in 3D
  2286. */
  2287. export class HolographicButton extends Button3D {
  2288. /**
  2289. * Gets or sets text for the button
  2290. */
  2291. text: string;
  2292. /**
  2293. * Gets or sets the image url for the button
  2294. */
  2295. imageUrl: string;
  2296. /**
  2297. * Gets the back material used by this button
  2298. */
  2299. readonly backMaterial: FluentMaterial;
  2300. /**
  2301. * Gets the front material used by this button
  2302. */
  2303. readonly frontMaterial: FluentMaterial;
  2304. /**
  2305. * Gets the plate material used by this button
  2306. */
  2307. readonly plateMaterial: StandardMaterial;
  2308. /**
  2309. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  2310. */
  2311. readonly shareMaterials: boolean;
  2312. /**
  2313. * Creates a new button
  2314. * @param name defines the control name
  2315. */
  2316. constructor(name?: string, shareMaterials?: boolean);
  2317. protected _getTypeName(): string;
  2318. protected _createNode(scene: Scene): TransformNode;
  2319. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2320. protected _affectMaterial(mesh: Mesh): void;
  2321. /**
  2322. * Releases all associated resources
  2323. */
  2324. dispose(): void;
  2325. }
  2326. }
  2327. declare module 'babylonjs-gui/3D/controls/meshButton3D' {
  2328. import { Scene, TransformNode, AbstractMesh, Mesh } from "babylonjs";
  2329. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2330. /**
  2331. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  2332. */
  2333. export class MeshButton3D extends Button3D {
  2334. /** @hidden */
  2335. protected _currentMesh: Mesh;
  2336. /**
  2337. * Creates a new 3D button based on a mesh
  2338. * @param mesh mesh to become a 3D button
  2339. * @param name defines the control name
  2340. */
  2341. constructor(mesh: Mesh, name?: string);
  2342. protected _getTypeName(): string;
  2343. protected _createNode(scene: Scene): TransformNode;
  2344. protected _affectMaterial(mesh: AbstractMesh): void;
  2345. }
  2346. }
  2347. declare module 'babylonjs-gui/3D/controls/planePanel' {
  2348. import { Vector3 } from "babylonjs";
  2349. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2350. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2351. /**
  2352. * Class used to create a container panel deployed on the surface of a plane
  2353. */
  2354. export class PlanePanel extends VolumeBasedPanel {
  2355. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2356. }
  2357. }
  2358. declare module 'babylonjs-gui/3D/controls/scatterPanel' {
  2359. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2360. import { float, Vector3 } from "babylonjs";
  2361. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2362. /**
  2363. * Class used to create a container panel where items get randomized planar mapping
  2364. */
  2365. export class ScatterPanel extends VolumeBasedPanel {
  2366. /**
  2367. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  2368. */
  2369. iteration: float;
  2370. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2371. protected _finalProcessing(): void;
  2372. }
  2373. }
  2374. declare module 'babylonjs-gui/3D/controls/spherePanel' {
  2375. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2376. import { float, Vector3 } from "babylonjs";
  2377. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2378. /**
  2379. * Class used to create a container panel deployed on the surface of a sphere
  2380. */
  2381. export class SpherePanel extends VolumeBasedPanel {
  2382. /**
  2383. * Gets or sets the radius of the sphere where to project controls (5 by default)
  2384. */
  2385. radius: float;
  2386. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2387. }
  2388. }
  2389. declare module 'babylonjs-gui/3D/controls/stackPanel3D' {
  2390. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2391. /**
  2392. * Class used to create a stack panel in 3D on XY plane
  2393. */
  2394. export class StackPanel3D extends Container3D {
  2395. /**
  2396. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  2397. */
  2398. isVertical: boolean;
  2399. /**
  2400. * Gets or sets the distance between elements
  2401. */
  2402. margin: number;
  2403. /**
  2404. * Creates new StackPanel
  2405. * @param isVertical
  2406. */
  2407. constructor(isVertical?: boolean);
  2408. protected _arrangeChildren(): void;
  2409. }
  2410. }
  2411. declare module 'babylonjs-gui/3D/controls/volumeBasedPanel' {
  2412. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2413. import { int, Vector3 } from "babylonjs";
  2414. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2415. /**
  2416. * Abstract class used to create a container panel deployed on the surface of a volume
  2417. */
  2418. export abstract class VolumeBasedPanel extends Container3D {
  2419. protected _cellWidth: number;
  2420. protected _cellHeight: number;
  2421. /**
  2422. * Gets or sets the distance between elements
  2423. */
  2424. margin: number;
  2425. /**
  2426. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  2427. * | Value | Type | Description |
  2428. * | ----- | ----------------------------------- | ----------- |
  2429. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  2430. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  2431. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  2432. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  2433. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  2434. */
  2435. orientation: number;
  2436. /**
  2437. * Gets or sets the number of columns requested (10 by default).
  2438. * The panel will automatically compute the number of rows based on number of child controls.
  2439. */
  2440. columns: int;
  2441. /**
  2442. * Gets or sets a the number of rows requested.
  2443. * The panel will automatically compute the number of columns based on number of child controls.
  2444. */
  2445. rows: int;
  2446. /**
  2447. * Creates new VolumeBasedPanel
  2448. */
  2449. constructor();
  2450. protected _arrangeChildren(): void;
  2451. /** Child classes must implement this function to provide correct control positioning */
  2452. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2453. /** Child classes can implement this function to provide additional processing */
  2454. protected _finalProcessing(): void;
  2455. }
  2456. }
  2457. declare module 'babylonjs-gui/3D/materials/fluentMaterial' {
  2458. import { MaterialDefines, PushMaterial, Color3, Color4, Vector3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, Matrix, Mesh } from "babylonjs";
  2459. /** @hidden */
  2460. export class FluentMaterialDefines extends MaterialDefines {
  2461. INNERGLOW: boolean;
  2462. BORDER: boolean;
  2463. HOVERLIGHT: boolean;
  2464. constructor();
  2465. }
  2466. /**
  2467. * Class used to render controls with fluent desgin
  2468. */
  2469. export class FluentMaterial extends PushMaterial {
  2470. /**
  2471. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  2472. */
  2473. innerGlowColorIntensity: number;
  2474. /**
  2475. * Gets or sets the inner glow color (white by default)
  2476. */
  2477. innerGlowColor: Color3;
  2478. /**
  2479. * Gets or sets alpha value (default is 1.0)
  2480. */
  2481. alpha: number;
  2482. /**
  2483. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  2484. */
  2485. albedoColor: Color3;
  2486. /**
  2487. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  2488. */
  2489. renderBorders: boolean;
  2490. /**
  2491. * Gets or sets border width (default is 0.5)
  2492. */
  2493. borderWidth: number;
  2494. /**
  2495. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  2496. */
  2497. edgeSmoothingValue: number;
  2498. /**
  2499. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  2500. */
  2501. borderMinValue: number;
  2502. /**
  2503. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  2504. */
  2505. renderHoverLight: boolean;
  2506. /**
  2507. * Gets or sets the radius used to render the hover light (default is 1.0)
  2508. */
  2509. hoverRadius: number;
  2510. /**
  2511. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  2512. */
  2513. hoverColor: Color4;
  2514. /**
  2515. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  2516. */
  2517. hoverPosition: Vector3;
  2518. /**
  2519. * Creates a new Fluent material
  2520. * @param name defines the name of the material
  2521. * @param scene defines the hosting scene
  2522. */
  2523. constructor(name: string, scene: Scene);
  2524. needAlphaBlending(): boolean;
  2525. needAlphaTesting(): boolean;
  2526. getAlphaTestTexture(): Nullable<BaseTexture>;
  2527. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  2528. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  2529. getActiveTextures(): BaseTexture[];
  2530. hasTexture(texture: BaseTexture): boolean;
  2531. dispose(forceDisposeEffect?: boolean): void;
  2532. clone(name: string): FluentMaterial;
  2533. serialize(): any;
  2534. getClassName(): string;
  2535. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  2536. }
  2537. }
  2538. declare module 'babylonjs-gui/3D/charting/dataSeries' {
  2539. import { Color3 } from "babylonjs";
  2540. /** Class used to store data to display */
  2541. export class DataSeries {
  2542. /** Gets or sets the label of the series */
  2543. label: string;
  2544. /** Gets or sets the color associated with the series */
  2545. color: Color3;
  2546. /** Gets or sets the list of dimensions (used to filter data) */
  2547. dimensions: Array<string>;
  2548. /** Gets or sets the list of values (data to display) */
  2549. data: Array<any>;
  2550. /**
  2551. * Apply a list of filters to the data and return a list
  2552. * @param filters defines the filters to apply
  2553. * @returns an array containing the filtered data
  2554. */
  2555. getFilteredData(filters: {
  2556. [key: string]: string;
  2557. }): Array<any>;
  2558. /**
  2559. * Get the different values of a dimension
  2560. * @param key defines the dimension name
  2561. * @returns An array of values
  2562. */
  2563. getDimensionValues(key: string): Array<any>;
  2564. /**
  2565. * Create a new DataSeries containing testing values
  2566. * @returns the new DataSeries
  2567. */
  2568. static CreateFakeData(): DataSeries;
  2569. }
  2570. }
  2571. declare module 'babylonjs-gui/3D/charting/chart' {
  2572. import { Nullable, TransformNode, Scene, Vector3, Observable, Mesh, AbstractMesh } from "babylonjs";
  2573. import { DataSeries } from "babylonjs-gui/3D/charting";
  2574. /** base class for all chart controls*/
  2575. export abstract class Chart {
  2576. protected _dataSource: Nullable<DataSeries>;
  2577. protected _rootNode: TransformNode;
  2578. protected _dataFilters: {
  2579. [key: string]: string;
  2580. };
  2581. protected _scene: Scene;
  2582. protected _blockRefresh: boolean;
  2583. /** Observable raised when a new element is created */
  2584. onElementCreated: Observable<Mesh>;
  2585. /** User defined callback used to create labels */
  2586. labelCreationFunction: (label: string, width: number, includeBackground: boolean) => Mesh;
  2587. /**
  2588. * Observable raised when the point picked by the pointer events changed
  2589. */
  2590. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  2591. /**
  2592. * Observable raised when the pointer enters an element of the chart
  2593. */
  2594. onElementEnterObservable: Observable<AbstractMesh>;
  2595. /**
  2596. * Observable raised when the pointer leaves an element of the chart
  2597. */
  2598. onElementOutObservable: Observable<AbstractMesh>;
  2599. /** Gets or sets the rotation of the entire chart */
  2600. rotation: Vector3;
  2601. /** Gets or sets the position of the entire chart */
  2602. position: Vector3;
  2603. /** Gets or sets the scaling of the entire chart */
  2604. scaling: Vector3;
  2605. /** Gets or sets the data source used by the graph */
  2606. dataSource: Nullable<DataSeries>;
  2607. /** Gets the filters applied to data source */
  2608. dataFilters: {
  2609. [key: string]: string;
  2610. };
  2611. /** Gets the root node associated with this graph */
  2612. readonly rootNode: TransformNode;
  2613. /** Gets or sets a value indicating if refresh function should be executed (useful when multiple changes will happen and you want to run refresh only at the end) */
  2614. blockRefresh: boolean;
  2615. /** Gets or sets the name of the graph */
  2616. name: string;
  2617. /**
  2618. * Creates a new Chart
  2619. * @param name defines the name of the graph
  2620. * @param scene defines the hosting scene
  2621. */
  2622. constructor(name: string, scene?: Nullable<Scene>);
  2623. /**
  2624. * Function called by the chart objects when they need a label. Could be user defined if you set this.labelCreationFunction to a custom callback
  2625. * @param label defines the text of the label
  2626. * @param width defines the expected width (height is supposed to be 1)
  2627. * @param includeBackground defines if a background rectangle must be added (default is true)
  2628. * @returns a mesh used to host the label
  2629. */
  2630. addLabel(label: string, width: number, includeBackground?: boolean): Mesh;
  2631. /**
  2632. * Remove specific label mesh
  2633. * @param label defines the label mesh to remove
  2634. */
  2635. removeLabel(label: Mesh): void;
  2636. /** Remove all created labels */
  2637. removeLabels(): void;
  2638. /**
  2639. * Force the chart to redraw itself
  2640. * @returns the current chart
  2641. */
  2642. abstract refresh(): Chart;
  2643. /** Release all associated resources */
  2644. dispose(): void;
  2645. protected _clean(): void;
  2646. }
  2647. }
  2648. declare module 'babylonjs-gui/3D/charting/barGraph' {
  2649. import { Nullable, Scene, Mesh, Material } from "babylonjs";
  2650. import { Chart } from "babylonjs-gui/3D/charting";
  2651. /** Class used to render bar graphs */
  2652. export class BarGraph extends Chart {
  2653. protected _ownDefaultMaterial: boolean;
  2654. /** Gets or sets a boolean indicating if the background must be displayed */
  2655. displayBackground: boolean;
  2656. /** Gets or sets a boolean indicating if labels must be displayed */
  2657. displayLabels: boolean;
  2658. /** Gets or sets the margin between bars */
  2659. margin: number;
  2660. /** Gets or sets the with of each bar */
  2661. barWidth: number;
  2662. /** Gets or sets the maximum height of a bar */
  2663. maxBarHeight: number;
  2664. /** Gets or sets the dimension used for the labels */
  2665. labelDimension: string;
  2666. /** Gets or sets the material used by bar meshes */
  2667. defaultMaterial: Nullable<Material>;
  2668. /**
  2669. * Creates a new BarGraph
  2670. * @param name defines the name of the graph
  2671. * @param scene defines the hosting scene
  2672. */
  2673. constructor(name: string, scene?: Nullable<Scene>);
  2674. protected _createDefaultMaterial(scene: Scene): Material;
  2675. /**
  2676. * Children class can override this function to provide a new mesh (as long as it stays inside a 1x1x1 box)
  2677. * @param name defines the mesh name
  2678. * @param scene defines the hosting scene
  2679. * @returns a new mesh used to represent the current bar
  2680. */
  2681. protected _createBarMesh(name: string, scene: Scene): Mesh;
  2682. /**
  2683. * Force the graph to redraw itself
  2684. * @returns the current BarGraph
  2685. */
  2686. refresh(): BarGraph;
  2687. /** Clean associated resources */
  2688. dispose(): void;
  2689. protected _clean(): void;
  2690. }
  2691. }
  2692. /*BabylonJS GUI*/
  2693. // Dependencies for this module:
  2694. // ../../../../Tools/Gulp/babylonjs
  2695. declare module BABYLON.GUI {
  2696. }
  2697. declare module BABYLON.GUI {
  2698. }
  2699. declare module BABYLON.GUI {
  2700. }
  2701. declare module BABYLON.GUI {
  2702. }
  2703. declare module BABYLON.GUI {
  2704. /**
  2705. * Interface used to define a control that can receive focus
  2706. */
  2707. export interface IFocusableControl {
  2708. /**
  2709. * Function called when the control receives the focus
  2710. */
  2711. onFocus(): void;
  2712. /**
  2713. * Function called when the control loses the focus
  2714. */
  2715. onBlur(): void;
  2716. /**
  2717. * Function called to let the control handle keyboard events
  2718. * @param evt defines the current keyboard event
  2719. */
  2720. processKeyboard(evt: KeyboardEvent): void;
  2721. }
  2722. /**
  2723. * Class used to create texture to support 2D GUI elements
  2724. * @see http://doc.babylonjs.com/how_to/gui
  2725. */
  2726. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  2727. /** @hidden */
  2728. _rootContainer: Container;
  2729. /** @hidden */
  2730. _lastPickedControl: Control;
  2731. /** @hidden */
  2732. _lastControlOver: {
  2733. [pointerId: number]: Control;
  2734. };
  2735. /** @hidden */
  2736. _lastControlDown: {
  2737. [pointerId: number]: Control;
  2738. };
  2739. /** @hidden */
  2740. _capturingControl: {
  2741. [pointerId: number]: Control;
  2742. };
  2743. /** @hidden */
  2744. _shouldBlockPointer: boolean;
  2745. /** @hidden */
  2746. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  2747. /** @hidden */
  2748. _linkedControls: Control[];
  2749. /**
  2750. * Gets or sets a boolean defining if alpha is stored as premultiplied
  2751. */
  2752. premulAlpha: boolean;
  2753. /**
  2754. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  2755. * Useful when you want more antialiasing
  2756. */
  2757. renderScale: number;
  2758. /** Gets or sets the background color */
  2759. background: string;
  2760. /**
  2761. * Gets or sets the ideal width used to design controls.
  2762. * The GUI will then rescale everything accordingly
  2763. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2764. */
  2765. idealWidth: number;
  2766. /**
  2767. * Gets or sets the ideal height used to design controls.
  2768. * The GUI will then rescale everything accordingly
  2769. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2770. */
  2771. idealHeight: number;
  2772. /**
  2773. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  2774. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2775. */
  2776. useSmallestIdeal: boolean;
  2777. /**
  2778. * Gets or sets a boolean indicating if adaptive scaling must be used
  2779. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2780. */
  2781. renderAtIdealSize: boolean;
  2782. /**
  2783. * Gets the underlying layer used to render the texture when in fullscreen mode
  2784. */
  2785. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  2786. /**
  2787. * Gets the root container control
  2788. */
  2789. readonly rootContainer: Container;
  2790. /**
  2791. * Gets or sets the current focused control
  2792. */
  2793. focusedControl: BABYLON.Nullable<IFocusableControl>;
  2794. /**
  2795. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  2796. */
  2797. isForeground: boolean;
  2798. /**
  2799. * Creates a new AdvancedDynamicTexture
  2800. * @param name defines the name of the texture
  2801. * @param width defines the width of the texture
  2802. * @param height defines the height of the texture
  2803. * @param scene defines the hosting scene
  2804. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  2805. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  2806. */
  2807. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  2808. /**
  2809. * Function used to execute a function on all controls
  2810. * @param func defines the function to execute
  2811. * @param container defines the container where controls belong. If null the root container will be used
  2812. */
  2813. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  2814. /**
  2815. * Marks the texture as dirty forcing a complete update
  2816. */
  2817. markAsDirty(): void;
  2818. /**
  2819. * Helper function used to create a new style
  2820. * @returns a new style
  2821. * @see http://doc.babylonjs.com/how_to/gui#styles
  2822. */
  2823. createStyle(): Style;
  2824. /**
  2825. * Adds a new control to the root container
  2826. * @param control defines the control to add
  2827. * @returns the current texture
  2828. */
  2829. addControl(control: Control): AdvancedDynamicTexture;
  2830. /**
  2831. * Removes a control from the root container
  2832. * @param control defines the control to remove
  2833. * @returns the current texture
  2834. */
  2835. removeControl(control: Control): AdvancedDynamicTexture;
  2836. /**
  2837. * Release all resources
  2838. */
  2839. dispose(): void;
  2840. /** @hidden */
  2841. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  2842. /**
  2843. * Get screen coordinates for a vector3
  2844. * @param position defines the position to project
  2845. * @param worldMatrix defines the world matrix to use
  2846. * @returns the projected position
  2847. */
  2848. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  2849. /** @hidden */
  2850. _cleanControlAfterRemovalFromList(list: {
  2851. [pointerId: number]: Control;
  2852. }, control: Control): void;
  2853. /** @hidden */
  2854. _cleanControlAfterRemoval(control: Control): void;
  2855. /** Attach to all scene events required to support pointer events */
  2856. attach(): void;
  2857. /**
  2858. * Connect the texture to a hosting mesh to enable interactions
  2859. * @param mesh defines the mesh to attach to
  2860. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  2861. */
  2862. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  2863. /**
  2864. * Move the focus to a specific control
  2865. * @param control defines the control which will receive the focus
  2866. */
  2867. moveFocusToControl(control: IFocusableControl): void;
  2868. /**
  2869. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  2870. * @param mesh defines the mesh which will receive the texture
  2871. * @param width defines the texture width (1024 by default)
  2872. * @param height defines the texture height (1024 by default)
  2873. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  2874. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  2875. * @returns a new AdvancedDynamicTexture
  2876. */
  2877. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  2878. /**
  2879. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  2880. * In this mode the texture will rely on a layer for its rendering.
  2881. * This allows it to be treated like any other layer.
  2882. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  2883. * LayerMask is set through advancedTexture.layer.layerMask
  2884. * @param name defines name for the texture
  2885. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  2886. * @param scene defines the hsoting scene
  2887. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  2888. * @returns a new AdvancedDynamicTexture
  2889. */
  2890. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  2891. }
  2892. }
  2893. declare module BABYLON.GUI {
  2894. /**
  2895. * Class used to transport BABYLON.Vector2 information for pointer events
  2896. */
  2897. export class Vector2WithInfo extends BABYLON.Vector2 {
  2898. /** defines the current mouse button index */
  2899. buttonIndex: number;
  2900. /**
  2901. * Creates a new Vector2WithInfo
  2902. * @param source defines the vector2 data to transport
  2903. * @param buttonIndex defines the current mouse button index
  2904. */
  2905. constructor(source: BABYLON.Vector2,
  2906. /** defines the current mouse button index */
  2907. buttonIndex?: number);
  2908. }
  2909. /** Class used to provide 2D matrix features */
  2910. export class Matrix2D {
  2911. /** Gets the internal array of 6 floats used to store matrix data */
  2912. m: Float32Array;
  2913. /**
  2914. * Creates a new matrix
  2915. * @param m00 defines value for (0, 0)
  2916. * @param m01 defines value for (0, 1)
  2917. * @param m10 defines value for (1, 0)
  2918. * @param m11 defines value for (1, 1)
  2919. * @param m20 defines value for (2, 0)
  2920. * @param m21 defines value for (2, 1)
  2921. */
  2922. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  2923. /**
  2924. * Fills the matrix from direct values
  2925. * @param m00 defines value for (0, 0)
  2926. * @param m01 defines value for (0, 1)
  2927. * @param m10 defines value for (1, 0)
  2928. * @param m11 defines value for (1, 1)
  2929. * @param m20 defines value for (2, 0)
  2930. * @param m21 defines value for (2, 1)
  2931. * @returns the current modified matrix
  2932. */
  2933. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  2934. /**
  2935. * Gets matrix determinant
  2936. * @returns the determinant
  2937. */
  2938. determinant(): number;
  2939. /**
  2940. * Inverses the matrix and stores it in a target matrix
  2941. * @param result defines the target matrix
  2942. * @returns the current matrix
  2943. */
  2944. invertToRef(result: Matrix2D): Matrix2D;
  2945. /**
  2946. * Multiplies the current matrix with another one
  2947. * @param other defines the second operand
  2948. * @param result defines the target matrix
  2949. * @returns the current matrix
  2950. */
  2951. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  2952. /**
  2953. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  2954. * @param x defines the x coordinate to transform
  2955. * @param y defines the x coordinate to transform
  2956. * @param result defines the target vector2
  2957. * @returns the current matrix
  2958. */
  2959. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  2960. /**
  2961. * Creates an identity matrix
  2962. * @returns a new matrix
  2963. */
  2964. static Identity(): Matrix2D;
  2965. /**
  2966. * Creates a translation matrix and stores it in a target matrix
  2967. * @param x defines the x coordinate of the translation
  2968. * @param y defines the y coordinate of the translation
  2969. * @param result defines the target matrix
  2970. */
  2971. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  2972. /**
  2973. * Creates a scaling matrix and stores it in a target matrix
  2974. * @param x defines the x coordinate of the scaling
  2975. * @param y defines the y coordinate of the scaling
  2976. * @param result defines the target matrix
  2977. */
  2978. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  2979. /**
  2980. * Creates a rotation matrix and stores it in a target matrix
  2981. * @param angle defines the rotation angle
  2982. * @param result defines the target matrix
  2983. */
  2984. static RotationToRef(angle: number, result: Matrix2D): void;
  2985. /**
  2986. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  2987. * @param tx defines the x coordinate of the translation
  2988. * @param ty defines the y coordinate of the translation
  2989. * @param angle defines the rotation angle
  2990. * @param scaleX defines the x coordinate of the scaling
  2991. * @param scaleY defines the y coordinate of the scaling
  2992. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  2993. * @param result defines the target matrix
  2994. */
  2995. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  2996. }
  2997. }
  2998. declare module BABYLON.GUI {
  2999. /**
  3000. * Class used to store 2D control sizes
  3001. */
  3002. export class Measure {
  3003. /** defines left coordinate */
  3004. left: number;
  3005. /** defines top coordinate */
  3006. top: number;
  3007. /** defines width dimension */
  3008. width: number;
  3009. /** defines height dimension */
  3010. height: number;
  3011. /**
  3012. * Creates a new measure
  3013. * @param left defines left coordinate
  3014. * @param top defines top coordinate
  3015. * @param width defines width dimension
  3016. * @param height defines height dimension
  3017. */
  3018. constructor(
  3019. /** defines left coordinate */
  3020. left: number,
  3021. /** defines top coordinate */
  3022. top: number,
  3023. /** defines width dimension */
  3024. width: number,
  3025. /** defines height dimension */
  3026. height: number);
  3027. /**
  3028. * Copy from another measure
  3029. * @param other defines the other measure to copy from
  3030. */
  3031. copyFrom(other: Measure): void;
  3032. /**
  3033. * Check equality between this measure and another one
  3034. * @param other defines the other measures
  3035. * @returns true if both measures are equals
  3036. */
  3037. isEqualsTo(other: Measure): boolean;
  3038. /**
  3039. * Creates an empty measure
  3040. * @returns a new measure
  3041. */
  3042. static Empty(): Measure;
  3043. }
  3044. }
  3045. declare module BABYLON.GUI {
  3046. /**
  3047. * Class used to store a point for a MultiLine object.
  3048. * The point can be pure 2D coordinates, a mesh or a control
  3049. */
  3050. export class MultiLinePoint {
  3051. /** @hidden */
  3052. _point: BABYLON.Vector2;
  3053. /**
  3054. * Creates a new MultiLinePoint
  3055. * @param multiLine defines the source MultiLine object
  3056. */
  3057. constructor(multiLine: MultiLine);
  3058. /** Gets or sets x coordinate */
  3059. x: string | number;
  3060. /** Gets or sets y coordinate */
  3061. y: string | number;
  3062. /** Gets or sets the control associated with this point */
  3063. control: BABYLON.Nullable<Control>;
  3064. /** Gets or sets the mesh associated with this point */
  3065. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3066. /**
  3067. * Gets a translation vector
  3068. * @returns the translation vector
  3069. */
  3070. translate(): BABYLON.Vector2;
  3071. /** Release associated resources */
  3072. dispose(): void;
  3073. }
  3074. }
  3075. declare module BABYLON.GUI {
  3076. /**
  3077. * Define a style used by control to automatically setup properties based on a template.
  3078. * Only support font related properties so far
  3079. */
  3080. export class Style implements BABYLON.IDisposable {
  3081. /** @hidden */
  3082. _host: AdvancedDynamicTexture;
  3083. /** @hidden */
  3084. _fontSize: ValueAndUnit;
  3085. /**
  3086. * BABYLON.Observable raised when the style values are changed
  3087. */
  3088. onChangedObservable: BABYLON.Observable<Style>;
  3089. /**
  3090. * Creates a new style object
  3091. * @param host defines the AdvancedDynamicTexture which hosts this style
  3092. */
  3093. constructor(host: AdvancedDynamicTexture);
  3094. /**
  3095. * Gets or sets the font size
  3096. */
  3097. fontSize: string | number;
  3098. /**
  3099. * Gets or sets the font family
  3100. */
  3101. fontFamily: string;
  3102. /**
  3103. * Gets or sets the font style
  3104. */
  3105. fontStyle: string;
  3106. /** Gets or sets font weight */
  3107. fontWeight: string;
  3108. /** Dispose all associated resources */
  3109. dispose(): void;
  3110. }
  3111. }
  3112. declare module BABYLON.GUI {
  3113. /**
  3114. * Class used to specific a value and its associated unit
  3115. */
  3116. export class ValueAndUnit {
  3117. /** defines the unit to store */
  3118. unit: number;
  3119. /** defines a boolean indicating if the value can be negative */
  3120. negativeValueAllowed: boolean;
  3121. /**
  3122. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  3123. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3124. */
  3125. ignoreAdaptiveScaling: boolean;
  3126. /**
  3127. * Creates a new ValueAndUnit
  3128. * @param value defines the value to store
  3129. * @param unit defines the unit to store
  3130. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  3131. */
  3132. constructor(value: number,
  3133. /** defines the unit to store */
  3134. unit?: number,
  3135. /** defines a boolean indicating if the value can be negative */
  3136. negativeValueAllowed?: boolean);
  3137. /** Gets a boolean indicating if the value is a percentage */
  3138. readonly isPercentage: boolean;
  3139. /** Gets a boolean indicating if the value is store as pixel */
  3140. readonly isPixel: boolean;
  3141. /** Gets direct internal value */
  3142. readonly internalValue: number;
  3143. /**
  3144. * Gets value as pixel
  3145. * @param host defines the root host
  3146. * @param refValue defines the reference value for percentages
  3147. * @returns the value as pixel
  3148. */
  3149. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  3150. /**
  3151. * Gets the value accordingly to its unit
  3152. * @param host defines the root host
  3153. * @returns the value
  3154. */
  3155. getValue(host: AdvancedDynamicTexture): number;
  3156. /**
  3157. * Gets a string representation of the value
  3158. * @param host defines the root host
  3159. * @returns a string
  3160. */
  3161. toString(host: AdvancedDynamicTexture): string;
  3162. /**
  3163. * Store a value parsed from a string
  3164. * @param source defines the source string
  3165. * @returns true if the value was successfully parsed
  3166. */
  3167. fromString(source: string | number): boolean;
  3168. /** UNITMODE_PERCENTAGE */
  3169. static readonly UNITMODE_PERCENTAGE: number;
  3170. /** UNITMODE_PIXEL */
  3171. static readonly UNITMODE_PIXEL: number;
  3172. }
  3173. }
  3174. declare module BABYLON.GUI {
  3175. }
  3176. declare module BABYLON.GUI {
  3177. }
  3178. declare module BABYLON.GUI {
  3179. }
  3180. declare module BABYLON.GUI {
  3181. /**
  3182. * Class used to manage 3D user interface
  3183. * @see http://doc.babylonjs.com/how_to/gui3d
  3184. */
  3185. export class GUI3DManager implements BABYLON.IDisposable {
  3186. /** @hidden */
  3187. _lastPickedControl: Control3D;
  3188. /** @hidden */
  3189. _lastControlOver: {
  3190. [pointerId: number]: Control3D;
  3191. };
  3192. /** @hidden */
  3193. _lastControlDown: {
  3194. [pointerId: number]: Control3D;
  3195. };
  3196. /**
  3197. * BABYLON.Observable raised when the point picked by the pointer events changed
  3198. */
  3199. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3200. /** @hidden */
  3201. _sharedMaterials: {
  3202. [key: string]: BABYLON.Material;
  3203. };
  3204. /** Gets the hosting scene */
  3205. readonly scene: BABYLON.Scene;
  3206. /** Gets associated utility layer */
  3207. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3208. /**
  3209. * Creates a new GUI3DManager
  3210. * @param scene
  3211. */
  3212. constructor(scene?: BABYLON.Scene);
  3213. /**
  3214. * Gets the root container
  3215. */
  3216. readonly rootContainer: Container3D;
  3217. /**
  3218. * Gets a boolean indicating if the given control is in the root child list
  3219. * @param control defines the control to check
  3220. * @returns true if the control is in the root child list
  3221. */
  3222. containsControl(control: Control3D): boolean;
  3223. /**
  3224. * Adds a control to the root child list
  3225. * @param control defines the control to add
  3226. * @returns the current manager
  3227. */
  3228. addControl(control: Control3D): GUI3DManager;
  3229. /**
  3230. * Removes a control from the root child list
  3231. * @param control defines the control to remove
  3232. * @returns the current container
  3233. */
  3234. removeControl(control: Control3D): GUI3DManager;
  3235. /**
  3236. * Releases all associated resources
  3237. */
  3238. dispose(): void;
  3239. }
  3240. }
  3241. declare module BABYLON.GUI {
  3242. /**
  3243. * Class used to transport BABYLON.Vector3 information for pointer events
  3244. */
  3245. export class Vector3WithInfo extends BABYLON.Vector3 {
  3246. /** defines the current mouse button index */
  3247. buttonIndex: number;
  3248. /**
  3249. * Creates a new Vector3WithInfo
  3250. * @param source defines the vector3 data to transport
  3251. * @param buttonIndex defines the current mouse button index
  3252. */
  3253. constructor(source: BABYLON.Vector3,
  3254. /** defines the current mouse button index */
  3255. buttonIndex?: number);
  3256. }
  3257. }
  3258. declare module BABYLON.GUI {
  3259. /**
  3260. * Class used to create 2D buttons
  3261. */
  3262. export class Button extends Rectangle {
  3263. name?: string | undefined;
  3264. /**
  3265. * Function called to generate a pointer enter animation
  3266. */
  3267. pointerEnterAnimation: () => void;
  3268. /**
  3269. * Function called to generate a pointer out animation
  3270. */
  3271. pointerOutAnimation: () => void;
  3272. /**
  3273. * Function called to generate a pointer down animation
  3274. */
  3275. pointerDownAnimation: () => void;
  3276. /**
  3277. * Function called to generate a pointer up animation
  3278. */
  3279. pointerUpAnimation: () => void;
  3280. /**
  3281. * Creates a new Button
  3282. * @param name defines the name of the button
  3283. */
  3284. constructor(name?: string | undefined);
  3285. protected _getTypeName(): string;
  3286. /** @hidden */
  3287. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3288. /** @hidden */
  3289. _onPointerEnter(target: Control): boolean;
  3290. /** @hidden */
  3291. _onPointerOut(target: Control): void;
  3292. /** @hidden */
  3293. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3294. /** @hidden */
  3295. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3296. /**
  3297. * Creates a new button made with an image and a text
  3298. * @param name defines the name of the button
  3299. * @param text defines the text of the button
  3300. * @param imageUrl defines the url of the image
  3301. * @returns a new Button
  3302. */
  3303. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  3304. /**
  3305. * Creates a new button made with an image
  3306. * @param name defines the name of the button
  3307. * @param imageUrl defines the url of the image
  3308. * @returns a new Button
  3309. */
  3310. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  3311. /**
  3312. * Creates a new button made with a text
  3313. * @param name defines the name of the button
  3314. * @param text defines the text of the button
  3315. * @returns a new Button
  3316. */
  3317. static CreateSimpleButton(name: string, text: string): Button;
  3318. /**
  3319. * Creates a new button made with an image and a centered text
  3320. * @param name defines the name of the button
  3321. * @param text defines the text of the button
  3322. * @param imageUrl defines the url of the image
  3323. * @returns a new Button
  3324. */
  3325. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  3326. }
  3327. }
  3328. declare module BABYLON.GUI {
  3329. /**
  3330. * Class used to represent a 2D checkbox
  3331. */
  3332. export class Checkbox extends Control {
  3333. name?: string | undefined;
  3334. /** Gets or sets border thickness */
  3335. thickness: number;
  3336. /**
  3337. * BABYLON.Observable raised when isChecked property changes
  3338. */
  3339. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  3340. /** Gets or sets a value indicating the ratio between overall size and check size */
  3341. checkSizeRatio: number;
  3342. /** Gets or sets background color */
  3343. background: string;
  3344. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  3345. isChecked: boolean;
  3346. /**
  3347. * Creates a new CheckBox
  3348. * @param name defines the control name
  3349. */
  3350. constructor(name?: string | undefined);
  3351. protected _getTypeName(): string;
  3352. /** @hidden */
  3353. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3354. /** @hidden */
  3355. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3356. /**
  3357. * Utility function to easily create a checkbox with a header
  3358. * @param title defines the label to use for the header
  3359. * @param onValueChanged defines the callback to call when value changes
  3360. * @returns a StackPanel containing the checkbox and a textBlock
  3361. */
  3362. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  3363. }
  3364. }
  3365. declare module BABYLON.GUI {
  3366. /** Class used to create color pickers */
  3367. export class ColorPicker extends Control {
  3368. name?: string | undefined;
  3369. /**
  3370. * BABYLON.Observable raised when the value changes
  3371. */
  3372. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  3373. /** Gets or sets the color of the color picker */
  3374. value: BABYLON.Color3;
  3375. /** Gets or sets control width */
  3376. width: string | number;
  3377. /** Gets or sets control height */
  3378. height: string | number;
  3379. /** Gets or sets control size */
  3380. size: string | number;
  3381. /**
  3382. * Creates a new ColorPicker
  3383. * @param name defines the control name
  3384. */
  3385. constructor(name?: string | undefined);
  3386. protected _getTypeName(): string;
  3387. /** @hidden */
  3388. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3389. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3390. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3391. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3392. }
  3393. }
  3394. declare module BABYLON.GUI {
  3395. /**
  3396. * Root class for 2D containers
  3397. * @see http://doc.babylonjs.com/how_to/gui#containers
  3398. */
  3399. export class Container extends Control {
  3400. name?: string | undefined;
  3401. /** @hidden */
  3402. protected _children: Control[];
  3403. /** @hidden */
  3404. protected _measureForChildren: Measure;
  3405. /** @hidden */
  3406. protected _background: string;
  3407. /** @hidden */
  3408. protected _adaptWidthToChildren: boolean;
  3409. /** @hidden */
  3410. protected _adaptHeightToChildren: boolean;
  3411. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  3412. adaptHeightToChildren: boolean;
  3413. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  3414. adaptWidthToChildren: boolean;
  3415. /** Gets or sets background color */
  3416. background: string;
  3417. /** Gets the list of children */
  3418. readonly children: Control[];
  3419. /**
  3420. * Creates a new Container
  3421. * @param name defines the name of the container
  3422. */
  3423. constructor(name?: string | undefined);
  3424. protected _getTypeName(): string;
  3425. /**
  3426. * Gets a child using its name
  3427. * @param name defines the child name to look for
  3428. * @returns the child control if found
  3429. */
  3430. getChildByName(name: string): BABYLON.Nullable<Control>;
  3431. /**
  3432. * Gets a child using its type and its name
  3433. * @param name defines the child name to look for
  3434. * @param type defines the child type to look for
  3435. * @returns the child control if found
  3436. */
  3437. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  3438. /**
  3439. * Search for a specific control in children
  3440. * @param control defines the control to look for
  3441. * @returns true if the control is in child list
  3442. */
  3443. containsControl(control: Control): boolean;
  3444. /**
  3445. * Adds a new control to the current container
  3446. * @param control defines the control to add
  3447. * @returns the current container
  3448. */
  3449. addControl(control: BABYLON.Nullable<Control>): Container;
  3450. /**
  3451. * Removes all controls from the current container
  3452. * @returns the current container
  3453. */
  3454. clearControls(): Container;
  3455. /**
  3456. * Removes a control from the current container
  3457. * @param control defines the control to remove
  3458. * @returns the current container
  3459. */
  3460. removeControl(control: Control): Container;
  3461. /** @hidden */
  3462. _reOrderControl(control: Control): void;
  3463. /** @hidden */
  3464. _markMatrixAsDirty(): void;
  3465. /** @hidden */
  3466. _markAllAsDirty(): void;
  3467. /** @hidden */
  3468. protected _localDraw(context: CanvasRenderingContext2D): void;
  3469. /** @hidden */
  3470. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3471. /** @hidden */
  3472. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3473. /** @hidden */
  3474. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3475. /** @hidden */
  3476. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3477. /** @hidden */
  3478. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3479. /** Releases associated resources */
  3480. dispose(): void;
  3481. }
  3482. }
  3483. declare module BABYLON.GUI {
  3484. /**
  3485. * Root class used for all 2D controls
  3486. * @see http://doc.babylonjs.com/how_to/gui#controls
  3487. */
  3488. export class Control {
  3489. /** defines the name of the control */
  3490. name?: string | undefined;
  3491. /** @hidden */
  3492. _root: BABYLON.Nullable<Container>;
  3493. /** @hidden */
  3494. _host: AdvancedDynamicTexture;
  3495. /** Gets or sets the control parent */
  3496. parent: BABYLON.Nullable<Container>;
  3497. /** @hidden */
  3498. _currentMeasure: Measure;
  3499. /** @hidden */
  3500. _width: ValueAndUnit;
  3501. /** @hidden */
  3502. _height: ValueAndUnit;
  3503. /** @hidden */
  3504. protected _fontOffset: {
  3505. ascent: number;
  3506. height: number;
  3507. descent: number;
  3508. };
  3509. /** @hidden */
  3510. protected _horizontalAlignment: number;
  3511. /** @hidden */
  3512. protected _verticalAlignment: number;
  3513. /** @hidden */
  3514. _tempParentMeasure: Measure;
  3515. /** @hidden */
  3516. protected _cachedParentMeasure: Measure;
  3517. /** @hidden */
  3518. _left: ValueAndUnit;
  3519. /** @hidden */
  3520. _top: ValueAndUnit;
  3521. /** @hidden */
  3522. protected _invertTransformMatrix: Matrix2D;
  3523. /** @hidden */
  3524. protected _transformedPosition: BABYLON.Vector2;
  3525. /** @hidden */
  3526. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3527. /** @hidden */
  3528. _tag: any;
  3529. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  3530. isHitTestVisible: boolean;
  3531. /** Gets or sets a boolean indicating if the control can block pointer events */
  3532. isPointerBlocker: boolean;
  3533. /** Gets or sets a boolean indicating if the control can be focusable */
  3534. isFocusInvisible: boolean;
  3535. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  3536. shadowOffsetX: number;
  3537. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  3538. shadowOffsetY: number;
  3539. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  3540. shadowBlur: number;
  3541. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  3542. shadowColor: string;
  3543. /** @hidden */
  3544. protected _linkOffsetX: ValueAndUnit;
  3545. /** @hidden */
  3546. protected _linkOffsetY: ValueAndUnit;
  3547. /** Gets the control type name */
  3548. readonly typeName: string;
  3549. /**
  3550. * An event triggered when the pointer move over the control.
  3551. */
  3552. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  3553. /**
  3554. * An event triggered when the pointer move out of the control.
  3555. */
  3556. onPointerOutObservable: BABYLON.Observable<Control>;
  3557. /**
  3558. * An event triggered when the pointer taps the control
  3559. */
  3560. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  3561. /**
  3562. * An event triggered when pointer up
  3563. */
  3564. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  3565. /**
  3566. * An event triggered when a control is clicked on
  3567. */
  3568. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  3569. /**
  3570. * An event triggered when pointer enters the control
  3571. */
  3572. onPointerEnterObservable: BABYLON.Observable<Control>;
  3573. /**
  3574. * An event triggered when the control is marked as dirty
  3575. */
  3576. onDirtyObservable: BABYLON.Observable<Control>;
  3577. /**
  3578. * An event triggered after the control is drawn
  3579. */
  3580. onAfterDrawObservable: BABYLON.Observable<Control>;
  3581. /** Gets or set information about font offsets (used to render and align text) */
  3582. fontOffset: {
  3583. ascent: number;
  3584. height: number;
  3585. descent: number;
  3586. };
  3587. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  3588. alpha: number;
  3589. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  3590. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3591. */
  3592. scaleX: number;
  3593. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  3594. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3595. */
  3596. scaleY: number;
  3597. /** Gets or sets the rotation angle (0 by default)
  3598. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3599. */
  3600. rotation: number;
  3601. /** Gets or sets the transformation center on Y axis (0 by default)
  3602. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3603. */
  3604. transformCenterY: number;
  3605. /** Gets or sets the transformation center on X axis (0 by default)
  3606. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3607. */
  3608. transformCenterX: number;
  3609. /**
  3610. * Gets or sets the horizontal alignment
  3611. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3612. */
  3613. horizontalAlignment: number;
  3614. /**
  3615. * Gets or sets the vertical alignment
  3616. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3617. */
  3618. verticalAlignment: number;
  3619. /**
  3620. * Gets or sets control width
  3621. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3622. */
  3623. width: string | number;
  3624. /**
  3625. * Gets control width in pixel
  3626. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3627. */
  3628. readonly widthInPixels: number;
  3629. /**
  3630. * Gets or sets control height
  3631. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3632. */
  3633. height: string | number;
  3634. /**
  3635. * Gets control height in pixel
  3636. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3637. */
  3638. readonly heightInPixels: number;
  3639. /** Gets or set font family */
  3640. fontFamily: string;
  3641. /** Gets or sets font style */
  3642. fontStyle: string;
  3643. /** Gets or sets font weight */
  3644. fontWeight: string;
  3645. /**
  3646. * Gets or sets style
  3647. * @see http://doc.babylonjs.com/how_to/gui#styles
  3648. */
  3649. style: BABYLON.Nullable<Style>;
  3650. /** @hidden */
  3651. readonly _isFontSizeInPercentage: boolean;
  3652. /** Gets font size in pixels */
  3653. readonly fontSizeInPixels: number;
  3654. /** Gets or sets font size */
  3655. fontSize: string | number;
  3656. /** Gets or sets foreground color */
  3657. color: string;
  3658. /** Gets or sets z index which is used to reorder controls on the z axis */
  3659. zIndex: number;
  3660. /** Gets or sets a boolean indicating if the control can be rendered */
  3661. notRenderable: boolean;
  3662. /** Gets or sets a boolean indicating if the control is visible */
  3663. isVisible: boolean;
  3664. /** Gets a boolean indicating that the control needs to update its rendering */
  3665. readonly isDirty: boolean;
  3666. /**
  3667. * Gets or sets a value indicating the padding to use on the left of the control
  3668. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3669. */
  3670. paddingLeft: string | number;
  3671. /**
  3672. * Gets a value indicating the padding in pixels to use on the left of the control
  3673. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3674. */
  3675. readonly paddingLeftInPixels: number;
  3676. /**
  3677. * Gets or sets a value indicating the padding to use on the right of the control
  3678. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3679. */
  3680. paddingRight: string | number;
  3681. /**
  3682. * Gets a value indicating the padding in pixels to use on the right of the control
  3683. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3684. */
  3685. readonly paddingRightInPixels: number;
  3686. /**
  3687. * Gets or sets a value indicating the padding to use on the top of the control
  3688. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3689. */
  3690. paddingTop: string | number;
  3691. /**
  3692. * Gets a value indicating the padding in pixels to use on the top of the control
  3693. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3694. */
  3695. readonly paddingTopInPixels: number;
  3696. /**
  3697. * Gets or sets a value indicating the padding to use on the bottom of the control
  3698. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3699. */
  3700. paddingBottom: string | number;
  3701. /**
  3702. * Gets a value indicating the padding in pixels to use on the bottom of the control
  3703. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3704. */
  3705. readonly paddingBottomInPixels: number;
  3706. /**
  3707. * Gets or sets a value indicating the left coordinate of the control
  3708. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3709. */
  3710. left: string | number;
  3711. /**
  3712. * Gets a value indicating the left coordinate in pixels of the control
  3713. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3714. */
  3715. readonly leftInPixels: number;
  3716. /**
  3717. * Gets or sets a value indicating the top coordinate of the control
  3718. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3719. */
  3720. top: string | number;
  3721. /**
  3722. * Gets a value indicating the top coordinate in pixels of the control
  3723. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3724. */
  3725. readonly topInPixels: number;
  3726. /**
  3727. * Gets or sets a value indicating the offset on X axis to the linked mesh
  3728. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3729. */
  3730. linkOffsetX: string | number;
  3731. /**
  3732. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  3733. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3734. */
  3735. readonly linkOffsetXInPixels: number;
  3736. /**
  3737. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  3738. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3739. */
  3740. linkOffsetY: string | number;
  3741. /**
  3742. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  3743. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3744. */
  3745. readonly linkOffsetYInPixels: number;
  3746. /** Gets the center coordinate on X axis */
  3747. readonly centerX: number;
  3748. /** Gets the center coordinate on Y axis */
  3749. readonly centerY: number;
  3750. /**
  3751. * Creates a new control
  3752. * @param name defines the name of the control
  3753. */
  3754. constructor(
  3755. /** defines the name of the control */
  3756. name?: string | undefined);
  3757. /** @hidden */
  3758. protected _getTypeName(): string;
  3759. /** @hidden */
  3760. _resetFontCache(): void;
  3761. /**
  3762. * Gets coordinates in local control space
  3763. * @param globalCoordinates defines the coordinates to transform
  3764. * @returns the new coordinates in local space
  3765. */
  3766. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3767. /**
  3768. * Gets coordinates in local control space
  3769. * @param globalCoordinates defines the coordinates to transform
  3770. * @param result defines the target vector2 where to store the result
  3771. * @returns the current control
  3772. */
  3773. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  3774. /**
  3775. * Gets coordinates in parent local control space
  3776. * @param globalCoordinates defines the coordinates to transform
  3777. * @returns the new coordinates in parent local space
  3778. */
  3779. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3780. /**
  3781. * Move the current control to a vector3 position projected onto the screen.
  3782. * @param position defines the target position
  3783. * @param scene defines the hosting scene
  3784. */
  3785. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  3786. /**
  3787. * Link current control with a target mesh
  3788. * @param mesh defines the mesh to link with
  3789. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3790. */
  3791. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  3792. /** @hidden */
  3793. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  3794. /** @hidden */
  3795. _markMatrixAsDirty(): void;
  3796. /** @hidden */
  3797. _markAsDirty(): void;
  3798. /** @hidden */
  3799. _markAllAsDirty(): void;
  3800. /** @hidden */
  3801. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3802. /** @hidden */
  3803. protected _transform(context: CanvasRenderingContext2D): void;
  3804. /** @hidden */
  3805. protected _applyStates(context: CanvasRenderingContext2D): void;
  3806. /** @hidden */
  3807. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3808. /** @hidden */
  3809. protected _clip(context: CanvasRenderingContext2D): void;
  3810. /** @hidden */
  3811. _measure(): void;
  3812. /** @hidden */
  3813. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3814. /** @hidden */
  3815. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3816. /** @hidden */
  3817. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3818. /** @hidden */
  3819. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3820. /**
  3821. * Tests if a given coordinates belong to the current control
  3822. * @param x defines x coordinate to test
  3823. * @param y defines y coordinate to test
  3824. * @returns true if the coordinates are inside the control
  3825. */
  3826. contains(x: number, y: number): boolean;
  3827. /** @hidden */
  3828. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3829. /** @hidden */
  3830. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3831. /** @hidden */
  3832. _onPointerEnter(target: Control): boolean;
  3833. /** @hidden */
  3834. _onPointerOut(target: Control): void;
  3835. /** @hidden */
  3836. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3837. /** @hidden */
  3838. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3839. /** @hidden */
  3840. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  3841. /** @hidden */
  3842. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  3843. /** Releases associated resources */
  3844. dispose(): void;
  3845. /** HORIZONTAL_ALIGNMENT_LEFT */
  3846. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  3847. /** HORIZONTAL_ALIGNMENT_RIGHT */
  3848. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  3849. /** HORIZONTAL_ALIGNMENT_CENTER */
  3850. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  3851. /** VERTICAL_ALIGNMENT_TOP */
  3852. static readonly VERTICAL_ALIGNMENT_TOP: number;
  3853. /** VERTICAL_ALIGNMENT_BOTTOM */
  3854. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  3855. /** VERTICAL_ALIGNMENT_CENTER */
  3856. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  3857. /** @hidden */
  3858. static _GetFontOffset(font: string): {
  3859. ascent: number;
  3860. height: number;
  3861. descent: number;
  3862. };
  3863. /**
  3864. * Creates a stack panel that can be used to render headers
  3865. * @param control defines the control to associate with the header
  3866. * @param text defines the text of the header
  3867. * @param size defines the size of the header
  3868. * @param options defines options used to configure the header
  3869. * @returns a new StackPanel
  3870. * @ignore
  3871. * @hidden
  3872. */
  3873. static AddHeader: (control: Control, text: string, size: string | number, options: {
  3874. isHorizontal: boolean;
  3875. controlFirst: boolean;
  3876. }) => any;
  3877. /** @hidden */
  3878. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  3879. }
  3880. }
  3881. declare module BABYLON.GUI {
  3882. /** Class used to create 2D ellipse containers */
  3883. export class Ellipse extends Container {
  3884. name?: string | undefined;
  3885. /** Gets or sets border thickness */
  3886. thickness: number;
  3887. /**
  3888. * Creates a new Ellipse
  3889. * @param name defines the control name
  3890. */
  3891. constructor(name?: string | undefined);
  3892. protected _getTypeName(): string;
  3893. protected _localDraw(context: CanvasRenderingContext2D): void;
  3894. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3895. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3896. }
  3897. }
  3898. declare module BABYLON.GUI {
  3899. /**
  3900. * Class used to create a 2D grid container
  3901. */
  3902. export class Grid extends Container {
  3903. name?: string | undefined;
  3904. /** Gets the list of children */
  3905. readonly children: Control[];
  3906. /**
  3907. * Adds a new row to the grid
  3908. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  3909. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  3910. * @returns the current grid
  3911. */
  3912. addRowDefinition(height: number, isPixel?: boolean): Grid;
  3913. /**
  3914. * Adds a new column to the grid
  3915. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  3916. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  3917. * @returns the current grid
  3918. */
  3919. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  3920. /**
  3921. * Update a row definition
  3922. * @param index defines the index of the row to update
  3923. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  3924. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  3925. * @returns the current grid
  3926. */
  3927. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  3928. /**
  3929. * Update a column definition
  3930. * @param index defines the index of the column to update
  3931. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  3932. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  3933. * @returns the current grid
  3934. */
  3935. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  3936. /**
  3937. * Remove a column definition at specified index
  3938. * @param index defines the index of the column to remove
  3939. * @returns the current grid
  3940. */
  3941. removeColumnDefinition(index: number): Grid;
  3942. /**
  3943. * Remove a row definition at specified index
  3944. * @param index defines the index of the row to remove
  3945. * @returns the current grid
  3946. */
  3947. removeRowDefinition(index: number): Grid;
  3948. /**
  3949. * Adds a new control to the current grid
  3950. * @param control defines the control to add
  3951. * @param row defines the row where to add the control (0 by default)
  3952. * @param column defines the column where to add the control (0 by default)
  3953. * @returns the current grid
  3954. */
  3955. addControl(control: Control, row?: number, column?: number): Grid;
  3956. /**
  3957. * Removes a control from the current container
  3958. * @param control defines the control to remove
  3959. * @returns the current container
  3960. */
  3961. removeControl(control: Control): Container;
  3962. /**
  3963. * Creates a new Grid
  3964. * @param name defines control name
  3965. */
  3966. constructor(name?: string | undefined);
  3967. protected _getTypeName(): string;
  3968. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3969. /** Releases associated resources */
  3970. dispose(): void;
  3971. }
  3972. }
  3973. declare module BABYLON.GUI {
  3974. /**
  3975. * Class used to create 2D images
  3976. */
  3977. class GUIImage extends Control {
  3978. name?: string | undefined;
  3979. /**
  3980. * Gets or sets the left coordinate in the source image
  3981. */
  3982. sourceLeft: number;
  3983. /**
  3984. * Gets or sets the top coordinate in the source image
  3985. */
  3986. sourceTop: number;
  3987. /**
  3988. * Gets or sets the width to capture in the source image
  3989. */
  3990. sourceWidth: number;
  3991. /**
  3992. * Gets or sets the height to capture in the source image
  3993. */
  3994. sourceHeight: number;
  3995. /**
  3996. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  3997. * @see http://doc.babylonjs.com/how_to/gui#image
  3998. */
  3999. autoScale: boolean;
  4000. /** Gets or sets the streching mode used by the image */
  4001. stretch: number;
  4002. /**
  4003. * Gets or sets the internal DOM image used to render the control
  4004. */
  4005. domImage: HTMLImageElement;
  4006. /**
  4007. * Gets or sets image source url
  4008. */
  4009. source: BABYLON.Nullable<string>;
  4010. /**
  4011. * Gets or sets the cell width to use when animation sheet is enabled
  4012. * @see http://doc.babylonjs.com/how_to/gui#image
  4013. */
  4014. cellWidth: number;
  4015. /**
  4016. * Gets or sets the cell height to use when animation sheet is enabled
  4017. * @see http://doc.babylonjs.com/how_to/gui#image
  4018. */
  4019. cellHeight: number;
  4020. /**
  4021. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  4022. * @see http://doc.babylonjs.com/how_to/gui#image
  4023. */
  4024. cellId: number;
  4025. /**
  4026. * Creates a new Image
  4027. * @param name defines the control name
  4028. * @param url defines the image url
  4029. */
  4030. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  4031. protected _getTypeName(): string;
  4032. /** Force the control to synchronize with its content */
  4033. synchronizeSizeWithContent(): void;
  4034. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4035. /** STRETCH_NONE */
  4036. static readonly STRETCH_NONE: number;
  4037. /** STRETCH_FILL */
  4038. static readonly STRETCH_FILL: number;
  4039. /** STRETCH_UNIFORM */
  4040. static readonly STRETCH_UNIFORM: number;
  4041. /** STRETCH_EXTEND */
  4042. static readonly STRETCH_EXTEND: number;
  4043. }
  4044. }
  4045. declare module BABYLON.GUI {
  4046. /**
  4047. * Class used to create input text control
  4048. */
  4049. export class InputText extends Control implements IFocusableControl {
  4050. name?: string | undefined;
  4051. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  4052. promptMessage: string;
  4053. /** BABYLON.Observable raised when the text changes */
  4054. onTextChangedObservable: BABYLON.Observable<InputText>;
  4055. /** BABYLON.Observable raised just before an entered character is to be added */
  4056. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  4057. /** BABYLON.Observable raised when the control gets the focus */
  4058. onFocusObservable: BABYLON.Observable<InputText>;
  4059. /** BABYLON.Observable raised when the control loses the focus */
  4060. onBlurObservable: BABYLON.Observable<InputText>;
  4061. /** Gets or sets the maximum width allowed by the control */
  4062. maxWidth: string | number;
  4063. /** Gets the maximum width allowed by the control in pixels */
  4064. readonly maxWidthInPixels: number;
  4065. /** Gets or sets control margin */
  4066. margin: string;
  4067. /** Gets control margin in pixels */
  4068. readonly marginInPixels: number;
  4069. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  4070. autoStretchWidth: boolean;
  4071. /** Gets or sets border thickness */
  4072. thickness: number;
  4073. /** Gets or sets the background color when focused */
  4074. focusedBackground: string;
  4075. /** Gets or sets the background color */
  4076. background: string;
  4077. /** Gets or sets the placeholder color */
  4078. placeholderColor: string;
  4079. /** Gets or sets the text displayed when the control is empty */
  4080. placeholderText: string;
  4081. /** Gets or sets the dead key flag */
  4082. deadKey: boolean;
  4083. /** Gets or sets if the current key should be added */
  4084. addKey: boolean;
  4085. /** Gets or sets the value of the current key being entered */
  4086. currentKey: string;
  4087. /** Gets or sets the text displayed in the control */
  4088. text: string;
  4089. /** Gets or sets control width */
  4090. width: string | number;
  4091. /**
  4092. * Creates a new InputText
  4093. * @param name defines the control name
  4094. * @param text defines the text of the control
  4095. */
  4096. constructor(name?: string | undefined, text?: string);
  4097. /** @hidden */
  4098. onBlur(): void;
  4099. /** @hidden */
  4100. onFocus(): void;
  4101. protected _getTypeName(): string;
  4102. /** @hidden */
  4103. processKey(keyCode: number, key?: string): void;
  4104. /** @hidden */
  4105. processKeyboard(evt: KeyboardEvent): void;
  4106. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4107. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4108. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4109. protected _beforeRenderText(text: string): string;
  4110. dispose(): void;
  4111. }
  4112. }
  4113. declare module BABYLON.GUI {
  4114. /**
  4115. * Class used to create a password control
  4116. */
  4117. export class InputPassword extends InputText {
  4118. protected _beforeRenderText(text: string): string;
  4119. }
  4120. }
  4121. declare module BABYLON.GUI {
  4122. /** Class used to render 2D lines */
  4123. export class Line extends Control {
  4124. name?: string | undefined;
  4125. /** Gets or sets the dash pattern */
  4126. dash: Array<number>;
  4127. /** Gets or sets the control connected with the line end */
  4128. connectedControl: Control;
  4129. /** Gets or sets start coordinates on X axis */
  4130. x1: string | number;
  4131. /** Gets or sets start coordinates on Y axis */
  4132. y1: string | number;
  4133. /** Gets or sets end coordinates on X axis */
  4134. x2: string | number;
  4135. /** Gets or sets end coordinates on Y axis */
  4136. y2: string | number;
  4137. /** Gets or sets line width */
  4138. lineWidth: number;
  4139. /** Gets or sets horizontal alignment */
  4140. horizontalAlignment: number;
  4141. /** Gets or sets vertical alignment */
  4142. verticalAlignment: number;
  4143. /**
  4144. * Creates a new Line
  4145. * @param name defines the control name
  4146. */
  4147. constructor(name?: string | undefined);
  4148. protected _getTypeName(): string;
  4149. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4150. _measure(): void;
  4151. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4152. /**
  4153. * Move one end of the line given 3D cartesian coordinates.
  4154. * @param position Targeted world position
  4155. * @param scene BABYLON.Scene
  4156. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4157. */
  4158. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  4159. /**
  4160. * Move one end of the line to a position in screen absolute space.
  4161. * @param projectedPosition Position in screen absolute space (X, Y)
  4162. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4163. */
  4164. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  4165. }
  4166. }
  4167. declare module BABYLON.GUI {
  4168. /**
  4169. * Class used to create multi line control
  4170. */
  4171. export class MultiLine extends Control {
  4172. name?: string | undefined;
  4173. /**
  4174. * Creates a new MultiLine
  4175. * @param name defines the control name
  4176. */
  4177. constructor(name?: string | undefined);
  4178. /** Gets or sets dash pattern */
  4179. dash: Array<number>;
  4180. /**
  4181. * Gets point stored at specified index
  4182. * @param index defines the index to look for
  4183. * @returns the requested point if found
  4184. */
  4185. getAt(index: number): MultiLinePoint;
  4186. /** Function called when a point is updated */
  4187. onPointUpdate: () => void;
  4188. /**
  4189. * Adds new points to the point collection
  4190. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  4191. * @returns the list of created MultiLinePoint
  4192. */
  4193. add(...items: (AbstractMesh | Control | {
  4194. x: string | number;
  4195. y: string | number;
  4196. })[]): MultiLinePoint[];
  4197. /**
  4198. * Adds a new point to the point collection
  4199. * @param item defines the item (mesh, control or 2d coordiantes) to add
  4200. * @returns the created MultiLinePoint
  4201. */
  4202. push(item?: (AbstractMesh | Control | {
  4203. x: string | number;
  4204. y: string | number;
  4205. })): MultiLinePoint;
  4206. /**
  4207. * Remove a specific value or point from the active point collection
  4208. * @param value defines the value or point to remove
  4209. */
  4210. remove(value: number | MultiLinePoint): void;
  4211. /** Gets or sets line width */
  4212. lineWidth: number;
  4213. horizontalAlignment: number;
  4214. verticalAlignment: number;
  4215. protected _getTypeName(): string;
  4216. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4217. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4218. _measure(): void;
  4219. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4220. dispose(): void;
  4221. }
  4222. }
  4223. declare module BABYLON.GUI {
  4224. /**
  4225. * Class used to create radio button controls
  4226. */
  4227. export class RadioButton extends Control {
  4228. name?: string | undefined;
  4229. /** Gets or sets border thickness */
  4230. thickness: number;
  4231. /** Gets or sets group name */
  4232. group: string;
  4233. /** BABYLON.Observable raised when isChecked is changed */
  4234. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  4235. /** Gets or sets a value indicating the ratio between overall size and check size */
  4236. checkSizeRatio: number;
  4237. /** Gets or sets background color */
  4238. background: string;
  4239. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  4240. isChecked: boolean;
  4241. /**
  4242. * Creates a new RadioButton
  4243. * @param name defines the control name
  4244. */
  4245. constructor(name?: string | undefined);
  4246. protected _getTypeName(): string;
  4247. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4248. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4249. }
  4250. }
  4251. declare module BABYLON.GUI {
  4252. /**
  4253. * Class used to create a 2D stack panel container
  4254. */
  4255. export class StackPanel extends Container {
  4256. name?: string | undefined;
  4257. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  4258. isVertical: boolean;
  4259. /** Gets or sets panel width */
  4260. width: string | number;
  4261. /** Gets or sets panel height */
  4262. height: string | number;
  4263. /**
  4264. * Creates a new StackPanel
  4265. * @param name defines control name
  4266. */
  4267. constructor(name?: string | undefined);
  4268. protected _getTypeName(): string;
  4269. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4270. }
  4271. }
  4272. declare module BABYLON.GUI {
  4273. /**
  4274. * Enum that determines the text-wrapping mode to use.
  4275. */
  4276. export enum TextWrapping {
  4277. /**
  4278. * Clip the text when it's larger than Control.width; this is the default mode.
  4279. */
  4280. Clip = 0,
  4281. /**
  4282. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  4283. */
  4284. WordWrap = 1,
  4285. /**
  4286. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  4287. */
  4288. Ellipsis = 2
  4289. }
  4290. /**
  4291. * Class used to create text block control
  4292. */
  4293. export class TextBlock extends Control {
  4294. /**
  4295. * Defines the name of the control
  4296. */
  4297. name?: string | undefined;
  4298. /**
  4299. * An event triggered after the text is changed
  4300. */
  4301. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  4302. /**
  4303. * An event triggered after the text was broken up into lines
  4304. */
  4305. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  4306. /**
  4307. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  4308. */
  4309. readonly lines: any[];
  4310. /**
  4311. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  4312. */
  4313. resizeToFit: boolean;
  4314. /**
  4315. * Gets or sets a boolean indicating if text must be wrapped
  4316. */
  4317. textWrapping: TextWrapping | boolean;
  4318. /**
  4319. * Gets or sets text to display
  4320. */
  4321. text: string;
  4322. /**
  4323. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  4324. */
  4325. textHorizontalAlignment: number;
  4326. /**
  4327. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  4328. */
  4329. textVerticalAlignment: number;
  4330. /**
  4331. * Gets or sets line spacing value
  4332. */
  4333. lineSpacing: string | number;
  4334. /**
  4335. * Gets or sets outlineWidth of the text to display
  4336. */
  4337. outlineWidth: number;
  4338. /**
  4339. * Gets or sets outlineColor of the text to display
  4340. */
  4341. outlineColor: string;
  4342. /**
  4343. * Creates a new TextBlock object
  4344. * @param name defines the name of the control
  4345. * @param text defines the text to display (emptry string by default)
  4346. */
  4347. constructor(
  4348. /**
  4349. * Defines the name of the control
  4350. */
  4351. name?: string | undefined, text?: string);
  4352. protected _getTypeName(): string;
  4353. /** @hidden */
  4354. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4355. protected _applyStates(context: CanvasRenderingContext2D): void;
  4356. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4357. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  4358. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  4359. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  4360. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  4361. protected _renderLines(context: CanvasRenderingContext2D): void;
  4362. /**
  4363. * Given a width constraint applied on the text block, find the expected height
  4364. * @returns expected height
  4365. */
  4366. computeExpectedHeight(): number;
  4367. dispose(): void;
  4368. }
  4369. }
  4370. declare module BABYLON.GUI {
  4371. /**
  4372. * Class used to store key control properties
  4373. */
  4374. export class KeyPropertySet {
  4375. /** Width */
  4376. width?: string;
  4377. /** Height */
  4378. height?: string;
  4379. /** Left padding */
  4380. paddingLeft?: string;
  4381. /** Right padding */
  4382. paddingRight?: string;
  4383. /** Top padding */
  4384. paddingTop?: string;
  4385. /** Bottom padding */
  4386. paddingBottom?: string;
  4387. /** Foreground color */
  4388. color?: string;
  4389. /** Background color */
  4390. background?: string;
  4391. }
  4392. /**
  4393. * Class used to create virtual keyboard
  4394. */
  4395. export class VirtualKeyboard extends StackPanel {
  4396. /** BABYLON.Observable raised when a key is pressed */
  4397. onKeyPressObservable: BABYLON.Observable<string>;
  4398. /** Gets or sets default key button width */
  4399. defaultButtonWidth: string;
  4400. /** Gets or sets default key button height */
  4401. defaultButtonHeight: string;
  4402. /** Gets or sets default key button left padding */
  4403. defaultButtonPaddingLeft: string;
  4404. /** Gets or sets default key button right padding */
  4405. defaultButtonPaddingRight: string;
  4406. /** Gets or sets default key button top padding */
  4407. defaultButtonPaddingTop: string;
  4408. /** Gets or sets default key button bottom padding */
  4409. defaultButtonPaddingBottom: string;
  4410. /** Gets or sets default key button foreground color */
  4411. defaultButtonColor: string;
  4412. /** Gets or sets default key button background color */
  4413. defaultButtonBackground: string;
  4414. /** Gets or sets shift button foreground color */
  4415. shiftButtonColor: string;
  4416. /** Gets or sets shift button thickness*/
  4417. selectedShiftThickness: number;
  4418. /** Gets shift key state */
  4419. shiftState: number;
  4420. protected _getTypeName(): string;
  4421. /**
  4422. * Adds a new row of keys
  4423. * @param keys defines the list of keys to add
  4424. * @param propertySets defines the associated property sets
  4425. */
  4426. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  4427. /**
  4428. * Set the shift key to a specific state
  4429. * @param shiftState defines the new shift state
  4430. */
  4431. applyShiftState(shiftState: number): void;
  4432. /** Gets the input text control attached with the keyboard */
  4433. readonly connectedInputText: BABYLON.Nullable<InputText>;
  4434. /**
  4435. * Connects the keyboard with an input text control
  4436. * @param input defines the target control
  4437. */
  4438. connect(input: InputText): void;
  4439. /**
  4440. * Disconnects the keyboard from an input text control
  4441. */
  4442. disconnect(): void;
  4443. /**
  4444. * Creates a new keyboard using a default layout
  4445. * @returns a new VirtualKeyboard
  4446. */
  4447. static CreateDefaultLayout(): VirtualKeyboard;
  4448. }
  4449. }
  4450. declare module BABYLON.GUI {
  4451. /**
  4452. * Class used to create slider controls
  4453. */
  4454. export class Slider extends Control {
  4455. name?: string | undefined;
  4456. /** BABYLON.Observable raised when the sldier value changes */
  4457. onValueChangedObservable: BABYLON.Observable<number>;
  4458. /** Gets or sets border color */
  4459. borderColor: string;
  4460. /** Gets or sets background color */
  4461. background: string;
  4462. /** Gets or sets main bar offset */
  4463. barOffset: string | number;
  4464. /** Gets main bar offset in pixels*/
  4465. readonly barOffsetInPixels: number;
  4466. /** Gets or sets thumb width */
  4467. thumbWidth: string | number;
  4468. /** Gets thumb width in pixels */
  4469. readonly thumbWidthInPixels: number;
  4470. /** Gets or sets minimum value */
  4471. minimum: number;
  4472. /** Gets or sets maximum value */
  4473. maximum: number;
  4474. /** Gets or sets current value */
  4475. value: number;
  4476. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  4477. isVertical: boolean;
  4478. /** Gets or sets a boolean indicating if the thumb should be round or square */
  4479. isThumbCircle: boolean;
  4480. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  4481. isThumbClamped: boolean;
  4482. /**
  4483. * Creates a new Slider
  4484. * @param name defines the control name
  4485. */
  4486. constructor(name?: string | undefined);
  4487. protected _getTypeName(): string;
  4488. protected _getThumbThickness(type: string, backgroundLength: number): number;
  4489. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4490. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4491. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4492. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4493. }
  4494. }
  4495. declare module BABYLON.GUI {
  4496. /** Class used to create rectangle container */
  4497. export class Rectangle extends Container {
  4498. name?: string | undefined;
  4499. /** Gets or sets border thickness */
  4500. thickness: number;
  4501. /** Gets or sets the corner radius angle */
  4502. cornerRadius: number;
  4503. /**
  4504. * Creates a new Rectangle
  4505. * @param name defines the control name
  4506. */
  4507. constructor(name?: string | undefined);
  4508. protected _getTypeName(): string;
  4509. protected _localDraw(context: CanvasRenderingContext2D): void;
  4510. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4511. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4512. }
  4513. }
  4514. declare module BABYLON.GUI {
  4515. /** Class used to render a grid */
  4516. export class DisplayGrid extends Control {
  4517. name?: string | undefined;
  4518. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  4519. displayMinorLines: boolean;
  4520. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  4521. displayMajorLines: boolean;
  4522. /** Gets or sets background color (Black by default) */
  4523. background: string;
  4524. /** Gets or sets the width of each cell (20 by default) */
  4525. cellWidth: number;
  4526. /** Gets or sets the height of each cell (20 by default) */
  4527. cellHeight: number;
  4528. /** Gets or sets the tickness of minor lines (1 by default) */
  4529. minorLineTickness: number;
  4530. /** Gets or sets the color of minor lines (DarkGray by default) */
  4531. minorLineColor: string;
  4532. /** Gets or sets the tickness of major lines (2 by default) */
  4533. majorLineTickness: number;
  4534. /** Gets or sets the color of major lines (White by default) */
  4535. majorLineColor: string;
  4536. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  4537. majorLineFrequency: number;
  4538. /**
  4539. * Creates a new GridDisplayRectangle
  4540. * @param name defines the control name
  4541. */
  4542. constructor(name?: string | undefined);
  4543. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4544. protected _getTypeName(): string;
  4545. }
  4546. }
  4547. declare module BABYLON.GUI {
  4548. /**
  4549. * Forcing an export so that this code will execute
  4550. * @hidden
  4551. */
  4552. const name = "Statics";
  4553. }
  4554. declare module BABYLON.GUI {
  4555. /**
  4556. * Class used as a root to all buttons
  4557. */
  4558. export class AbstractButton3D extends Control3D {
  4559. /**
  4560. * Creates a new button
  4561. * @param name defines the control name
  4562. */
  4563. constructor(name?: string);
  4564. protected _getTypeName(): string;
  4565. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4566. }
  4567. }
  4568. declare module BABYLON.GUI {
  4569. /**
  4570. * Class used to create a button in 3D
  4571. */
  4572. export class Button3D extends AbstractButton3D {
  4573. /** @hidden */
  4574. protected _currentMaterial: BABYLON.Material;
  4575. /**
  4576. * Gets or sets the texture resolution used to render content (512 by default)
  4577. */
  4578. contentResolution: BABYLON.int;
  4579. /**
  4580. * Gets or sets the texture scale ratio used to render content (2 by default)
  4581. */
  4582. contentScaleRatio: number;
  4583. protected _disposeFacadeTexture(): void;
  4584. protected _resetContent(): void;
  4585. /**
  4586. * Creates a new button
  4587. * @param name defines the control name
  4588. */
  4589. constructor(name?: string);
  4590. /**
  4591. * Gets or sets the GUI 2D content used to display the button's facade
  4592. */
  4593. content: Control;
  4594. /**
  4595. * Apply the facade texture (created from the content property).
  4596. * This function can be overloaded by child classes
  4597. * @param facadeTexture defines the AdvancedDynamicTexture to use
  4598. */
  4599. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4600. protected _getTypeName(): string;
  4601. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4602. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4603. /**
  4604. * Releases all associated resources
  4605. */
  4606. dispose(): void;
  4607. }
  4608. }
  4609. declare module BABYLON.GUI {
  4610. /**
  4611. * Class used to create containers for controls
  4612. */
  4613. export class Container3D extends Control3D {
  4614. /**
  4615. * Gets the list of child controls
  4616. */
  4617. protected _children: Control3D[];
  4618. /**
  4619. * Gets the list of child controls
  4620. */
  4621. readonly children: Array<Control3D>;
  4622. /**
  4623. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  4624. * This is helpful to optimize layout operation when adding multiple children in a row
  4625. */
  4626. blockLayout: boolean;
  4627. /**
  4628. * Creates a new container
  4629. * @param name defines the container name
  4630. */
  4631. constructor(name?: string);
  4632. /**
  4633. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  4634. * @returns the current container
  4635. */
  4636. updateLayout(): Container3D;
  4637. /**
  4638. * Gets a boolean indicating if the given control is in the children of this control
  4639. * @param control defines the control to check
  4640. * @returns true if the control is in the child list
  4641. */
  4642. containsControl(control: Control3D): boolean;
  4643. /**
  4644. * Adds a control to the children of this control
  4645. * @param control defines the control to add
  4646. * @returns the current container
  4647. */
  4648. addControl(control: Control3D): Container3D;
  4649. /**
  4650. * This function will be called everytime a new control is added
  4651. */
  4652. protected _arrangeChildren(): void;
  4653. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  4654. /**
  4655. * Removes a control from the children of this control
  4656. * @param control defines the control to remove
  4657. * @returns the current container
  4658. */
  4659. removeControl(control: Control3D): Container3D;
  4660. protected _getTypeName(): string;
  4661. /**
  4662. * Releases all associated resources
  4663. */
  4664. dispose(): void;
  4665. /** Control rotation will remain unchanged */
  4666. static readonly UNSET_ORIENTATION: number;
  4667. /** Control will rotate to make it look at sphere central axis */
  4668. static readonly FACEORIGIN_ORIENTATION: number;
  4669. /** Control will rotate to make it look back at sphere central axis */
  4670. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  4671. /** Control will rotate to look at z axis (0, 0, 1) */
  4672. static readonly FACEFORWARD_ORIENTATION: number;
  4673. /** Control will rotate to look at negative z axis (0, 0, -1) */
  4674. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  4675. }
  4676. }
  4677. declare module BABYLON.GUI {
  4678. /**
  4679. * Class used as base class for controls
  4680. */
  4681. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  4682. /** Defines the control name */
  4683. name?: string | undefined;
  4684. /** @hidden */
  4685. _host: GUI3DManager;
  4686. /** Gets or sets the control position in world space */
  4687. position: BABYLON.Vector3;
  4688. /** Gets or sets the control scaling in world space */
  4689. scaling: BABYLON.Vector3;
  4690. /** Callback used to start pointer enter animation */
  4691. pointerEnterAnimation: () => void;
  4692. /** Callback used to start pointer out animation */
  4693. pointerOutAnimation: () => void;
  4694. /** Callback used to start pointer down animation */
  4695. pointerDownAnimation: () => void;
  4696. /** Callback used to start pointer up animation */
  4697. pointerUpAnimation: () => void;
  4698. /**
  4699. * An event triggered when the pointer move over the control
  4700. */
  4701. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  4702. /**
  4703. * An event triggered when the pointer move out of the control
  4704. */
  4705. onPointerOutObservable: BABYLON.Observable<Control3D>;
  4706. /**
  4707. * An event triggered when the pointer taps the control
  4708. */
  4709. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  4710. /**
  4711. * An event triggered when pointer is up
  4712. */
  4713. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  4714. /**
  4715. * An event triggered when a control is clicked on (with a mouse)
  4716. */
  4717. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  4718. /**
  4719. * An event triggered when pointer enters the control
  4720. */
  4721. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  4722. /**
  4723. * Gets or sets the parent container
  4724. */
  4725. parent: BABYLON.Nullable<Container3D>;
  4726. /**
  4727. * Gets the list of attached behaviors
  4728. * @see http://doc.babylonjs.com/features/behaviour
  4729. */
  4730. readonly behaviors: BABYLON.Behavior<Control3D>[];
  4731. /**
  4732. * Attach a behavior to the control
  4733. * @see http://doc.babylonjs.com/features/behaviour
  4734. * @param behavior defines the behavior to attach
  4735. * @returns the current control
  4736. */
  4737. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  4738. /**
  4739. * Remove an attached behavior
  4740. * @see http://doc.babylonjs.com/features/behaviour
  4741. * @param behavior defines the behavior to attach
  4742. * @returns the current control
  4743. */
  4744. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  4745. /**
  4746. * Gets an attached behavior by name
  4747. * @param name defines the name of the behavior to look for
  4748. * @see http://doc.babylonjs.com/features/behaviour
  4749. * @returns null if behavior was not found else the requested behavior
  4750. */
  4751. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  4752. /** Gets or sets a boolean indicating if the control is visible */
  4753. isVisible: boolean;
  4754. /**
  4755. * Creates a new control
  4756. * @param name defines the control name
  4757. */
  4758. constructor(
  4759. /** Defines the control name */
  4760. name?: string | undefined);
  4761. /**
  4762. * Gets a string representing the class name
  4763. */
  4764. readonly typeName: string;
  4765. protected _getTypeName(): string;
  4766. /**
  4767. * Gets the transform node used by this control
  4768. */
  4769. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  4770. /**
  4771. * Gets the mesh used to render this control
  4772. */
  4773. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  4774. /**
  4775. * Link the control as child of the given node
  4776. * @param node defines the node to link to. Use null to unlink the control
  4777. * @returns the current control
  4778. */
  4779. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  4780. /** @hidden **/
  4781. _prepareNode(scene: BABYLON.Scene): void;
  4782. /**
  4783. * Node creation.
  4784. * Can be overriden by children
  4785. * @param scene defines the scene where the node must be attached
  4786. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  4787. */
  4788. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  4789. /**
  4790. * Affect a material to the given mesh
  4791. * @param mesh defines the mesh which will represent the control
  4792. */
  4793. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4794. /** @hidden */
  4795. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  4796. /** @hidden */
  4797. _onPointerEnter(target: Control3D): boolean;
  4798. /** @hidden */
  4799. _onPointerOut(target: Control3D): void;
  4800. /** @hidden */
  4801. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  4802. /** @hidden */
  4803. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4804. /** @hidden */
  4805. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  4806. /** @hidden */
  4807. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  4808. /** @hidden */
  4809. _disposeNode(): void;
  4810. /**
  4811. * Releases all associated resources
  4812. */
  4813. dispose(): void;
  4814. }
  4815. }
  4816. declare module BABYLON.GUI {
  4817. /**
  4818. * Class used to create a container panel deployed on the surface of a cylinder
  4819. */
  4820. export class CylinderPanel extends VolumeBasedPanel {
  4821. /**
  4822. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  4823. */
  4824. radius: BABYLON.float;
  4825. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4826. }
  4827. }
  4828. declare module BABYLON.GUI {
  4829. /**
  4830. * Class used to create a holographic button in 3D
  4831. */
  4832. export class HolographicButton extends Button3D {
  4833. /**
  4834. * Gets or sets text for the button
  4835. */
  4836. text: string;
  4837. /**
  4838. * Gets or sets the image url for the button
  4839. */
  4840. imageUrl: string;
  4841. /**
  4842. * Gets the back material used by this button
  4843. */
  4844. readonly backMaterial: FluentMaterial;
  4845. /**
  4846. * Gets the front material used by this button
  4847. */
  4848. readonly frontMaterial: FluentMaterial;
  4849. /**
  4850. * Gets the plate material used by this button
  4851. */
  4852. readonly plateMaterial: BABYLON.StandardMaterial;
  4853. /**
  4854. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4855. */
  4856. readonly shareMaterials: boolean;
  4857. /**
  4858. * Creates a new button
  4859. * @param name defines the control name
  4860. */
  4861. constructor(name?: string, shareMaterials?: boolean);
  4862. protected _getTypeName(): string;
  4863. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4864. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4865. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  4866. /**
  4867. * Releases all associated resources
  4868. */
  4869. dispose(): void;
  4870. }
  4871. }
  4872. declare module BABYLON.GUI {
  4873. /**
  4874. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  4875. */
  4876. export class MeshButton3D extends Button3D {
  4877. /** @hidden */
  4878. protected _currentMesh: BABYLON.Mesh;
  4879. /**
  4880. * Creates a new 3D button based on a mesh
  4881. * @param mesh mesh to become a 3D button
  4882. * @param name defines the control name
  4883. */
  4884. constructor(mesh: BABYLON.Mesh, name?: string);
  4885. protected _getTypeName(): string;
  4886. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4887. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4888. }
  4889. }
  4890. declare module BABYLON.GUI {
  4891. /**
  4892. * Class used to create a container panel deployed on the surface of a plane
  4893. */
  4894. export class PlanePanel extends VolumeBasedPanel {
  4895. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4896. }
  4897. }
  4898. declare module BABYLON.GUI {
  4899. /**
  4900. * Class used to create a container panel where items get randomized planar mapping
  4901. */
  4902. export class ScatterPanel extends VolumeBasedPanel {
  4903. /**
  4904. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  4905. */
  4906. iteration: BABYLON.float;
  4907. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4908. protected _finalProcessing(): void;
  4909. }
  4910. }
  4911. declare module BABYLON.GUI {
  4912. /**
  4913. * Class used to create a container panel deployed on the surface of a sphere
  4914. */
  4915. export class SpherePanel extends VolumeBasedPanel {
  4916. /**
  4917. * Gets or sets the radius of the sphere where to project controls (5 by default)
  4918. */
  4919. radius: BABYLON.float;
  4920. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4921. }
  4922. }
  4923. declare module BABYLON.GUI {
  4924. /**
  4925. * Class used to create a stack panel in 3D on XY plane
  4926. */
  4927. export class StackPanel3D extends Container3D {
  4928. /**
  4929. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  4930. */
  4931. isVertical: boolean;
  4932. /**
  4933. * Gets or sets the distance between elements
  4934. */
  4935. margin: number;
  4936. /**
  4937. * Creates new StackPanel
  4938. * @param isVertical
  4939. */
  4940. constructor(isVertical?: boolean);
  4941. protected _arrangeChildren(): void;
  4942. }
  4943. }
  4944. declare module BABYLON.GUI {
  4945. /**
  4946. * Abstract class used to create a container panel deployed on the surface of a volume
  4947. */
  4948. export abstract class VolumeBasedPanel extends Container3D {
  4949. protected _cellWidth: number;
  4950. protected _cellHeight: number;
  4951. /**
  4952. * Gets or sets the distance between elements
  4953. */
  4954. margin: number;
  4955. /**
  4956. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  4957. * | Value | Type | Description |
  4958. * | ----- | ----------------------------------- | ----------- |
  4959. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  4960. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  4961. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  4962. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  4963. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  4964. */
  4965. orientation: number;
  4966. /**
  4967. * Gets or sets the number of columns requested (10 by default).
  4968. * The panel will automatically compute the number of rows based on number of child controls.
  4969. */
  4970. columns: BABYLON.int;
  4971. /**
  4972. * Gets or sets a the number of rows requested.
  4973. * The panel will automatically compute the number of columns based on number of child controls.
  4974. */
  4975. rows: BABYLON.int;
  4976. /**
  4977. * Creates new VolumeBasedPanel
  4978. */
  4979. constructor();
  4980. protected _arrangeChildren(): void;
  4981. /** Child classes must implement this function to provide correct control positioning */
  4982. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4983. /** Child classes can implement this function to provide additional processing */
  4984. protected _finalProcessing(): void;
  4985. }
  4986. }
  4987. declare module BABYLON.GUI {
  4988. /** @hidden */
  4989. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  4990. INNERGLOW: boolean;
  4991. BORDER: boolean;
  4992. HOVERLIGHT: boolean;
  4993. constructor();
  4994. }
  4995. /**
  4996. * Class used to render controls with fluent desgin
  4997. */
  4998. export class FluentMaterial extends BABYLON.PushMaterial {
  4999. /**
  5000. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  5001. */
  5002. innerGlowColorIntensity: number;
  5003. /**
  5004. * Gets or sets the inner glow color (white by default)
  5005. */
  5006. innerGlowColor: BABYLON.Color3;
  5007. /**
  5008. * Gets or sets alpha value (default is 1.0)
  5009. */
  5010. alpha: number;
  5011. /**
  5012. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  5013. */
  5014. albedoColor: BABYLON.Color3;
  5015. /**
  5016. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  5017. */
  5018. renderBorders: boolean;
  5019. /**
  5020. * Gets or sets border width (default is 0.5)
  5021. */
  5022. borderWidth: number;
  5023. /**
  5024. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  5025. */
  5026. edgeSmoothingValue: number;
  5027. /**
  5028. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  5029. */
  5030. borderMinValue: number;
  5031. /**
  5032. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  5033. */
  5034. renderHoverLight: boolean;
  5035. /**
  5036. * Gets or sets the radius used to render the hover light (default is 1.0)
  5037. */
  5038. hoverRadius: number;
  5039. /**
  5040. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  5041. */
  5042. hoverColor: BABYLON.Color4;
  5043. /**
  5044. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  5045. */
  5046. hoverPosition: BABYLON.Vector3;
  5047. /**
  5048. * Creates a new Fluent material
  5049. * @param name defines the name of the material
  5050. * @param scene defines the hosting scene
  5051. */
  5052. constructor(name: string, scene: BABYLON.Scene);
  5053. needAlphaBlending(): boolean;
  5054. needAlphaTesting(): boolean;
  5055. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  5056. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  5057. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  5058. getActiveTextures(): BABYLON.BaseTexture[];
  5059. hasTexture(texture: BABYLON.BaseTexture): boolean;
  5060. dispose(forceDisposeEffect?: boolean): void;
  5061. clone(name: string): FluentMaterial;
  5062. serialize(): any;
  5063. getClassName(): string;
  5064. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  5065. }
  5066. }
  5067. declare module BABYLON.GUI {
  5068. /** Class used to store data to display */
  5069. export class DataSeries {
  5070. /** Gets or sets the label of the series */
  5071. label: string;
  5072. /** Gets or sets the color associated with the series */
  5073. color: BABYLON.Color3;
  5074. /** Gets or sets the list of dimensions (used to filter data) */
  5075. dimensions: Array<string>;
  5076. /** Gets or sets the list of values (data to display) */
  5077. data: Array<any>;
  5078. /**
  5079. * Apply a list of filters to the data and return a list
  5080. * @param filters defines the filters to apply
  5081. * @returns an array containing the filtered data
  5082. */
  5083. getFilteredData(filters: {
  5084. [key: string]: string;
  5085. }): Array<any>;
  5086. /**
  5087. * Get the different values of a dimension
  5088. * @param key defines the dimension name
  5089. * @returns An array of values
  5090. */
  5091. getDimensionValues(key: string): Array<any>;
  5092. /**
  5093. * Create a new DataSeries containing testing values
  5094. * @returns the new DataSeries
  5095. */
  5096. static CreateFakeData(): DataSeries;
  5097. }
  5098. }
  5099. declare module BABYLON.GUI {
  5100. /** base class for all chart controls*/
  5101. export abstract class Chart {
  5102. protected _dataSource: BABYLON.Nullable<DataSeries>;
  5103. protected _rootNode: BABYLON.TransformNode;
  5104. protected _dataFilters: {
  5105. [key: string]: string;
  5106. };
  5107. protected _scene: BABYLON.Scene;
  5108. protected _blockRefresh: boolean;
  5109. /** BABYLON.Observable raised when a new element is created */
  5110. onElementCreated: BABYLON.Observable<BABYLON.Mesh>;
  5111. /** User defined callback used to create labels */
  5112. labelCreationFunction: (label: string, width: number, includeBackground: boolean) => BABYLON.Mesh;
  5113. /**
  5114. * BABYLON.Observable raised when the point picked by the pointer events changed
  5115. */
  5116. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  5117. /**
  5118. * BABYLON.Observable raised when the pointer enters an element of the chart
  5119. */
  5120. onElementEnterObservable: BABYLON.Observable<BABYLON.AbstractMesh>;
  5121. /**
  5122. * BABYLON.Observable raised when the pointer leaves an element of the chart
  5123. */
  5124. onElementOutObservable: BABYLON.Observable<BABYLON.AbstractMesh>;
  5125. /** Gets or sets the rotation of the entire chart */
  5126. rotation: BABYLON.Vector3;
  5127. /** Gets or sets the position of the entire chart */
  5128. position: BABYLON.Vector3;
  5129. /** Gets or sets the scaling of the entire chart */
  5130. scaling: BABYLON.Vector3;
  5131. /** Gets or sets the data source used by the graph */
  5132. dataSource: BABYLON.Nullable<DataSeries>;
  5133. /** Gets the filters applied to data source */
  5134. dataFilters: {
  5135. [key: string]: string;
  5136. };
  5137. /** Gets the root node associated with this graph */
  5138. readonly rootNode: BABYLON.TransformNode;
  5139. /** Gets or sets a value indicating if refresh function should be executed (useful when multiple changes will happen and you want to run refresh only at the end) */
  5140. blockRefresh: boolean;
  5141. /** Gets or sets the name of the graph */
  5142. name: string;
  5143. /**
  5144. * Creates a new Chart
  5145. * @param name defines the name of the graph
  5146. * @param scene defines the hosting scene
  5147. */
  5148. constructor(name: string, scene?: BABYLON.Nullable<BABYLON.Scene>);
  5149. /**
  5150. * Function called by the chart objects when they need a label. Could be user defined if you set this.labelCreationFunction to a custom callback
  5151. * @param label defines the text of the label
  5152. * @param width defines the expected width (height is supposed to be 1)
  5153. * @param includeBackground defines if a background rectangle must be added (default is true)
  5154. * @returns a mesh used to host the label
  5155. */
  5156. addLabel(label: string, width: number, includeBackground?: boolean): BABYLON.Mesh;
  5157. /**
  5158. * Remove specific label mesh
  5159. * @param label defines the label mesh to remove
  5160. */
  5161. removeLabel(label: BABYLON.Mesh): void;
  5162. /** Remove all created labels */
  5163. removeLabels(): void;
  5164. /**
  5165. * Force the chart to redraw itself
  5166. * @returns the current chart
  5167. */
  5168. abstract refresh(): Chart;
  5169. /** Release all associated resources */
  5170. dispose(): void;
  5171. protected _clean(): void;
  5172. }
  5173. }
  5174. declare module BABYLON.GUI {
  5175. /** Class used to render bar graphs */
  5176. export class BarGraph extends Chart {
  5177. protected _ownDefaultMaterial: boolean;
  5178. /** Gets or sets a boolean indicating if the background must be displayed */
  5179. displayBackground: boolean;
  5180. /** Gets or sets a boolean indicating if labels must be displayed */
  5181. displayLabels: boolean;
  5182. /** Gets or sets the margin between bars */
  5183. margin: number;
  5184. /** Gets or sets the with of each bar */
  5185. barWidth: number;
  5186. /** Gets or sets the maximum height of a bar */
  5187. maxBarHeight: number;
  5188. /** Gets or sets the dimension used for the labels */
  5189. labelDimension: string;
  5190. /** Gets or sets the material used by bar meshes */
  5191. defaultMaterial: BABYLON.Nullable<BABYLON.Material>;
  5192. /**
  5193. * Creates a new BarGraph
  5194. * @param name defines the name of the graph
  5195. * @param scene defines the hosting scene
  5196. */
  5197. constructor(name: string, scene?: BABYLON.Nullable<BABYLON.Scene>);
  5198. protected _createDefaultMaterial(scene: BABYLON.Scene): BABYLON.Material;
  5199. /**
  5200. * Children class can override this function to provide a new mesh (as long as it stays inside a 1x1x1 box)
  5201. * @param name defines the mesh name
  5202. * @param scene defines the hosting scene
  5203. * @returns a new mesh used to represent the current bar
  5204. */
  5205. protected _createBarMesh(name: string, scene: BABYLON.Scene): BABYLON.Mesh;
  5206. /**
  5207. * Force the graph to redraw itself
  5208. * @returns the current BarGraph
  5209. */
  5210. refresh(): BarGraph;
  5211. /** Clean associated resources */
  5212. dispose(): void;
  5213. protected _clean(): void;
  5214. }
  5215. }