babylon.gui.module.d.ts 255 KB

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