babylon.gui.module.d.ts 239 KB

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