babylon.gui.module.d.ts 238 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334
  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 new element is created */
  2596. onElementCreatedObservable: Observable<Mesh>;
  2597. /**
  2598. * Observable raised when the point picked by the pointer events changed
  2599. */
  2600. onPickedPointChangedObservable: Observable<Nullable<Vector3>>;
  2601. /**
  2602. * Observable raised when the pointer enters an element of the chart
  2603. */
  2604. onElementEnterObservable: Observable<AbstractMesh>;
  2605. /**
  2606. * Observable raised when the pointer leaves an element of the chart
  2607. */
  2608. onElementOutObservable: Observable<AbstractMesh>;
  2609. /** User defined callback used to create labels */
  2610. labelCreationFunction: Nullable<(label: string, width: number, includeBackground: boolean) => Mesh>;
  2611. /** Gets or sets the rotation of the entire chart */
  2612. rotation: Vector3;
  2613. /** Gets or sets the position of the entire chart */
  2614. position: Vector3;
  2615. /** Gets or sets the scaling of the entire chart */
  2616. scaling: Vector3;
  2617. /** Gets or sets the data source used by the graph */
  2618. dataSource: Nullable<DataSeries>;
  2619. /** Gets or sets the filters applied to data source */
  2620. dataFilters: {
  2621. [key: string]: string;
  2622. };
  2623. /** Gets the root node associated with this graph */
  2624. readonly rootNode: TransformNode;
  2625. /** 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) */
  2626. blockRefresh: boolean;
  2627. /** Gets or sets the name of the graph */
  2628. name: string;
  2629. /**
  2630. * Creates a new Chart
  2631. * @param name defines the name of the graph
  2632. * @param scene defines the hosting scene
  2633. */
  2634. constructor(name: string, scene?: Nullable<Scene>);
  2635. /**
  2636. * Function called by the chart objects when they need a label. Could be user defined if you set this.labelCreationFunction to a custom callback
  2637. * @param label defines the text of the label
  2638. * @param width defines the expected width (height is supposed to be 1)
  2639. * @param includeBackground defines if a background rectangle must be added (default is true)
  2640. * @returns a mesh used to host the label
  2641. */
  2642. protected _addLabel(label: string, width: number, includeBackground?: boolean): Mesh;
  2643. /**
  2644. * Remove specific label mesh
  2645. * @param label defines the label mesh to remove
  2646. */
  2647. protected _removeLabel(label: Mesh): void;
  2648. /** Remove all created labels */
  2649. protected _removeLabels(): void;
  2650. /**
  2651. * Force the chart to redraw itself
  2652. * @returns the current chart
  2653. */
  2654. abstract refresh(): Chart;
  2655. /** Release all associated resources */
  2656. dispose(): void;
  2657. protected _clean(): void;
  2658. }
  2659. }
  2660. declare module 'babylonjs-gui/3D/charting/barGraph' {
  2661. import { Nullable, Scene, Mesh, Material } from "babylonjs";
  2662. import { Chart } from "babylonjs-gui/3D/charting";
  2663. /**
  2664. * Class used to render bar graphs
  2665. * @see http://doc.babylonjs.com/how_to/chart3d#bargraph
  2666. */
  2667. export class BarGraph extends Chart {
  2668. protected _ownDefaultMaterial: boolean;
  2669. /** Gets or sets a boolean indicating if the background must be displayed */
  2670. displayBackground: boolean;
  2671. /** Gets or sets a boolean indicating if labels must be displayed */
  2672. displayLabels: boolean;
  2673. /** Gets or sets the margin between bars */
  2674. margin: number;
  2675. /** Gets or sets the width of each bar */
  2676. barWidth: number;
  2677. /** Gets or sets the maximum height of a bar */
  2678. maxBarHeight: number;
  2679. /** Gets or sets the dimension used for the labels */
  2680. labelDimension: string;
  2681. /** Gets or sets the material used by bar meshes */
  2682. defaultMaterial: Nullable<Material>;
  2683. /**
  2684. * Creates a new BarGraph
  2685. * @param name defines the name of the graph
  2686. * @param scene defines the hosting scene
  2687. */
  2688. constructor(name: string, scene?: Nullable<Scene>);
  2689. protected _createDefaultMaterial(scene: Scene): Material;
  2690. /**
  2691. * Children class can override this function to provide a new mesh (as long as it stays inside a 1x1x1 box)
  2692. * @param name defines the mesh name
  2693. * @param scene defines the hosting scene
  2694. * @returns a new mesh used to represent the current bar
  2695. */
  2696. protected _createBarMesh(name: string, scene: Scene): Mesh;
  2697. /**
  2698. * Force the graph to redraw itself
  2699. * @returns the current BarGraph
  2700. */
  2701. refresh(): BarGraph;
  2702. /** Clean associated resources */
  2703. dispose(): void;
  2704. protected _clean(): void;
  2705. }
  2706. }
  2707. declare module 'babylonjs-gui/3D/charting/mapGraph' {
  2708. import { Chart } from "babylonjs-gui/3D/charting";
  2709. import { Scene, Nullable, Mesh } from "babylonjs";
  2710. /**
  2711. * Class used to render bar graphs
  2712. * @see http://doc.babylonjs.com/how_to/chart3d#mapgraph
  2713. */
  2714. export class MapGraph extends Chart {
  2715. /**
  2716. * Creates a new MapGraph
  2717. * @param name defines the name of the graph
  2718. * @param scene defines the hosting scene
  2719. */
  2720. constructor(name: string, mapUrl: string, scene?: Nullable<Scene>);
  2721. protected _createBarMesh(name: string, scene: Scene): Mesh;
  2722. refresh(): MapGraph;
  2723. protected _clean(): void;
  2724. }
  2725. }
  2726. /*BabylonJS GUI*/
  2727. // Dependencies for this module:
  2728. // ../../../../Tools/Gulp/babylonjs
  2729. declare module BABYLON.GUI {
  2730. }
  2731. declare module BABYLON.GUI {
  2732. }
  2733. declare module BABYLON.GUI {
  2734. }
  2735. declare module BABYLON.GUI {
  2736. }
  2737. declare module BABYLON.GUI {
  2738. /**
  2739. * Interface used to define a control that can receive focus
  2740. */
  2741. export interface IFocusableControl {
  2742. /**
  2743. * Function called when the control receives the focus
  2744. */
  2745. onFocus(): void;
  2746. /**
  2747. * Function called when the control loses the focus
  2748. */
  2749. onBlur(): void;
  2750. /**
  2751. * Function called to let the control handle keyboard events
  2752. * @param evt defines the current keyboard event
  2753. */
  2754. processKeyboard(evt: KeyboardEvent): void;
  2755. }
  2756. /**
  2757. * Class used to create texture to support 2D GUI elements
  2758. * @see http://doc.babylonjs.com/how_to/gui
  2759. */
  2760. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  2761. /** @hidden */
  2762. _rootContainer: Container;
  2763. /** @hidden */
  2764. _lastPickedControl: Control;
  2765. /** @hidden */
  2766. _lastControlOver: {
  2767. [pointerId: number]: Control;
  2768. };
  2769. /** @hidden */
  2770. _lastControlDown: {
  2771. [pointerId: number]: Control;
  2772. };
  2773. /** @hidden */
  2774. _capturingControl: {
  2775. [pointerId: number]: Control;
  2776. };
  2777. /** @hidden */
  2778. _shouldBlockPointer: boolean;
  2779. /** @hidden */
  2780. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  2781. /** @hidden */
  2782. _linkedControls: Control[];
  2783. /**
  2784. * Gets or sets a boolean defining if alpha is stored as premultiplied
  2785. */
  2786. premulAlpha: boolean;
  2787. /**
  2788. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  2789. * Useful when you want more antialiasing
  2790. */
  2791. renderScale: number;
  2792. /** Gets or sets the background color */
  2793. background: string;
  2794. /**
  2795. * Gets or sets the ideal width used to design controls.
  2796. * The GUI will then rescale everything accordingly
  2797. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2798. */
  2799. idealWidth: number;
  2800. /**
  2801. * Gets or sets the ideal height used to design controls.
  2802. * The GUI will then rescale everything accordingly
  2803. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2804. */
  2805. idealHeight: number;
  2806. /**
  2807. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  2808. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2809. */
  2810. useSmallestIdeal: boolean;
  2811. /**
  2812. * Gets or sets a boolean indicating if adaptive scaling must be used
  2813. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2814. */
  2815. renderAtIdealSize: boolean;
  2816. /**
  2817. * Gets the underlying layer used to render the texture when in fullscreen mode
  2818. */
  2819. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  2820. /**
  2821. * Gets the root container control
  2822. */
  2823. readonly rootContainer: Container;
  2824. /**
  2825. * Gets or sets the current focused control
  2826. */
  2827. focusedControl: BABYLON.Nullable<IFocusableControl>;
  2828. /**
  2829. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  2830. */
  2831. isForeground: boolean;
  2832. /**
  2833. * Creates a new AdvancedDynamicTexture
  2834. * @param name defines the name of the texture
  2835. * @param width defines the width of the texture
  2836. * @param height defines the height of the texture
  2837. * @param scene defines the hosting scene
  2838. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  2839. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  2840. */
  2841. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  2842. /**
  2843. * Function used to execute a function on all controls
  2844. * @param func defines the function to execute
  2845. * @param container defines the container where controls belong. If null the root container will be used
  2846. */
  2847. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  2848. /**
  2849. * Marks the texture as dirty forcing a complete update
  2850. */
  2851. markAsDirty(): void;
  2852. /**
  2853. * Helper function used to create a new style
  2854. * @returns a new style
  2855. * @see http://doc.babylonjs.com/how_to/gui#styles
  2856. */
  2857. createStyle(): Style;
  2858. /**
  2859. * Adds a new control to the root container
  2860. * @param control defines the control to add
  2861. * @returns the current texture
  2862. */
  2863. addControl(control: Control): AdvancedDynamicTexture;
  2864. /**
  2865. * Removes a control from the root container
  2866. * @param control defines the control to remove
  2867. * @returns the current texture
  2868. */
  2869. removeControl(control: Control): AdvancedDynamicTexture;
  2870. /**
  2871. * Release all resources
  2872. */
  2873. dispose(): void;
  2874. /** @hidden */
  2875. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  2876. /**
  2877. * Get screen coordinates for a vector3
  2878. * @param position defines the position to project
  2879. * @param worldMatrix defines the world matrix to use
  2880. * @returns the projected position
  2881. */
  2882. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  2883. /** @hidden */
  2884. _cleanControlAfterRemovalFromList(list: {
  2885. [pointerId: number]: Control;
  2886. }, control: Control): void;
  2887. /** @hidden */
  2888. _cleanControlAfterRemoval(control: Control): void;
  2889. /** Attach to all scene events required to support pointer events */
  2890. attach(): void;
  2891. /**
  2892. * Connect the texture to a hosting mesh to enable interactions
  2893. * @param mesh defines the mesh to attach to
  2894. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  2895. */
  2896. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  2897. /**
  2898. * Move the focus to a specific control
  2899. * @param control defines the control which will receive the focus
  2900. */
  2901. moveFocusToControl(control: IFocusableControl): void;
  2902. /**
  2903. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  2904. * @param mesh defines the mesh which will receive the texture
  2905. * @param width defines the texture width (1024 by default)
  2906. * @param height defines the texture height (1024 by default)
  2907. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  2908. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  2909. * @returns a new AdvancedDynamicTexture
  2910. */
  2911. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  2912. /**
  2913. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  2914. * In this mode the texture will rely on a layer for its rendering.
  2915. * This allows it to be treated like any other layer.
  2916. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  2917. * LayerMask is set through advancedTexture.layer.layerMask
  2918. * @param name defines name for the texture
  2919. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  2920. * @param scene defines the hsoting scene
  2921. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  2922. * @returns a new AdvancedDynamicTexture
  2923. */
  2924. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  2925. }
  2926. }
  2927. declare module BABYLON.GUI {
  2928. /**
  2929. * Class used to transport BABYLON.Vector2 information for pointer events
  2930. */
  2931. export class Vector2WithInfo extends BABYLON.Vector2 {
  2932. /** defines the current mouse button index */
  2933. buttonIndex: number;
  2934. /**
  2935. * Creates a new Vector2WithInfo
  2936. * @param source defines the vector2 data to transport
  2937. * @param buttonIndex defines the current mouse button index
  2938. */
  2939. constructor(source: BABYLON.Vector2,
  2940. /** defines the current mouse button index */
  2941. buttonIndex?: number);
  2942. }
  2943. /** Class used to provide 2D matrix features */
  2944. export class Matrix2D {
  2945. /** Gets the internal array of 6 floats used to store matrix data */
  2946. m: Float32Array;
  2947. /**
  2948. * Creates a new matrix
  2949. * @param m00 defines value for (0, 0)
  2950. * @param m01 defines value for (0, 1)
  2951. * @param m10 defines value for (1, 0)
  2952. * @param m11 defines value for (1, 1)
  2953. * @param m20 defines value for (2, 0)
  2954. * @param m21 defines value for (2, 1)
  2955. */
  2956. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  2957. /**
  2958. * Fills the matrix from direct values
  2959. * @param m00 defines value for (0, 0)
  2960. * @param m01 defines value for (0, 1)
  2961. * @param m10 defines value for (1, 0)
  2962. * @param m11 defines value for (1, 1)
  2963. * @param m20 defines value for (2, 0)
  2964. * @param m21 defines value for (2, 1)
  2965. * @returns the current modified matrix
  2966. */
  2967. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  2968. /**
  2969. * Gets matrix determinant
  2970. * @returns the determinant
  2971. */
  2972. determinant(): number;
  2973. /**
  2974. * Inverses the matrix and stores it in a target matrix
  2975. * @param result defines the target matrix
  2976. * @returns the current matrix
  2977. */
  2978. invertToRef(result: Matrix2D): Matrix2D;
  2979. /**
  2980. * Multiplies the current matrix with another one
  2981. * @param other defines the second operand
  2982. * @param result defines the target matrix
  2983. * @returns the current matrix
  2984. */
  2985. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  2986. /**
  2987. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  2988. * @param x defines the x coordinate to transform
  2989. * @param y defines the x coordinate to transform
  2990. * @param result defines the target vector2
  2991. * @returns the current matrix
  2992. */
  2993. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  2994. /**
  2995. * Creates an identity matrix
  2996. * @returns a new matrix
  2997. */
  2998. static Identity(): Matrix2D;
  2999. /**
  3000. * Creates a translation matrix and stores it in a target matrix
  3001. * @param x defines the x coordinate of the translation
  3002. * @param y defines the y coordinate of the translation
  3003. * @param result defines the target matrix
  3004. */
  3005. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  3006. /**
  3007. * Creates a scaling matrix and stores it in a target matrix
  3008. * @param x defines the x coordinate of the scaling
  3009. * @param y defines the y coordinate of the scaling
  3010. * @param result defines the target matrix
  3011. */
  3012. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  3013. /**
  3014. * Creates a rotation matrix and stores it in a target matrix
  3015. * @param angle defines the rotation angle
  3016. * @param result defines the target matrix
  3017. */
  3018. static RotationToRef(angle: number, result: Matrix2D): void;
  3019. /**
  3020. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  3021. * @param tx defines the x coordinate of the translation
  3022. * @param ty defines the y coordinate of the translation
  3023. * @param angle defines the rotation angle
  3024. * @param scaleX defines the x coordinate of the scaling
  3025. * @param scaleY defines the y coordinate of the scaling
  3026. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  3027. * @param result defines the target matrix
  3028. */
  3029. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  3030. }
  3031. }
  3032. declare module BABYLON.GUI {
  3033. /**
  3034. * Class used to store 2D control sizes
  3035. */
  3036. export class Measure {
  3037. /** defines left coordinate */
  3038. left: number;
  3039. /** defines top coordinate */
  3040. top: number;
  3041. /** defines width dimension */
  3042. width: number;
  3043. /** defines height dimension */
  3044. height: number;
  3045. /**
  3046. * Creates a new measure
  3047. * @param left defines left coordinate
  3048. * @param top defines top coordinate
  3049. * @param width defines width dimension
  3050. * @param height defines height dimension
  3051. */
  3052. constructor(
  3053. /** defines left coordinate */
  3054. left: number,
  3055. /** defines top coordinate */
  3056. top: number,
  3057. /** defines width dimension */
  3058. width: number,
  3059. /** defines height dimension */
  3060. height: number);
  3061. /**
  3062. * Copy from another measure
  3063. * @param other defines the other measure to copy from
  3064. */
  3065. copyFrom(other: Measure): void;
  3066. /**
  3067. * Check equality between this measure and another one
  3068. * @param other defines the other measures
  3069. * @returns true if both measures are equals
  3070. */
  3071. isEqualsTo(other: Measure): boolean;
  3072. /**
  3073. * Creates an empty measure
  3074. * @returns a new measure
  3075. */
  3076. static Empty(): Measure;
  3077. }
  3078. }
  3079. declare module BABYLON.GUI {
  3080. /**
  3081. * Class used to store a point for a MultiLine object.
  3082. * The point can be pure 2D coordinates, a mesh or a control
  3083. */
  3084. export class MultiLinePoint {
  3085. /** @hidden */
  3086. _point: BABYLON.Vector2;
  3087. /**
  3088. * Creates a new MultiLinePoint
  3089. * @param multiLine defines the source MultiLine object
  3090. */
  3091. constructor(multiLine: MultiLine);
  3092. /** Gets or sets x coordinate */
  3093. x: string | number;
  3094. /** Gets or sets y coordinate */
  3095. y: string | number;
  3096. /** Gets or sets the control associated with this point */
  3097. control: BABYLON.Nullable<Control>;
  3098. /** Gets or sets the mesh associated with this point */
  3099. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3100. /**
  3101. * Gets a translation vector
  3102. * @returns the translation vector
  3103. */
  3104. translate(): BABYLON.Vector2;
  3105. /** Release associated resources */
  3106. dispose(): void;
  3107. }
  3108. }
  3109. declare module BABYLON.GUI {
  3110. /**
  3111. * Define a style used by control to automatically setup properties based on a template.
  3112. * Only support font related properties so far
  3113. */
  3114. export class Style implements BABYLON.IDisposable {
  3115. /** @hidden */
  3116. _host: AdvancedDynamicTexture;
  3117. /** @hidden */
  3118. _fontSize: ValueAndUnit;
  3119. /**
  3120. * BABYLON.Observable raised when the style values are changed
  3121. */
  3122. onChangedObservable: BABYLON.Observable<Style>;
  3123. /**
  3124. * Creates a new style object
  3125. * @param host defines the AdvancedDynamicTexture which hosts this style
  3126. */
  3127. constructor(host: AdvancedDynamicTexture);
  3128. /**
  3129. * Gets or sets the font size
  3130. */
  3131. fontSize: string | number;
  3132. /**
  3133. * Gets or sets the font family
  3134. */
  3135. fontFamily: string;
  3136. /**
  3137. * Gets or sets the font style
  3138. */
  3139. fontStyle: string;
  3140. /** Gets or sets font weight */
  3141. fontWeight: string;
  3142. /** Dispose all associated resources */
  3143. dispose(): void;
  3144. }
  3145. }
  3146. declare module BABYLON.GUI {
  3147. /**
  3148. * Class used to specific a value and its associated unit
  3149. */
  3150. export class ValueAndUnit {
  3151. /** defines the unit to store */
  3152. unit: number;
  3153. /** defines a boolean indicating if the value can be negative */
  3154. negativeValueAllowed: boolean;
  3155. /**
  3156. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  3157. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3158. */
  3159. ignoreAdaptiveScaling: boolean;
  3160. /**
  3161. * Creates a new ValueAndUnit
  3162. * @param value defines the value to store
  3163. * @param unit defines the unit to store
  3164. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  3165. */
  3166. constructor(value: number,
  3167. /** defines the unit to store */
  3168. unit?: number,
  3169. /** defines a boolean indicating if the value can be negative */
  3170. negativeValueAllowed?: boolean);
  3171. /** Gets a boolean indicating if the value is a percentage */
  3172. readonly isPercentage: boolean;
  3173. /** Gets a boolean indicating if the value is store as pixel */
  3174. readonly isPixel: boolean;
  3175. /** Gets direct internal value */
  3176. readonly internalValue: number;
  3177. /**
  3178. * Gets value as pixel
  3179. * @param host defines the root host
  3180. * @param refValue defines the reference value for percentages
  3181. * @returns the value as pixel
  3182. */
  3183. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  3184. /**
  3185. * Gets the value accordingly to its unit
  3186. * @param host defines the root host
  3187. * @returns the value
  3188. */
  3189. getValue(host: AdvancedDynamicTexture): number;
  3190. /**
  3191. * Gets a string representation of the value
  3192. * @param host defines the root host
  3193. * @returns a string
  3194. */
  3195. toString(host: AdvancedDynamicTexture): string;
  3196. /**
  3197. * Store a value parsed from a string
  3198. * @param source defines the source string
  3199. * @returns true if the value was successfully parsed
  3200. */
  3201. fromString(source: string | number): boolean;
  3202. /** UNITMODE_PERCENTAGE */
  3203. static readonly UNITMODE_PERCENTAGE: number;
  3204. /** UNITMODE_PIXEL */
  3205. static readonly UNITMODE_PIXEL: number;
  3206. }
  3207. }
  3208. declare module BABYLON.GUI {
  3209. }
  3210. declare module BABYLON.GUI {
  3211. }
  3212. declare module BABYLON.GUI {
  3213. }
  3214. declare module BABYLON.GUI {
  3215. /**
  3216. * Class used to manage 3D user interface
  3217. * @see http://doc.babylonjs.com/how_to/gui3d
  3218. */
  3219. export class GUI3DManager implements BABYLON.IDisposable {
  3220. /** @hidden */
  3221. _lastPickedControl: Control3D;
  3222. /** @hidden */
  3223. _lastControlOver: {
  3224. [pointerId: number]: Control3D;
  3225. };
  3226. /** @hidden */
  3227. _lastControlDown: {
  3228. [pointerId: number]: Control3D;
  3229. };
  3230. /**
  3231. * BABYLON.Observable raised when the point picked by the pointer events changed
  3232. */
  3233. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3234. /** @hidden */
  3235. _sharedMaterials: {
  3236. [key: string]: BABYLON.Material;
  3237. };
  3238. /** Gets the hosting scene */
  3239. readonly scene: BABYLON.Scene;
  3240. /** Gets associated utility layer */
  3241. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3242. /**
  3243. * Creates a new GUI3DManager
  3244. * @param scene
  3245. */
  3246. constructor(scene?: BABYLON.Scene);
  3247. /**
  3248. * Gets the root container
  3249. */
  3250. readonly rootContainer: Container3D;
  3251. /**
  3252. * Gets a boolean indicating if the given control is in the root child list
  3253. * @param control defines the control to check
  3254. * @returns true if the control is in the root child list
  3255. */
  3256. containsControl(control: Control3D): boolean;
  3257. /**
  3258. * Adds a control to the root child list
  3259. * @param control defines the control to add
  3260. * @returns the current manager
  3261. */
  3262. addControl(control: Control3D): GUI3DManager;
  3263. /**
  3264. * Removes a control from the root child list
  3265. * @param control defines the control to remove
  3266. * @returns the current container
  3267. */
  3268. removeControl(control: Control3D): GUI3DManager;
  3269. /**
  3270. * Releases all associated resources
  3271. */
  3272. dispose(): void;
  3273. }
  3274. }
  3275. declare module BABYLON.GUI {
  3276. /**
  3277. * Class used to transport BABYLON.Vector3 information for pointer events
  3278. */
  3279. export class Vector3WithInfo extends BABYLON.Vector3 {
  3280. /** defines the current mouse button index */
  3281. buttonIndex: number;
  3282. /**
  3283. * Creates a new Vector3WithInfo
  3284. * @param source defines the vector3 data to transport
  3285. * @param buttonIndex defines the current mouse button index
  3286. */
  3287. constructor(source: BABYLON.Vector3,
  3288. /** defines the current mouse button index */
  3289. buttonIndex?: number);
  3290. }
  3291. }
  3292. declare module BABYLON.GUI {
  3293. /**
  3294. * Class used to create 2D buttons
  3295. */
  3296. export class Button extends Rectangle {
  3297. name?: string | undefined;
  3298. /**
  3299. * Function called to generate a pointer enter animation
  3300. */
  3301. pointerEnterAnimation: () => void;
  3302. /**
  3303. * Function called to generate a pointer out animation
  3304. */
  3305. pointerOutAnimation: () => void;
  3306. /**
  3307. * Function called to generate a pointer down animation
  3308. */
  3309. pointerDownAnimation: () => void;
  3310. /**
  3311. * Function called to generate a pointer up animation
  3312. */
  3313. pointerUpAnimation: () => void;
  3314. /**
  3315. * Creates a new Button
  3316. * @param name defines the name of the button
  3317. */
  3318. constructor(name?: string | undefined);
  3319. protected _getTypeName(): string;
  3320. /** @hidden */
  3321. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3322. /** @hidden */
  3323. _onPointerEnter(target: Control): boolean;
  3324. /** @hidden */
  3325. _onPointerOut(target: Control): void;
  3326. /** @hidden */
  3327. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3328. /** @hidden */
  3329. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3330. /**
  3331. * Creates a new button made with an image and a text
  3332. * @param name defines the name of the button
  3333. * @param text defines the text of the button
  3334. * @param imageUrl defines the url of the image
  3335. * @returns a new Button
  3336. */
  3337. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  3338. /**
  3339. * Creates a new button made with an image
  3340. * @param name defines the name of the button
  3341. * @param imageUrl defines the url of the image
  3342. * @returns a new Button
  3343. */
  3344. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  3345. /**
  3346. * Creates a new button made with a text
  3347. * @param name defines the name of the button
  3348. * @param text defines the text of the button
  3349. * @returns a new Button
  3350. */
  3351. static CreateSimpleButton(name: string, text: string): Button;
  3352. /**
  3353. * Creates a new button made with an image and a centered text
  3354. * @param name defines the name of the button
  3355. * @param text defines the text of the button
  3356. * @param imageUrl defines the url of the image
  3357. * @returns a new Button
  3358. */
  3359. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  3360. }
  3361. }
  3362. declare module BABYLON.GUI {
  3363. /**
  3364. * Class used to represent a 2D checkbox
  3365. */
  3366. export class Checkbox extends Control {
  3367. name?: string | undefined;
  3368. /** Gets or sets border thickness */
  3369. thickness: number;
  3370. /**
  3371. * BABYLON.Observable raised when isChecked property changes
  3372. */
  3373. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  3374. /** Gets or sets a value indicating the ratio between overall size and check size */
  3375. checkSizeRatio: number;
  3376. /** Gets or sets background color */
  3377. background: string;
  3378. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  3379. isChecked: boolean;
  3380. /**
  3381. * Creates a new CheckBox
  3382. * @param name defines the control name
  3383. */
  3384. constructor(name?: string | undefined);
  3385. protected _getTypeName(): string;
  3386. /** @hidden */
  3387. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3388. /** @hidden */
  3389. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3390. /**
  3391. * Utility function to easily create a checkbox with a header
  3392. * @param title defines the label to use for the header
  3393. * @param onValueChanged defines the callback to call when value changes
  3394. * @returns a StackPanel containing the checkbox and a textBlock
  3395. */
  3396. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  3397. }
  3398. }
  3399. declare module BABYLON.GUI {
  3400. /** Class used to create color pickers */
  3401. export class ColorPicker extends Control {
  3402. name?: string | undefined;
  3403. /**
  3404. * BABYLON.Observable raised when the value changes
  3405. */
  3406. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  3407. /** Gets or sets the color of the color picker */
  3408. value: BABYLON.Color3;
  3409. /** Gets or sets control width */
  3410. width: string | number;
  3411. /** Gets or sets control height */
  3412. height: string | number;
  3413. /** Gets or sets control size */
  3414. size: string | number;
  3415. /**
  3416. * Creates a new ColorPicker
  3417. * @param name defines the control name
  3418. */
  3419. constructor(name?: string | undefined);
  3420. protected _getTypeName(): string;
  3421. /** @hidden */
  3422. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3423. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3424. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3425. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3426. }
  3427. }
  3428. declare module BABYLON.GUI {
  3429. /**
  3430. * Root class for 2D containers
  3431. * @see http://doc.babylonjs.com/how_to/gui#containers
  3432. */
  3433. export class Container extends Control {
  3434. name?: string | undefined;
  3435. /** @hidden */
  3436. protected _children: Control[];
  3437. /** @hidden */
  3438. protected _measureForChildren: Measure;
  3439. /** @hidden */
  3440. protected _background: string;
  3441. /** @hidden */
  3442. protected _adaptWidthToChildren: boolean;
  3443. /** @hidden */
  3444. protected _adaptHeightToChildren: boolean;
  3445. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  3446. adaptHeightToChildren: boolean;
  3447. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  3448. adaptWidthToChildren: boolean;
  3449. /** Gets or sets background color */
  3450. background: string;
  3451. /** Gets the list of children */
  3452. readonly children: Control[];
  3453. /**
  3454. * Creates a new Container
  3455. * @param name defines the name of the container
  3456. */
  3457. constructor(name?: string | undefined);
  3458. protected _getTypeName(): string;
  3459. /**
  3460. * Gets a child using its name
  3461. * @param name defines the child name to look for
  3462. * @returns the child control if found
  3463. */
  3464. getChildByName(name: string): BABYLON.Nullable<Control>;
  3465. /**
  3466. * Gets a child using its type and its name
  3467. * @param name defines the child name to look for
  3468. * @param type defines the child type to look for
  3469. * @returns the child control if found
  3470. */
  3471. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  3472. /**
  3473. * Search for a specific control in children
  3474. * @param control defines the control to look for
  3475. * @returns true if the control is in child list
  3476. */
  3477. containsControl(control: Control): boolean;
  3478. /**
  3479. * Adds a new control to the current container
  3480. * @param control defines the control to add
  3481. * @returns the current container
  3482. */
  3483. addControl(control: BABYLON.Nullable<Control>): Container;
  3484. /**
  3485. * Removes all controls from the current container
  3486. * @returns the current container
  3487. */
  3488. clearControls(): Container;
  3489. /**
  3490. * Removes a control from the current container
  3491. * @param control defines the control to remove
  3492. * @returns the current container
  3493. */
  3494. removeControl(control: Control): Container;
  3495. /** @hidden */
  3496. _reOrderControl(control: Control): void;
  3497. /** @hidden */
  3498. _markMatrixAsDirty(): void;
  3499. /** @hidden */
  3500. _markAllAsDirty(): void;
  3501. /** @hidden */
  3502. protected _localDraw(context: CanvasRenderingContext2D): void;
  3503. /** @hidden */
  3504. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3505. /** @hidden */
  3506. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3507. /** @hidden */
  3508. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3509. /** @hidden */
  3510. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3511. /** @hidden */
  3512. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3513. /** Releases associated resources */
  3514. dispose(): void;
  3515. }
  3516. }
  3517. declare module BABYLON.GUI {
  3518. /**
  3519. * Root class used for all 2D controls
  3520. * @see http://doc.babylonjs.com/how_to/gui#controls
  3521. */
  3522. export class Control {
  3523. /** defines the name of the control */
  3524. name?: string | undefined;
  3525. /** @hidden */
  3526. _root: BABYLON.Nullable<Container>;
  3527. /** @hidden */
  3528. _host: AdvancedDynamicTexture;
  3529. /** Gets or sets the control parent */
  3530. parent: BABYLON.Nullable<Container>;
  3531. /** @hidden */
  3532. _currentMeasure: Measure;
  3533. /** @hidden */
  3534. _width: ValueAndUnit;
  3535. /** @hidden */
  3536. _height: ValueAndUnit;
  3537. /** @hidden */
  3538. protected _fontOffset: {
  3539. ascent: number;
  3540. height: number;
  3541. descent: number;
  3542. };
  3543. /** @hidden */
  3544. protected _horizontalAlignment: number;
  3545. /** @hidden */
  3546. protected _verticalAlignment: number;
  3547. /** @hidden */
  3548. _tempParentMeasure: Measure;
  3549. /** @hidden */
  3550. protected _cachedParentMeasure: Measure;
  3551. /** @hidden */
  3552. _left: ValueAndUnit;
  3553. /** @hidden */
  3554. _top: ValueAndUnit;
  3555. /** @hidden */
  3556. protected _invertTransformMatrix: Matrix2D;
  3557. /** @hidden */
  3558. protected _transformedPosition: BABYLON.Vector2;
  3559. /** @hidden */
  3560. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3561. /** @hidden */
  3562. _tag: any;
  3563. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  3564. isHitTestVisible: boolean;
  3565. /** Gets or sets a boolean indicating if the control can block pointer events */
  3566. isPointerBlocker: boolean;
  3567. /** Gets or sets a boolean indicating if the control can be focusable */
  3568. isFocusInvisible: boolean;
  3569. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  3570. shadowOffsetX: number;
  3571. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  3572. shadowOffsetY: number;
  3573. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  3574. shadowBlur: number;
  3575. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  3576. shadowColor: string;
  3577. /** @hidden */
  3578. protected _linkOffsetX: ValueAndUnit;
  3579. /** @hidden */
  3580. protected _linkOffsetY: ValueAndUnit;
  3581. /** Gets the control type name */
  3582. readonly typeName: string;
  3583. /**
  3584. * An event triggered when the pointer move over the control.
  3585. */
  3586. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  3587. /**
  3588. * An event triggered when the pointer move out of the control.
  3589. */
  3590. onPointerOutObservable: BABYLON.Observable<Control>;
  3591. /**
  3592. * An event triggered when the pointer taps the control
  3593. */
  3594. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  3595. /**
  3596. * An event triggered when pointer up
  3597. */
  3598. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  3599. /**
  3600. * An event triggered when a control is clicked on
  3601. */
  3602. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  3603. /**
  3604. * An event triggered when pointer enters the control
  3605. */
  3606. onPointerEnterObservable: BABYLON.Observable<Control>;
  3607. /**
  3608. * An event triggered when the control is marked as dirty
  3609. */
  3610. onDirtyObservable: BABYLON.Observable<Control>;
  3611. /**
  3612. * An event triggered after the control is drawn
  3613. */
  3614. onAfterDrawObservable: BABYLON.Observable<Control>;
  3615. /** Gets or set information about font offsets (used to render and align text) */
  3616. fontOffset: {
  3617. ascent: number;
  3618. height: number;
  3619. descent: number;
  3620. };
  3621. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  3622. alpha: number;
  3623. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  3624. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3625. */
  3626. scaleX: number;
  3627. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  3628. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3629. */
  3630. scaleY: number;
  3631. /** Gets or sets the rotation angle (0 by default)
  3632. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3633. */
  3634. rotation: number;
  3635. /** Gets or sets the transformation center on Y axis (0 by default)
  3636. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3637. */
  3638. transformCenterY: number;
  3639. /** Gets or sets the transformation center on X axis (0 by default)
  3640. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3641. */
  3642. transformCenterX: number;
  3643. /**
  3644. * Gets or sets the horizontal alignment
  3645. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3646. */
  3647. horizontalAlignment: number;
  3648. /**
  3649. * Gets or sets the vertical alignment
  3650. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3651. */
  3652. verticalAlignment: number;
  3653. /**
  3654. * Gets or sets control width
  3655. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3656. */
  3657. width: string | number;
  3658. /**
  3659. * Gets control width in pixel
  3660. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3661. */
  3662. readonly widthInPixels: number;
  3663. /**
  3664. * Gets or sets control height
  3665. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3666. */
  3667. height: string | number;
  3668. /**
  3669. * Gets control height in pixel
  3670. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3671. */
  3672. readonly heightInPixels: number;
  3673. /** Gets or set font family */
  3674. fontFamily: string;
  3675. /** Gets or sets font style */
  3676. fontStyle: string;
  3677. /** Gets or sets font weight */
  3678. fontWeight: string;
  3679. /**
  3680. * Gets or sets style
  3681. * @see http://doc.babylonjs.com/how_to/gui#styles
  3682. */
  3683. style: BABYLON.Nullable<Style>;
  3684. /** @hidden */
  3685. readonly _isFontSizeInPercentage: boolean;
  3686. /** Gets font size in pixels */
  3687. readonly fontSizeInPixels: number;
  3688. /** Gets or sets font size */
  3689. fontSize: string | number;
  3690. /** Gets or sets foreground color */
  3691. color: string;
  3692. /** Gets or sets z index which is used to reorder controls on the z axis */
  3693. zIndex: number;
  3694. /** Gets or sets a boolean indicating if the control can be rendered */
  3695. notRenderable: boolean;
  3696. /** Gets or sets a boolean indicating if the control is visible */
  3697. isVisible: boolean;
  3698. /** Gets a boolean indicating that the control needs to update its rendering */
  3699. readonly isDirty: boolean;
  3700. /**
  3701. * Gets or sets a value indicating the padding to use on the left of the control
  3702. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3703. */
  3704. paddingLeft: string | number;
  3705. /**
  3706. * Gets a value indicating the padding in pixels to use on the left of the control
  3707. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3708. */
  3709. readonly paddingLeftInPixels: number;
  3710. /**
  3711. * Gets or sets a value indicating the padding to use on the right of the control
  3712. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3713. */
  3714. paddingRight: string | number;
  3715. /**
  3716. * Gets a value indicating the padding in pixels to use on the right of the control
  3717. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3718. */
  3719. readonly paddingRightInPixels: number;
  3720. /**
  3721. * Gets or sets a value indicating the padding to use on the top of the control
  3722. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3723. */
  3724. paddingTop: string | number;
  3725. /**
  3726. * Gets a value indicating the padding in pixels to use on the top of the control
  3727. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3728. */
  3729. readonly paddingTopInPixels: number;
  3730. /**
  3731. * Gets or sets a value indicating the padding to use on the bottom of the control
  3732. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3733. */
  3734. paddingBottom: string | number;
  3735. /**
  3736. * Gets a value indicating the padding in pixels to use on the bottom of the control
  3737. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3738. */
  3739. readonly paddingBottomInPixels: number;
  3740. /**
  3741. * Gets or sets a value indicating the left coordinate of the control
  3742. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3743. */
  3744. left: string | number;
  3745. /**
  3746. * Gets a value indicating the left coordinate in pixels of the control
  3747. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3748. */
  3749. readonly leftInPixels: number;
  3750. /**
  3751. * Gets or sets a value indicating the top coordinate of the control
  3752. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3753. */
  3754. top: string | number;
  3755. /**
  3756. * Gets a value indicating the top coordinate in pixels of the control
  3757. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3758. */
  3759. readonly topInPixels: number;
  3760. /**
  3761. * Gets or sets a value indicating the offset on X axis to the linked mesh
  3762. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3763. */
  3764. linkOffsetX: string | number;
  3765. /**
  3766. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  3767. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3768. */
  3769. readonly linkOffsetXInPixels: number;
  3770. /**
  3771. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  3772. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3773. */
  3774. linkOffsetY: string | number;
  3775. /**
  3776. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  3777. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3778. */
  3779. readonly linkOffsetYInPixels: number;
  3780. /** Gets the center coordinate on X axis */
  3781. readonly centerX: number;
  3782. /** Gets the center coordinate on Y axis */
  3783. readonly centerY: number;
  3784. /**
  3785. * Creates a new control
  3786. * @param name defines the name of the control
  3787. */
  3788. constructor(
  3789. /** defines the name of the control */
  3790. name?: string | undefined);
  3791. /** @hidden */
  3792. protected _getTypeName(): string;
  3793. /** @hidden */
  3794. _resetFontCache(): void;
  3795. /**
  3796. * Gets coordinates in local control space
  3797. * @param globalCoordinates defines the coordinates to transform
  3798. * @returns the new coordinates in local space
  3799. */
  3800. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3801. /**
  3802. * Gets coordinates in local control space
  3803. * @param globalCoordinates defines the coordinates to transform
  3804. * @param result defines the target vector2 where to store the result
  3805. * @returns the current control
  3806. */
  3807. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  3808. /**
  3809. * Gets coordinates in parent local control space
  3810. * @param globalCoordinates defines the coordinates to transform
  3811. * @returns the new coordinates in parent local space
  3812. */
  3813. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3814. /**
  3815. * Move the current control to a vector3 position projected onto the screen.
  3816. * @param position defines the target position
  3817. * @param scene defines the hosting scene
  3818. */
  3819. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  3820. /**
  3821. * Link current control with a target mesh
  3822. * @param mesh defines the mesh to link with
  3823. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3824. */
  3825. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  3826. /** @hidden */
  3827. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  3828. /** @hidden */
  3829. _markMatrixAsDirty(): void;
  3830. /** @hidden */
  3831. _markAsDirty(): void;
  3832. /** @hidden */
  3833. _markAllAsDirty(): void;
  3834. /** @hidden */
  3835. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3836. /** @hidden */
  3837. protected _transform(context: CanvasRenderingContext2D): void;
  3838. /** @hidden */
  3839. protected _applyStates(context: CanvasRenderingContext2D): void;
  3840. /** @hidden */
  3841. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3842. /** @hidden */
  3843. protected _clip(context: CanvasRenderingContext2D): void;
  3844. /** @hidden */
  3845. _measure(): void;
  3846. /** @hidden */
  3847. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3848. /** @hidden */
  3849. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3850. /** @hidden */
  3851. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3852. /** @hidden */
  3853. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3854. /**
  3855. * Tests if a given coordinates belong to the current control
  3856. * @param x defines x coordinate to test
  3857. * @param y defines y coordinate to test
  3858. * @returns true if the coordinates are inside the control
  3859. */
  3860. contains(x: number, y: number): boolean;
  3861. /** @hidden */
  3862. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3863. /** @hidden */
  3864. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3865. /** @hidden */
  3866. _onPointerEnter(target: Control): boolean;
  3867. /** @hidden */
  3868. _onPointerOut(target: Control): void;
  3869. /** @hidden */
  3870. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3871. /** @hidden */
  3872. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3873. /** @hidden */
  3874. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  3875. /** @hidden */
  3876. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  3877. /** Releases associated resources */
  3878. dispose(): void;
  3879. /** HORIZONTAL_ALIGNMENT_LEFT */
  3880. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  3881. /** HORIZONTAL_ALIGNMENT_RIGHT */
  3882. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  3883. /** HORIZONTAL_ALIGNMENT_CENTER */
  3884. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  3885. /** VERTICAL_ALIGNMENT_TOP */
  3886. static readonly VERTICAL_ALIGNMENT_TOP: number;
  3887. /** VERTICAL_ALIGNMENT_BOTTOM */
  3888. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  3889. /** VERTICAL_ALIGNMENT_CENTER */
  3890. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  3891. /** @hidden */
  3892. static _GetFontOffset(font: string): {
  3893. ascent: number;
  3894. height: number;
  3895. descent: number;
  3896. };
  3897. /**
  3898. * Creates a stack panel that can be used to render headers
  3899. * @param control defines the control to associate with the header
  3900. * @param text defines the text of the header
  3901. * @param size defines the size of the header
  3902. * @param options defines options used to configure the header
  3903. * @returns a new StackPanel
  3904. * @ignore
  3905. * @hidden
  3906. */
  3907. static AddHeader: (control: Control, text: string, size: string | number, options: {
  3908. isHorizontal: boolean;
  3909. controlFirst: boolean;
  3910. }) => any;
  3911. /** @hidden */
  3912. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  3913. }
  3914. }
  3915. declare module BABYLON.GUI {
  3916. /** Class used to create 2D ellipse containers */
  3917. export class Ellipse extends Container {
  3918. name?: string | undefined;
  3919. /** Gets or sets border thickness */
  3920. thickness: number;
  3921. /**
  3922. * Creates a new Ellipse
  3923. * @param name defines the control name
  3924. */
  3925. constructor(name?: string | undefined);
  3926. protected _getTypeName(): string;
  3927. protected _localDraw(context: CanvasRenderingContext2D): void;
  3928. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3929. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3930. }
  3931. }
  3932. declare module BABYLON.GUI {
  3933. /**
  3934. * Class used to create a 2D grid container
  3935. */
  3936. export class Grid extends Container {
  3937. name?: string | undefined;
  3938. /** Gets the list of children */
  3939. readonly children: Control[];
  3940. /**
  3941. * Adds a new row to the grid
  3942. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  3943. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  3944. * @returns the current grid
  3945. */
  3946. addRowDefinition(height: number, isPixel?: boolean): Grid;
  3947. /**
  3948. * Adds a new column to the grid
  3949. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  3950. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  3951. * @returns the current grid
  3952. */
  3953. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  3954. /**
  3955. * Update a row definition
  3956. * @param index defines the index of the row to update
  3957. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  3958. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  3959. * @returns the current grid
  3960. */
  3961. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  3962. /**
  3963. * Update a column definition
  3964. * @param index defines the index of the column to update
  3965. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  3966. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  3967. * @returns the current grid
  3968. */
  3969. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  3970. /**
  3971. * Remove a column definition at specified index
  3972. * @param index defines the index of the column to remove
  3973. * @returns the current grid
  3974. */
  3975. removeColumnDefinition(index: number): Grid;
  3976. /**
  3977. * Remove a row definition at specified index
  3978. * @param index defines the index of the row to remove
  3979. * @returns the current grid
  3980. */
  3981. removeRowDefinition(index: number): Grid;
  3982. /**
  3983. * Adds a new control to the current grid
  3984. * @param control defines the control to add
  3985. * @param row defines the row where to add the control (0 by default)
  3986. * @param column defines the column where to add the control (0 by default)
  3987. * @returns the current grid
  3988. */
  3989. addControl(control: Control, row?: number, column?: number): Grid;
  3990. /**
  3991. * Removes a control from the current container
  3992. * @param control defines the control to remove
  3993. * @returns the current container
  3994. */
  3995. removeControl(control: Control): Container;
  3996. /**
  3997. * Creates a new Grid
  3998. * @param name defines control name
  3999. */
  4000. constructor(name?: string | undefined);
  4001. protected _getTypeName(): string;
  4002. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4003. /** Releases associated resources */
  4004. dispose(): void;
  4005. }
  4006. }
  4007. declare module BABYLON.GUI {
  4008. /**
  4009. * Class used to create 2D images
  4010. */
  4011. class GUIImage extends Control {
  4012. name?: string | undefined;
  4013. /**
  4014. * Gets or sets the left coordinate in the source image
  4015. */
  4016. sourceLeft: number;
  4017. /**
  4018. * Gets or sets the top coordinate in the source image
  4019. */
  4020. sourceTop: number;
  4021. /**
  4022. * Gets or sets the width to capture in the source image
  4023. */
  4024. sourceWidth: number;
  4025. /**
  4026. * Gets or sets the height to capture in the source image
  4027. */
  4028. sourceHeight: number;
  4029. /**
  4030. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  4031. * @see http://doc.babylonjs.com/how_to/gui#image
  4032. */
  4033. autoScale: boolean;
  4034. /** Gets or sets the streching mode used by the image */
  4035. stretch: number;
  4036. /**
  4037. * Gets or sets the internal DOM image used to render the control
  4038. */
  4039. domImage: HTMLImageElement;
  4040. /**
  4041. * Gets or sets image source url
  4042. */
  4043. source: BABYLON.Nullable<string>;
  4044. /**
  4045. * Gets or sets the cell width to use when animation sheet is enabled
  4046. * @see http://doc.babylonjs.com/how_to/gui#image
  4047. */
  4048. cellWidth: number;
  4049. /**
  4050. * Gets or sets the cell height to use when animation sheet is enabled
  4051. * @see http://doc.babylonjs.com/how_to/gui#image
  4052. */
  4053. cellHeight: number;
  4054. /**
  4055. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  4056. * @see http://doc.babylonjs.com/how_to/gui#image
  4057. */
  4058. cellId: number;
  4059. /**
  4060. * Creates a new Image
  4061. * @param name defines the control name
  4062. * @param url defines the image url
  4063. */
  4064. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  4065. protected _getTypeName(): string;
  4066. /** Force the control to synchronize with its content */
  4067. synchronizeSizeWithContent(): void;
  4068. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4069. /** STRETCH_NONE */
  4070. static readonly STRETCH_NONE: number;
  4071. /** STRETCH_FILL */
  4072. static readonly STRETCH_FILL: number;
  4073. /** STRETCH_UNIFORM */
  4074. static readonly STRETCH_UNIFORM: number;
  4075. /** STRETCH_EXTEND */
  4076. static readonly STRETCH_EXTEND: number;
  4077. }
  4078. }
  4079. declare module BABYLON.GUI {
  4080. /**
  4081. * Class used to create input text control
  4082. */
  4083. export class InputText extends Control implements IFocusableControl {
  4084. name?: string | undefined;
  4085. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  4086. promptMessage: string;
  4087. /** BABYLON.Observable raised when the text changes */
  4088. onTextChangedObservable: BABYLON.Observable<InputText>;
  4089. /** BABYLON.Observable raised just before an entered character is to be added */
  4090. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  4091. /** BABYLON.Observable raised when the control gets the focus */
  4092. onFocusObservable: BABYLON.Observable<InputText>;
  4093. /** BABYLON.Observable raised when the control loses the focus */
  4094. onBlurObservable: BABYLON.Observable<InputText>;
  4095. /** Gets or sets the maximum width allowed by the control */
  4096. maxWidth: string | number;
  4097. /** Gets the maximum width allowed by the control in pixels */
  4098. readonly maxWidthInPixels: number;
  4099. /** Gets or sets control margin */
  4100. margin: string;
  4101. /** Gets control margin in pixels */
  4102. readonly marginInPixels: number;
  4103. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  4104. autoStretchWidth: boolean;
  4105. /** Gets or sets border thickness */
  4106. thickness: number;
  4107. /** Gets or sets the background color when focused */
  4108. focusedBackground: string;
  4109. /** Gets or sets the background color */
  4110. background: string;
  4111. /** Gets or sets the placeholder color */
  4112. placeholderColor: string;
  4113. /** Gets or sets the text displayed when the control is empty */
  4114. placeholderText: string;
  4115. /** Gets or sets the dead key flag */
  4116. deadKey: boolean;
  4117. /** Gets or sets if the current key should be added */
  4118. addKey: boolean;
  4119. /** Gets or sets the value of the current key being entered */
  4120. currentKey: string;
  4121. /** Gets or sets the text displayed in the control */
  4122. text: string;
  4123. /** Gets or sets control width */
  4124. width: string | number;
  4125. /**
  4126. * Creates a new InputText
  4127. * @param name defines the control name
  4128. * @param text defines the text of the control
  4129. */
  4130. constructor(name?: string | undefined, text?: string);
  4131. /** @hidden */
  4132. onBlur(): void;
  4133. /** @hidden */
  4134. onFocus(): void;
  4135. protected _getTypeName(): string;
  4136. /** @hidden */
  4137. processKey(keyCode: number, key?: string): void;
  4138. /** @hidden */
  4139. processKeyboard(evt: KeyboardEvent): void;
  4140. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4141. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4142. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4143. protected _beforeRenderText(text: string): string;
  4144. dispose(): void;
  4145. }
  4146. }
  4147. declare module BABYLON.GUI {
  4148. /**
  4149. * Class used to create a password control
  4150. */
  4151. export class InputPassword extends InputText {
  4152. protected _beforeRenderText(text: string): string;
  4153. }
  4154. }
  4155. declare module BABYLON.GUI {
  4156. /** Class used to render 2D lines */
  4157. export class Line extends Control {
  4158. name?: string | undefined;
  4159. /** Gets or sets the dash pattern */
  4160. dash: Array<number>;
  4161. /** Gets or sets the control connected with the line end */
  4162. connectedControl: Control;
  4163. /** Gets or sets start coordinates on X axis */
  4164. x1: string | number;
  4165. /** Gets or sets start coordinates on Y axis */
  4166. y1: string | number;
  4167. /** Gets or sets end coordinates on X axis */
  4168. x2: string | number;
  4169. /** Gets or sets end coordinates on Y axis */
  4170. y2: string | number;
  4171. /** Gets or sets line width */
  4172. lineWidth: number;
  4173. /** Gets or sets horizontal alignment */
  4174. horizontalAlignment: number;
  4175. /** Gets or sets vertical alignment */
  4176. verticalAlignment: number;
  4177. /**
  4178. * Creates a new Line
  4179. * @param name defines the control name
  4180. */
  4181. constructor(name?: string | undefined);
  4182. protected _getTypeName(): string;
  4183. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4184. _measure(): void;
  4185. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4186. /**
  4187. * Move one end of the line given 3D cartesian coordinates.
  4188. * @param position Targeted world position
  4189. * @param scene BABYLON.Scene
  4190. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4191. */
  4192. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  4193. /**
  4194. * Move one end of the line to a position in screen absolute space.
  4195. * @param projectedPosition Position in screen absolute space (X, Y)
  4196. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4197. */
  4198. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  4199. }
  4200. }
  4201. declare module BABYLON.GUI {
  4202. /**
  4203. * Class used to create multi line control
  4204. */
  4205. export class MultiLine extends Control {
  4206. name?: string | undefined;
  4207. /**
  4208. * Creates a new MultiLine
  4209. * @param name defines the control name
  4210. */
  4211. constructor(name?: string | undefined);
  4212. /** Gets or sets dash pattern */
  4213. dash: Array<number>;
  4214. /**
  4215. * Gets point stored at specified index
  4216. * @param index defines the index to look for
  4217. * @returns the requested point if found
  4218. */
  4219. getAt(index: number): MultiLinePoint;
  4220. /** Function called when a point is updated */
  4221. onPointUpdate: () => void;
  4222. /**
  4223. * Adds new points to the point collection
  4224. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  4225. * @returns the list of created MultiLinePoint
  4226. */
  4227. add(...items: (AbstractMesh | Control | {
  4228. x: string | number;
  4229. y: string | number;
  4230. })[]): MultiLinePoint[];
  4231. /**
  4232. * Adds a new point to the point collection
  4233. * @param item defines the item (mesh, control or 2d coordiantes) to add
  4234. * @returns the created MultiLinePoint
  4235. */
  4236. push(item?: (AbstractMesh | Control | {
  4237. x: string | number;
  4238. y: string | number;
  4239. })): MultiLinePoint;
  4240. /**
  4241. * Remove a specific value or point from the active point collection
  4242. * @param value defines the value or point to remove
  4243. */
  4244. remove(value: number | MultiLinePoint): void;
  4245. /** Gets or sets line width */
  4246. lineWidth: number;
  4247. horizontalAlignment: number;
  4248. verticalAlignment: number;
  4249. protected _getTypeName(): string;
  4250. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4251. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4252. _measure(): void;
  4253. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4254. dispose(): void;
  4255. }
  4256. }
  4257. declare module BABYLON.GUI {
  4258. /**
  4259. * Class used to create radio button controls
  4260. */
  4261. export class RadioButton extends Control {
  4262. name?: string | undefined;
  4263. /** Gets or sets border thickness */
  4264. thickness: number;
  4265. /** Gets or sets group name */
  4266. group: string;
  4267. /** BABYLON.Observable raised when isChecked is changed */
  4268. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  4269. /** Gets or sets a value indicating the ratio between overall size and check size */
  4270. checkSizeRatio: number;
  4271. /** Gets or sets background color */
  4272. background: string;
  4273. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  4274. isChecked: boolean;
  4275. /**
  4276. * Creates a new RadioButton
  4277. * @param name defines the control name
  4278. */
  4279. constructor(name?: string | undefined);
  4280. protected _getTypeName(): string;
  4281. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4282. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4283. }
  4284. }
  4285. declare module BABYLON.GUI {
  4286. /**
  4287. * Class used to create a 2D stack panel container
  4288. */
  4289. export class StackPanel extends Container {
  4290. name?: string | undefined;
  4291. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  4292. isVertical: boolean;
  4293. /** Gets or sets panel width */
  4294. width: string | number;
  4295. /** Gets or sets panel height */
  4296. height: string | number;
  4297. /**
  4298. * Creates a new StackPanel
  4299. * @param name defines control name
  4300. */
  4301. constructor(name?: string | undefined);
  4302. protected _getTypeName(): string;
  4303. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4304. }
  4305. }
  4306. declare module BABYLON.GUI {
  4307. /**
  4308. * Enum that determines the text-wrapping mode to use.
  4309. */
  4310. export enum TextWrapping {
  4311. /**
  4312. * Clip the text when it's larger than Control.width; this is the default mode.
  4313. */
  4314. Clip = 0,
  4315. /**
  4316. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  4317. */
  4318. WordWrap = 1,
  4319. /**
  4320. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  4321. */
  4322. Ellipsis = 2
  4323. }
  4324. /**
  4325. * Class used to create text block control
  4326. */
  4327. export class TextBlock extends Control {
  4328. /**
  4329. * Defines the name of the control
  4330. */
  4331. name?: string | undefined;
  4332. /**
  4333. * An event triggered after the text is changed
  4334. */
  4335. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  4336. /**
  4337. * An event triggered after the text was broken up into lines
  4338. */
  4339. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  4340. /**
  4341. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  4342. */
  4343. readonly lines: any[];
  4344. /**
  4345. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  4346. */
  4347. resizeToFit: boolean;
  4348. /**
  4349. * Gets or sets a boolean indicating if text must be wrapped
  4350. */
  4351. textWrapping: TextWrapping | boolean;
  4352. /**
  4353. * Gets or sets text to display
  4354. */
  4355. text: string;
  4356. /**
  4357. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  4358. */
  4359. textHorizontalAlignment: number;
  4360. /**
  4361. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  4362. */
  4363. textVerticalAlignment: number;
  4364. /**
  4365. * Gets or sets line spacing value
  4366. */
  4367. lineSpacing: string | number;
  4368. /**
  4369. * Gets or sets outlineWidth of the text to display
  4370. */
  4371. outlineWidth: number;
  4372. /**
  4373. * Gets or sets outlineColor of the text to display
  4374. */
  4375. outlineColor: string;
  4376. /**
  4377. * Creates a new TextBlock object
  4378. * @param name defines the name of the control
  4379. * @param text defines the text to display (emptry string by default)
  4380. */
  4381. constructor(
  4382. /**
  4383. * Defines the name of the control
  4384. */
  4385. name?: string | undefined, text?: string);
  4386. protected _getTypeName(): string;
  4387. /** @hidden */
  4388. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4389. protected _applyStates(context: CanvasRenderingContext2D): void;
  4390. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4391. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  4392. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  4393. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  4394. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  4395. protected _renderLines(context: CanvasRenderingContext2D): void;
  4396. /**
  4397. * Given a width constraint applied on the text block, find the expected height
  4398. * @returns expected height
  4399. */
  4400. computeExpectedHeight(): number;
  4401. dispose(): void;
  4402. }
  4403. }
  4404. declare module BABYLON.GUI {
  4405. /**
  4406. * Class used to store key control properties
  4407. */
  4408. export class KeyPropertySet {
  4409. /** Width */
  4410. width?: string;
  4411. /** Height */
  4412. height?: string;
  4413. /** Left padding */
  4414. paddingLeft?: string;
  4415. /** Right padding */
  4416. paddingRight?: string;
  4417. /** Top padding */
  4418. paddingTop?: string;
  4419. /** Bottom padding */
  4420. paddingBottom?: string;
  4421. /** Foreground color */
  4422. color?: string;
  4423. /** Background color */
  4424. background?: string;
  4425. }
  4426. /**
  4427. * Class used to create virtual keyboard
  4428. */
  4429. export class VirtualKeyboard extends StackPanel {
  4430. /** BABYLON.Observable raised when a key is pressed */
  4431. onKeyPressObservable: BABYLON.Observable<string>;
  4432. /** Gets or sets default key button width */
  4433. defaultButtonWidth: string;
  4434. /** Gets or sets default key button height */
  4435. defaultButtonHeight: string;
  4436. /** Gets or sets default key button left padding */
  4437. defaultButtonPaddingLeft: string;
  4438. /** Gets or sets default key button right padding */
  4439. defaultButtonPaddingRight: string;
  4440. /** Gets or sets default key button top padding */
  4441. defaultButtonPaddingTop: string;
  4442. /** Gets or sets default key button bottom padding */
  4443. defaultButtonPaddingBottom: string;
  4444. /** Gets or sets default key button foreground color */
  4445. defaultButtonColor: string;
  4446. /** Gets or sets default key button background color */
  4447. defaultButtonBackground: string;
  4448. /** Gets or sets shift button foreground color */
  4449. shiftButtonColor: string;
  4450. /** Gets or sets shift button thickness*/
  4451. selectedShiftThickness: number;
  4452. /** Gets shift key state */
  4453. shiftState: number;
  4454. protected _getTypeName(): string;
  4455. /**
  4456. * Adds a new row of keys
  4457. * @param keys defines the list of keys to add
  4458. * @param propertySets defines the associated property sets
  4459. */
  4460. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  4461. /**
  4462. * Set the shift key to a specific state
  4463. * @param shiftState defines the new shift state
  4464. */
  4465. applyShiftState(shiftState: number): void;
  4466. /** Gets the input text control attached with the keyboard */
  4467. readonly connectedInputText: BABYLON.Nullable<InputText>;
  4468. /**
  4469. * Connects the keyboard with an input text control
  4470. * @param input defines the target control
  4471. */
  4472. connect(input: InputText): void;
  4473. /**
  4474. * Disconnects the keyboard from an input text control
  4475. */
  4476. disconnect(): void;
  4477. /**
  4478. * Creates a new keyboard using a default layout
  4479. * @returns a new VirtualKeyboard
  4480. */
  4481. static CreateDefaultLayout(): VirtualKeyboard;
  4482. }
  4483. }
  4484. declare module BABYLON.GUI {
  4485. /**
  4486. * Class used to create slider controls
  4487. */
  4488. export class Slider extends Control {
  4489. name?: string | undefined;
  4490. /** BABYLON.Observable raised when the sldier value changes */
  4491. onValueChangedObservable: BABYLON.Observable<number>;
  4492. /** Gets or sets border color */
  4493. borderColor: string;
  4494. /** Gets or sets background color */
  4495. background: string;
  4496. /** Gets or sets main bar offset */
  4497. barOffset: string | number;
  4498. /** Gets main bar offset in pixels*/
  4499. readonly barOffsetInPixels: number;
  4500. /** Gets or sets thumb width */
  4501. thumbWidth: string | number;
  4502. /** Gets thumb width in pixels */
  4503. readonly thumbWidthInPixels: number;
  4504. /** Gets or sets minimum value */
  4505. minimum: number;
  4506. /** Gets or sets maximum value */
  4507. maximum: number;
  4508. /** Gets or sets current value */
  4509. value: number;
  4510. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  4511. isVertical: boolean;
  4512. /** Gets or sets a boolean indicating if the thumb should be round or square */
  4513. isThumbCircle: boolean;
  4514. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  4515. isThumbClamped: boolean;
  4516. /**
  4517. * Creates a new Slider
  4518. * @param name defines the control name
  4519. */
  4520. constructor(name?: string | undefined);
  4521. protected _getTypeName(): string;
  4522. protected _getThumbThickness(type: string, backgroundLength: number): number;
  4523. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4524. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4525. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4526. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4527. }
  4528. }
  4529. declare module BABYLON.GUI {
  4530. /** Class used to create rectangle container */
  4531. export class Rectangle extends Container {
  4532. name?: string | undefined;
  4533. /** Gets or sets border thickness */
  4534. thickness: number;
  4535. /** Gets or sets the corner radius angle */
  4536. cornerRadius: number;
  4537. /**
  4538. * Creates a new Rectangle
  4539. * @param name defines the control name
  4540. */
  4541. constructor(name?: string | undefined);
  4542. protected _getTypeName(): string;
  4543. protected _localDraw(context: CanvasRenderingContext2D): void;
  4544. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4545. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4546. }
  4547. }
  4548. declare module BABYLON.GUI {
  4549. /** Class used to render a grid */
  4550. export class DisplayGrid extends Control {
  4551. name?: string | undefined;
  4552. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  4553. displayMinorLines: boolean;
  4554. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  4555. displayMajorLines: boolean;
  4556. /** Gets or sets background color (Black by default) */
  4557. background: string;
  4558. /** Gets or sets the width of each cell (20 by default) */
  4559. cellWidth: number;
  4560. /** Gets or sets the height of each cell (20 by default) */
  4561. cellHeight: number;
  4562. /** Gets or sets the tickness of minor lines (1 by default) */
  4563. minorLineTickness: number;
  4564. /** Gets or sets the color of minor lines (DarkGray by default) */
  4565. minorLineColor: string;
  4566. /** Gets or sets the tickness of major lines (2 by default) */
  4567. majorLineTickness: number;
  4568. /** Gets or sets the color of major lines (White by default) */
  4569. majorLineColor: string;
  4570. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  4571. majorLineFrequency: number;
  4572. /**
  4573. * Creates a new GridDisplayRectangle
  4574. * @param name defines the control name
  4575. */
  4576. constructor(name?: string | undefined);
  4577. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4578. protected _getTypeName(): string;
  4579. }
  4580. }
  4581. declare module BABYLON.GUI {
  4582. /**
  4583. * Forcing an export so that this code will execute
  4584. * @hidden
  4585. */
  4586. const name = "Statics";
  4587. }
  4588. declare module BABYLON.GUI {
  4589. /**
  4590. * Class used as a root to all buttons
  4591. */
  4592. export class AbstractButton3D extends Control3D {
  4593. /**
  4594. * Creates a new button
  4595. * @param name defines the control name
  4596. */
  4597. constructor(name?: string);
  4598. protected _getTypeName(): string;
  4599. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4600. }
  4601. }
  4602. declare module BABYLON.GUI {
  4603. /**
  4604. * Class used to create a button in 3D
  4605. */
  4606. export class Button3D extends AbstractButton3D {
  4607. /** @hidden */
  4608. protected _currentMaterial: BABYLON.Material;
  4609. /**
  4610. * Gets or sets the texture resolution used to render content (512 by default)
  4611. */
  4612. contentResolution: BABYLON.int;
  4613. /**
  4614. * Gets or sets the texture scale ratio used to render content (2 by default)
  4615. */
  4616. contentScaleRatio: number;
  4617. protected _disposeFacadeTexture(): void;
  4618. protected _resetContent(): void;
  4619. /**
  4620. * Creates a new button
  4621. * @param name defines the control name
  4622. */
  4623. constructor(name?: string);
  4624. /**
  4625. * Gets or sets the GUI 2D content used to display the button's facade
  4626. */
  4627. content: Control;
  4628. /**
  4629. * Apply the facade texture (created from the content property).
  4630. * This function can be overloaded by child classes
  4631. * @param facadeTexture defines the AdvancedDynamicTexture to use
  4632. */
  4633. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4634. protected _getTypeName(): string;
  4635. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4636. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4637. /**
  4638. * Releases all associated resources
  4639. */
  4640. dispose(): void;
  4641. }
  4642. }
  4643. declare module BABYLON.GUI {
  4644. /**
  4645. * Class used to create containers for controls
  4646. */
  4647. export class Container3D extends Control3D {
  4648. /**
  4649. * Gets the list of child controls
  4650. */
  4651. protected _children: Control3D[];
  4652. /**
  4653. * Gets the list of child controls
  4654. */
  4655. readonly children: Array<Control3D>;
  4656. /**
  4657. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  4658. * This is helpful to optimize layout operation when adding multiple children in a row
  4659. */
  4660. blockLayout: boolean;
  4661. /**
  4662. * Creates a new container
  4663. * @param name defines the container name
  4664. */
  4665. constructor(name?: string);
  4666. /**
  4667. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  4668. * @returns the current container
  4669. */
  4670. updateLayout(): Container3D;
  4671. /**
  4672. * Gets a boolean indicating if the given control is in the children of this control
  4673. * @param control defines the control to check
  4674. * @returns true if the control is in the child list
  4675. */
  4676. containsControl(control: Control3D): boolean;
  4677. /**
  4678. * Adds a control to the children of this control
  4679. * @param control defines the control to add
  4680. * @returns the current container
  4681. */
  4682. addControl(control: Control3D): Container3D;
  4683. /**
  4684. * This function will be called everytime a new control is added
  4685. */
  4686. protected _arrangeChildren(): void;
  4687. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  4688. /**
  4689. * Removes a control from the children of this control
  4690. * @param control defines the control to remove
  4691. * @returns the current container
  4692. */
  4693. removeControl(control: Control3D): Container3D;
  4694. protected _getTypeName(): string;
  4695. /**
  4696. * Releases all associated resources
  4697. */
  4698. dispose(): void;
  4699. /** Control rotation will remain unchanged */
  4700. static readonly UNSET_ORIENTATION: number;
  4701. /** Control will rotate to make it look at sphere central axis */
  4702. static readonly FACEORIGIN_ORIENTATION: number;
  4703. /** Control will rotate to make it look back at sphere central axis */
  4704. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  4705. /** Control will rotate to look at z axis (0, 0, 1) */
  4706. static readonly FACEFORWARD_ORIENTATION: number;
  4707. /** Control will rotate to look at negative z axis (0, 0, -1) */
  4708. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  4709. }
  4710. }
  4711. declare module BABYLON.GUI {
  4712. /**
  4713. * Class used as base class for controls
  4714. */
  4715. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  4716. /** Defines the control name */
  4717. name?: string | undefined;
  4718. /** @hidden */
  4719. _host: GUI3DManager;
  4720. /** Gets or sets the control position in world space */
  4721. position: BABYLON.Vector3;
  4722. /** Gets or sets the control scaling in world space */
  4723. scaling: BABYLON.Vector3;
  4724. /** Callback used to start pointer enter animation */
  4725. pointerEnterAnimation: () => void;
  4726. /** Callback used to start pointer out animation */
  4727. pointerOutAnimation: () => void;
  4728. /** Callback used to start pointer down animation */
  4729. pointerDownAnimation: () => void;
  4730. /** Callback used to start pointer up animation */
  4731. pointerUpAnimation: () => void;
  4732. /**
  4733. * An event triggered when the pointer move over the control
  4734. */
  4735. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  4736. /**
  4737. * An event triggered when the pointer move out of the control
  4738. */
  4739. onPointerOutObservable: BABYLON.Observable<Control3D>;
  4740. /**
  4741. * An event triggered when the pointer taps the control
  4742. */
  4743. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  4744. /**
  4745. * An event triggered when pointer is up
  4746. */
  4747. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  4748. /**
  4749. * An event triggered when a control is clicked on (with a mouse)
  4750. */
  4751. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  4752. /**
  4753. * An event triggered when pointer enters the control
  4754. */
  4755. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  4756. /**
  4757. * Gets or sets the parent container
  4758. */
  4759. parent: BABYLON.Nullable<Container3D>;
  4760. /**
  4761. * Gets the list of attached behaviors
  4762. * @see http://doc.babylonjs.com/features/behaviour
  4763. */
  4764. readonly behaviors: BABYLON.Behavior<Control3D>[];
  4765. /**
  4766. * Attach a behavior to the control
  4767. * @see http://doc.babylonjs.com/features/behaviour
  4768. * @param behavior defines the behavior to attach
  4769. * @returns the current control
  4770. */
  4771. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  4772. /**
  4773. * Remove an attached behavior
  4774. * @see http://doc.babylonjs.com/features/behaviour
  4775. * @param behavior defines the behavior to attach
  4776. * @returns the current control
  4777. */
  4778. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  4779. /**
  4780. * Gets an attached behavior by name
  4781. * @param name defines the name of the behavior to look for
  4782. * @see http://doc.babylonjs.com/features/behaviour
  4783. * @returns null if behavior was not found else the requested behavior
  4784. */
  4785. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  4786. /** Gets or sets a boolean indicating if the control is visible */
  4787. isVisible: boolean;
  4788. /**
  4789. * Creates a new control
  4790. * @param name defines the control name
  4791. */
  4792. constructor(
  4793. /** Defines the control name */
  4794. name?: string | undefined);
  4795. /**
  4796. * Gets a string representing the class name
  4797. */
  4798. readonly typeName: string;
  4799. protected _getTypeName(): string;
  4800. /**
  4801. * Gets the transform node used by this control
  4802. */
  4803. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  4804. /**
  4805. * Gets the mesh used to render this control
  4806. */
  4807. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  4808. /**
  4809. * Link the control as child of the given node
  4810. * @param node defines the node to link to. Use null to unlink the control
  4811. * @returns the current control
  4812. */
  4813. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  4814. /** @hidden **/
  4815. _prepareNode(scene: BABYLON.Scene): void;
  4816. /**
  4817. * Node creation.
  4818. * Can be overriden by children
  4819. * @param scene defines the scene where the node must be attached
  4820. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  4821. */
  4822. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  4823. /**
  4824. * Affect a material to the given mesh
  4825. * @param mesh defines the mesh which will represent the control
  4826. */
  4827. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4828. /** @hidden */
  4829. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  4830. /** @hidden */
  4831. _onPointerEnter(target: Control3D): boolean;
  4832. /** @hidden */
  4833. _onPointerOut(target: Control3D): void;
  4834. /** @hidden */
  4835. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  4836. /** @hidden */
  4837. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4838. /** @hidden */
  4839. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  4840. /** @hidden */
  4841. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  4842. /** @hidden */
  4843. _disposeNode(): void;
  4844. /**
  4845. * Releases all associated resources
  4846. */
  4847. dispose(): void;
  4848. }
  4849. }
  4850. declare module BABYLON.GUI {
  4851. /**
  4852. * Class used to create a container panel deployed on the surface of a cylinder
  4853. */
  4854. export class CylinderPanel extends VolumeBasedPanel {
  4855. /**
  4856. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  4857. */
  4858. radius: BABYLON.float;
  4859. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4860. }
  4861. }
  4862. declare module BABYLON.GUI {
  4863. /**
  4864. * Class used to create a holographic button in 3D
  4865. */
  4866. export class HolographicButton extends Button3D {
  4867. /**
  4868. * Gets or sets text for the button
  4869. */
  4870. text: string;
  4871. /**
  4872. * Gets or sets the image url for the button
  4873. */
  4874. imageUrl: string;
  4875. /**
  4876. * Gets the back material used by this button
  4877. */
  4878. readonly backMaterial: FluentMaterial;
  4879. /**
  4880. * Gets the front material used by this button
  4881. */
  4882. readonly frontMaterial: FluentMaterial;
  4883. /**
  4884. * Gets the plate material used by this button
  4885. */
  4886. readonly plateMaterial: BABYLON.StandardMaterial;
  4887. /**
  4888. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  4889. */
  4890. readonly shareMaterials: boolean;
  4891. /**
  4892. * Creates a new button
  4893. * @param name defines the control name
  4894. */
  4895. constructor(name?: string, shareMaterials?: boolean);
  4896. protected _getTypeName(): string;
  4897. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4898. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  4899. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  4900. /**
  4901. * Releases all associated resources
  4902. */
  4903. dispose(): void;
  4904. }
  4905. }
  4906. declare module BABYLON.GUI {
  4907. /**
  4908. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  4909. */
  4910. export class MeshButton3D extends Button3D {
  4911. /** @hidden */
  4912. protected _currentMesh: BABYLON.Mesh;
  4913. /**
  4914. * Creates a new 3D button based on a mesh
  4915. * @param mesh mesh to become a 3D button
  4916. * @param name defines the control name
  4917. */
  4918. constructor(mesh: BABYLON.Mesh, name?: string);
  4919. protected _getTypeName(): string;
  4920. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  4921. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  4922. }
  4923. }
  4924. declare module BABYLON.GUI {
  4925. /**
  4926. * Class used to create a container panel deployed on the surface of a plane
  4927. */
  4928. export class PlanePanel extends VolumeBasedPanel {
  4929. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4930. }
  4931. }
  4932. declare module BABYLON.GUI {
  4933. /**
  4934. * Class used to create a container panel where items get randomized planar mapping
  4935. */
  4936. export class ScatterPanel extends VolumeBasedPanel {
  4937. /**
  4938. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  4939. */
  4940. iteration: BABYLON.float;
  4941. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4942. protected _finalProcessing(): void;
  4943. }
  4944. }
  4945. declare module BABYLON.GUI {
  4946. /**
  4947. * Class used to create a container panel deployed on the surface of a sphere
  4948. */
  4949. export class SpherePanel extends VolumeBasedPanel {
  4950. /**
  4951. * Gets or sets the radius of the sphere where to project controls (5 by default)
  4952. */
  4953. radius: BABYLON.float;
  4954. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  4955. }
  4956. }
  4957. declare module BABYLON.GUI {
  4958. /**
  4959. * Class used to create a stack panel in 3D on XY plane
  4960. */
  4961. export class StackPanel3D extends Container3D {
  4962. /**
  4963. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  4964. */
  4965. isVertical: boolean;
  4966. /**
  4967. * Gets or sets the distance between elements
  4968. */
  4969. margin: number;
  4970. /**
  4971. * Creates new StackPanel
  4972. * @param isVertical
  4973. */
  4974. constructor(isVertical?: boolean);
  4975. protected _arrangeChildren(): void;
  4976. }
  4977. }
  4978. declare module BABYLON.GUI {
  4979. /**
  4980. * Abstract class used to create a container panel deployed on the surface of a volume
  4981. */
  4982. export abstract class VolumeBasedPanel extends Container3D {
  4983. protected _cellWidth: number;
  4984. protected _cellHeight: number;
  4985. /**
  4986. * Gets or sets the distance between elements
  4987. */
  4988. margin: number;
  4989. /**
  4990. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  4991. * | Value | Type | Description |
  4992. * | ----- | ----------------------------------- | ----------- |
  4993. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  4994. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  4995. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  4996. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  4997. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  4998. */
  4999. orientation: number;
  5000. /**
  5001. * Gets or sets the number of columns requested (10 by default).
  5002. * The panel will automatically compute the number of rows based on number of child controls.
  5003. */
  5004. columns: BABYLON.int;
  5005. /**
  5006. * Gets or sets a the number of rows requested.
  5007. * The panel will automatically compute the number of columns based on number of child controls.
  5008. */
  5009. rows: BABYLON.int;
  5010. /**
  5011. * Creates new VolumeBasedPanel
  5012. */
  5013. constructor();
  5014. protected _arrangeChildren(): void;
  5015. /** Child classes must implement this function to provide correct control positioning */
  5016. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5017. /** Child classes can implement this function to provide additional processing */
  5018. protected _finalProcessing(): void;
  5019. }
  5020. }
  5021. declare module BABYLON.GUI {
  5022. /** @hidden */
  5023. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  5024. INNERGLOW: boolean;
  5025. BORDER: boolean;
  5026. HOVERLIGHT: boolean;
  5027. constructor();
  5028. }
  5029. /**
  5030. * Class used to render controls with fluent desgin
  5031. */
  5032. export class FluentMaterial extends BABYLON.PushMaterial {
  5033. /**
  5034. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  5035. */
  5036. innerGlowColorIntensity: number;
  5037. /**
  5038. * Gets or sets the inner glow color (white by default)
  5039. */
  5040. innerGlowColor: BABYLON.Color3;
  5041. /**
  5042. * Gets or sets alpha value (default is 1.0)
  5043. */
  5044. alpha: number;
  5045. /**
  5046. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  5047. */
  5048. albedoColor: BABYLON.Color3;
  5049. /**
  5050. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  5051. */
  5052. renderBorders: boolean;
  5053. /**
  5054. * Gets or sets border width (default is 0.5)
  5055. */
  5056. borderWidth: number;
  5057. /**
  5058. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  5059. */
  5060. edgeSmoothingValue: number;
  5061. /**
  5062. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  5063. */
  5064. borderMinValue: number;
  5065. /**
  5066. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  5067. */
  5068. renderHoverLight: boolean;
  5069. /**
  5070. * Gets or sets the radius used to render the hover light (default is 1.0)
  5071. */
  5072. hoverRadius: number;
  5073. /**
  5074. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  5075. */
  5076. hoverColor: BABYLON.Color4;
  5077. /**
  5078. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  5079. */
  5080. hoverPosition: BABYLON.Vector3;
  5081. /**
  5082. * Creates a new Fluent material
  5083. * @param name defines the name of the material
  5084. * @param scene defines the hosting scene
  5085. */
  5086. constructor(name: string, scene: BABYLON.Scene);
  5087. needAlphaBlending(): boolean;
  5088. needAlphaTesting(): boolean;
  5089. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  5090. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  5091. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  5092. getActiveTextures(): BABYLON.BaseTexture[];
  5093. hasTexture(texture: BABYLON.BaseTexture): boolean;
  5094. dispose(forceDisposeEffect?: boolean): void;
  5095. clone(name: string): FluentMaterial;
  5096. serialize(): any;
  5097. getClassName(): string;
  5098. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  5099. }
  5100. }
  5101. declare module BABYLON.GUI {
  5102. /**
  5103. * Class used to store data to display
  5104. * @see http://doc.babylonjs.com/how_to/chart3d
  5105. */
  5106. export class DataSeries {
  5107. /** Gets or sets the label of the series */
  5108. label: string;
  5109. /** Gets or sets the color associated with the series */
  5110. color: BABYLON.Color3;
  5111. /** Gets or sets the list of dimensions (used to filter data) */
  5112. dimensions: Array<string>;
  5113. /** Gets or sets the list of values (data to display) */
  5114. data: Array<any>;
  5115. /**
  5116. * Apply a list of filters to the data and return a list
  5117. * @param filters defines the filters to apply
  5118. * @returns an array containing the filtered data
  5119. */
  5120. getFilteredData(filters: {
  5121. [key: string]: string;
  5122. }): Array<any>;
  5123. /**
  5124. * Get the different values of a dimension
  5125. * @param key defines the dimension name
  5126. * @returns An array of values
  5127. */
  5128. getDimensionValues(key: string): Array<any>;
  5129. /**
  5130. * Create a new DataSeries containing testing values
  5131. * @returns the new DataSeries
  5132. */
  5133. static CreateFakeData(): DataSeries;
  5134. /**
  5135. * Create a new DataSeries containing testing spatial values
  5136. * @returns the new DataSeries
  5137. */
  5138. static CreateFakeSpatialData(): DataSeries;
  5139. }
  5140. }
  5141. declare module BABYLON.GUI {
  5142. /**
  5143. * Base class for all chart controls
  5144. * @see http://doc.babylonjs.com/how_to/chart3d#charts
  5145. */
  5146. export abstract class Chart {
  5147. protected _dataSource: BABYLON.Nullable<DataSeries>;
  5148. protected _rootNode: BABYLON.TransformNode;
  5149. protected _dataFilters: {
  5150. [key: string]: string;
  5151. };
  5152. protected _scene: BABYLON.Scene;
  5153. protected _blockRefresh: boolean;
  5154. /** BABYLON.Observable raised when a new element is created */
  5155. onElementCreatedObservable: BABYLON.Observable<BABYLON.Mesh>;
  5156. /**
  5157. * BABYLON.Observable raised when the point picked by the pointer events changed
  5158. */
  5159. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  5160. /**
  5161. * BABYLON.Observable raised when the pointer enters an element of the chart
  5162. */
  5163. onElementEnterObservable: BABYLON.Observable<BABYLON.AbstractMesh>;
  5164. /**
  5165. * BABYLON.Observable raised when the pointer leaves an element of the chart
  5166. */
  5167. onElementOutObservable: BABYLON.Observable<BABYLON.AbstractMesh>;
  5168. /** User defined callback used to create labels */
  5169. labelCreationFunction: BABYLON.Nullable<(label: string, width: number, includeBackground: boolean) => BABYLON.Mesh>;
  5170. /** Gets or sets the rotation of the entire chart */
  5171. rotation: BABYLON.Vector3;
  5172. /** Gets or sets the position of the entire chart */
  5173. position: BABYLON.Vector3;
  5174. /** Gets or sets the scaling of the entire chart */
  5175. scaling: BABYLON.Vector3;
  5176. /** Gets or sets the data source used by the graph */
  5177. dataSource: BABYLON.Nullable<DataSeries>;
  5178. /** Gets or sets the filters applied to data source */
  5179. dataFilters: {
  5180. [key: string]: string;
  5181. };
  5182. /** Gets the root node associated with this graph */
  5183. readonly rootNode: BABYLON.TransformNode;
  5184. /** 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) */
  5185. blockRefresh: boolean;
  5186. /** Gets or sets the name of the graph */
  5187. name: string;
  5188. /**
  5189. * Creates a new Chart
  5190. * @param name defines the name of the graph
  5191. * @param scene defines the hosting scene
  5192. */
  5193. constructor(name: string, scene?: BABYLON.Nullable<BABYLON.Scene>);
  5194. /**
  5195. * Function called by the chart objects when they need a label. Could be user defined if you set this.labelCreationFunction to a custom callback
  5196. * @param label defines the text of the label
  5197. * @param width defines the expected width (height is supposed to be 1)
  5198. * @param includeBackground defines if a background rectangle must be added (default is true)
  5199. * @returns a mesh used to host the label
  5200. */
  5201. protected _addLabel(label: string, width: number, includeBackground?: boolean): BABYLON.Mesh;
  5202. /**
  5203. * Remove specific label mesh
  5204. * @param label defines the label mesh to remove
  5205. */
  5206. protected _removeLabel(label: BABYLON.Mesh): void;
  5207. /** Remove all created labels */
  5208. protected _removeLabels(): void;
  5209. /**
  5210. * Force the chart to redraw itself
  5211. * @returns the current chart
  5212. */
  5213. abstract refresh(): Chart;
  5214. /** Release all associated resources */
  5215. dispose(): void;
  5216. protected _clean(): void;
  5217. }
  5218. }
  5219. declare module BABYLON.GUI {
  5220. /**
  5221. * Class used to render bar graphs
  5222. * @see http://doc.babylonjs.com/how_to/chart3d#bargraph
  5223. */
  5224. export class BarGraph extends Chart {
  5225. protected _ownDefaultMaterial: boolean;
  5226. /** Gets or sets a boolean indicating if the background must be displayed */
  5227. displayBackground: boolean;
  5228. /** Gets or sets a boolean indicating if labels must be displayed */
  5229. displayLabels: boolean;
  5230. /** Gets or sets the margin between bars */
  5231. margin: number;
  5232. /** Gets or sets the width of each bar */
  5233. barWidth: number;
  5234. /** Gets or sets the maximum height of a bar */
  5235. maxBarHeight: number;
  5236. /** Gets or sets the dimension used for the labels */
  5237. labelDimension: string;
  5238. /** Gets or sets the material used by bar meshes */
  5239. defaultMaterial: BABYLON.Nullable<BABYLON.Material>;
  5240. /**
  5241. * Creates a new BarGraph
  5242. * @param name defines the name of the graph
  5243. * @param scene defines the hosting scene
  5244. */
  5245. constructor(name: string, scene?: BABYLON.Nullable<BABYLON.Scene>);
  5246. protected _createDefaultMaterial(scene: BABYLON.Scene): BABYLON.Material;
  5247. /**
  5248. * Children class can override this function to provide a new mesh (as long as it stays inside a 1x1x1 box)
  5249. * @param name defines the mesh name
  5250. * @param scene defines the hosting scene
  5251. * @returns a new mesh used to represent the current bar
  5252. */
  5253. protected _createBarMesh(name: string, scene: BABYLON.Scene): BABYLON.Mesh;
  5254. /**
  5255. * Force the graph to redraw itself
  5256. * @returns the current BarGraph
  5257. */
  5258. refresh(): BarGraph;
  5259. /** Clean associated resources */
  5260. dispose(): void;
  5261. protected _clean(): void;
  5262. }
  5263. }
  5264. declare module BABYLON.GUI {
  5265. /**
  5266. * Class used to render bar graphs
  5267. * @see http://doc.babylonjs.com/how_to/chart3d#mapgraph
  5268. */
  5269. export class MapGraph extends Chart {
  5270. /**
  5271. * Creates a new MapGraph
  5272. * @param name defines the name of the graph
  5273. * @param scene defines the hosting scene
  5274. */
  5275. constructor(name: string, mapUrl: string, scene?: BABYLON.Nullable<BABYLON.Scene>);
  5276. protected _createBarMesh(name: string, scene: BABYLON.Scene): BABYLON.Mesh;
  5277. refresh(): MapGraph;
  5278. protected _clean(): void;
  5279. }
  5280. }