babylon.gui.module.d.ts 256 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652
  1. /*BabylonJS GUI*/
  2. // Dependencies for this module:
  3. // ../../../../Tools/Gulp/babylonjs
  4. declare module 'babylonjs-gui' {
  5. export * from "babylonjs-gui/src/2D";
  6. export * from "babylonjs-gui/src/3D";
  7. }
  8. declare module 'babylonjs-gui/src/2D' {
  9. export * from "babylonjs-gui/src/2D/controls";
  10. export * from "babylonjs-gui/src/2D/advancedDynamicTexture";
  11. export * from "babylonjs-gui/src/2D/math2D";
  12. export * from "babylonjs-gui/src/2D/measure";
  13. export * from "babylonjs-gui/src/2D/multiLinePoint";
  14. export * from "babylonjs-gui/src/2D/style";
  15. export * from "babylonjs-gui/src/2D/valueAndUnit";
  16. }
  17. declare module 'babylonjs-gui/src/3D' {
  18. export * from "babylonjs-gui/src/3D/controls";
  19. export * from "babylonjs-gui/src/3D/materials";
  20. export * from "babylonjs-gui/src/3D/gui3DManager";
  21. export * from "babylonjs-gui/src/3D/vector3WithInfo";
  22. }
  23. declare module 'babylonjs-gui/src/2D/controls' {
  24. export * from "babylonjs-gui/src/2D/controls/button";
  25. export * from "babylonjs-gui/src/2D/controls/checkbox";
  26. export * from "babylonjs-gui/src/2D/controls/colorpicker";
  27. export * from "babylonjs-gui/src/2D/controls/container";
  28. export * from "babylonjs-gui/src/2D/controls/control";
  29. export * from "babylonjs-gui/src/2D/controls/ellipse";
  30. export * from "babylonjs-gui/src/2D/controls/grid";
  31. export * from "babylonjs-gui/src/2D/controls/image";
  32. export * from "babylonjs-gui/src/2D/controls/inputText";
  33. export * from "babylonjs-gui/src/2D/controls/inputPassword";
  34. export * from "babylonjs-gui/src/2D/controls/line";
  35. export * from "babylonjs-gui/src/2D/controls/multiLine";
  36. export * from "babylonjs-gui/src/2D/controls/radioButton";
  37. export * from "babylonjs-gui/src/2D/controls/stackPanel";
  38. export * from "babylonjs-gui/src/2D/controls/selector";
  39. export * from "babylonjs-gui/src/2D/controls/textBlock";
  40. export * from "babylonjs-gui/src/2D/controls/virtualKeyboard";
  41. export * from "babylonjs-gui/src/2D/controls/rectangle";
  42. export * from "babylonjs-gui/src/2D/controls/displayGrid";
  43. export * from "babylonjs-gui/src/2D/controls/baseSlider";
  44. export * from "babylonjs-gui/src/2D/controls/slider";
  45. export * from "babylonjs-gui/src/2D/controls/imageBasedSlider";
  46. export * from "babylonjs-gui/src/2D/controls/statics";
  47. }
  48. declare module 'babylonjs-gui/src/2D/advancedDynamicTexture' {
  49. import { DynamicTexture, Nullable, Layer, Viewport, Scene, Vector3, Matrix, Vector2, AbstractMesh } from "babylonjs";
  50. import { Container } from "babylonjs-gui/src/2D/controls/container";
  51. import { Control } from "babylonjs-gui/src/2D/controls/control";
  52. import { Style } from "babylonjs-gui/src/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/src/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/src/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/src/2D/multiLinePoint' {
  411. import { MultiLine } from "babylonjs-gui/src/2D/controls/multiLine";
  412. import { Control } from "babylonjs-gui/src/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/src/2D/style' {
  446. import { IDisposable, Observable } from "babylonjs";
  447. import { AdvancedDynamicTexture } from "babylonjs-gui/src/2D/advancedDynamicTexture";
  448. import { ValueAndUnit } from "babylonjs-gui/src/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/src/2D/valueAndUnit' {
  486. import { AdvancedDynamicTexture } from "babylonjs-gui/src/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/src/3D/controls' {
  549. export * from "babylonjs-gui/src/3D/controls/abstractButton3D";
  550. export * from "babylonjs-gui/src/3D/controls/button3D";
  551. export * from "babylonjs-gui/src/3D/controls/container3D";
  552. export * from "babylonjs-gui/src/3D/controls/control3D";
  553. export * from "babylonjs-gui/src/3D/controls/cylinderPanel";
  554. export * from "babylonjs-gui/src/3D/controls/holographicButton";
  555. export * from "babylonjs-gui/src/3D/controls/meshButton3D";
  556. export * from "babylonjs-gui/src/3D/controls/planePanel";
  557. export * from "babylonjs-gui/src/3D/controls/scatterPanel";
  558. export * from "babylonjs-gui/src/3D/controls/spherePanel";
  559. export * from "babylonjs-gui/src/3D/controls/stackPanel3D";
  560. export * from "babylonjs-gui/src/3D/controls/volumeBasedPanel";
  561. }
  562. declare module 'babylonjs-gui/src/3D/materials' {
  563. export * from "babylonjs-gui/src/3D/materials/fluentMaterial";
  564. }
  565. declare module 'babylonjs-gui/src/3D/gui3DManager' {
  566. import { IDisposable, Scene, Nullable, UtilityLayerRenderer, Observable, Vector3, Material } from "babylonjs";
  567. import { Container3D } from "babylonjs-gui/src/3D/controls/container3D";
  568. import { Control3D } from "babylonjs-gui/src/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/src/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/src/2D/controls/button' {
  648. import { Rectangle } from "babylonjs-gui/src/2D/controls/rectangle";
  649. import { Control } from "babylonjs-gui/src/2D/controls/control";
  650. import { TextBlock } from "babylonjs-gui/src/2D/controls/textBlock";
  651. import { Image } from "babylonjs-gui/src/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/src/2D/controls/checkbox' {
  731. import { Control } from "babylonjs-gui/src/2D/controls/control";
  732. import { Measure } from "babylonjs-gui/src/2D/measure";
  733. import { Observable, Vector2 } from "babylonjs";
  734. import { StackPanel } from "babylonjs-gui/src/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/src/2D/controls/colorpicker' {
  772. import { Control } from "babylonjs-gui/src/2D/controls/control";
  773. import { Color3, Observable, Vector2 } from "babylonjs";
  774. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/container' {
  804. import { Control } from "babylonjs-gui/src/2D/controls/control";
  805. import { Measure } from "babylonjs-gui/src/2D/measure";
  806. import { Nullable } from "babylonjs";
  807. import { AdvancedDynamicTexture } from "babylonjs-gui/src/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/src/2D/controls/control' {
  896. import { Container } from "babylonjs-gui/src/2D/controls/container";
  897. import { AdvancedDynamicTexture } from "babylonjs-gui/src/2D/advancedDynamicTexture";
  898. import { ValueAndUnit } from "babylonjs-gui/src/2D/valueAndUnit";
  899. import { Nullable, Vector2, AbstractMesh, Observable, Vector3, Scene } from "babylonjs";
  900. import { Measure } from "babylonjs-gui/src/2D/measure";
  901. import { Style } from "babylonjs-gui/src/2D/style";
  902. import { Matrix2D, Vector2WithInfo } from "babylonjs-gui/src/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/src/2D/controls/ellipse' {
  1323. import { Container } from "babylonjs-gui/src/2D/controls/container";
  1324. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/grid' {
  1342. import { Container } from "babylonjs-gui/src/2D/controls/container";
  1343. import { Control } from "babylonjs-gui/src/2D/controls/control";
  1344. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/image' {
  1436. import { Control } from "babylonjs-gui/src/2D/controls/control";
  1437. import { Nullable, Observable } from "babylonjs";
  1438. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/inputText' {
  1520. import { Control } from "babylonjs-gui/src/2D/controls/control";
  1521. import { IFocusableControl } from "babylonjs-gui/src/2D/advancedDynamicTexture";
  1522. import { Nullable, Observable, Vector2 } from "babylonjs";
  1523. import { Measure } from "babylonjs-gui/src/2D/measure";
  1524. import { VirtualKeyboard } from "babylonjs-gui/src/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/src/2D/controls/inputPassword' {
  1600. import { InputText } from "babylonjs-gui/src/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/src/2D/controls/line' {
  1609. import { Control } from "babylonjs-gui/src/2D/controls/control";
  1610. import { Vector3, Scene } from "babylonjs";
  1611. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/multiLine' {
  1658. import { Control } from "babylonjs-gui/src/2D/controls/control";
  1659. import { MultiLinePoint } from "babylonjs-gui/src/2D/multiLinePoint";
  1660. import { AbstractMesh } from "babylonjs";
  1661. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/radioButton' {
  1726. import { Control } from "babylonjs-gui/src/2D/controls/control";
  1727. import { Observable, Vector2 } from "babylonjs";
  1728. import { Measure } from "babylonjs-gui/src/2D/measure";
  1729. import { StackPanel } from "babylonjs-gui/src/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/src/2D/controls/stackPanel' {
  1767. import { Container } from "babylonjs-gui/src/2D/controls/container";
  1768. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/selector' {
  1796. import { Rectangle } from "babylonjs-gui/src/2D/controls/rectangle";
  1797. import { StackPanel } from "babylonjs-gui/src/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/src/2D/controls/textBlock' {
  1972. import { Observable } from "babylonjs";
  1973. import { Measure } from "babylonjs-gui/src/2D/measure";
  1974. import { Control } from "babylonjs-gui/src/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/src/2D/controls/virtualKeyboard' {
  2073. import { StackPanel } from "babylonjs-gui/src/2D/controls/stackPanel";
  2074. import { Observable, Nullable } from "babylonjs";
  2075. import { InputText } from "babylonjs-gui/src/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/src/2D/controls/rectangle' {
  2165. import { Container } from "babylonjs-gui/src/2D/controls/container";
  2166. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/displayGrid' {
  2186. import { Control } from "babylonjs-gui/src/2D/controls";
  2187. import { Measure } from "babylonjs-gui/src/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/src/2D/controls/baseSlider' {
  2221. import { Control } from "babylonjs-gui/src/2D/controls/control";
  2222. import { ValueAndUnit } from "babylonjs-gui/src/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/src/2D/controls/slider' {
  2277. import { Measure } from "babylonjs-gui/src/2D/measure";
  2278. import { BaseSlider } from "babylonjs-gui/src/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/src/2D/controls/imageBasedSlider' {
  2300. import { BaseSlider } from "babylonjs-gui/src/2D/controls/baseSlider";
  2301. import { Measure } from "babylonjs-gui/src/2D/measure";
  2302. import { Image } from "babylonjs-gui/src/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/src/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/src/3D/controls/abstractButton3D' {
  2339. import { Control3D } from "babylonjs-gui/src/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/src/3D/controls/button3D' {
  2355. import { AbstractButton3D } from "babylonjs-gui/src/3D/controls/abstractButton3D";
  2356. import { Material, int, Scene, TransformNode, AbstractMesh } from "babylonjs";
  2357. import { AdvancedDynamicTexture } from "babylonjs-gui/src/2D/advancedDynamicTexture";
  2358. import { Control } from "babylonjs-gui/src/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/src/3D/controls/container3D' {
  2400. import { Control3D } from "babylonjs-gui/src/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/src/3D/controls/control3D' {
  2470. import { IDisposable, IBehaviorAware, Nullable, TransformNode, Vector3, Observable, Behavior, AbstractMesh, Scene } from "babylonjs";
  2471. import { GUI3DManager } from "babylonjs-gui/src/3D/gui3DManager";
  2472. import { Vector3WithInfo } from "babylonjs-gui/src/3D/vector3WithInfo";
  2473. import { Container3D } from "babylonjs-gui/src/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/src/3D/controls/cylinderPanel' {
  2613. import { VolumeBasedPanel } from "babylonjs-gui/src/3D/controls/volumeBasedPanel";
  2614. import { float, Vector3 } from "babylonjs";
  2615. import { Control3D } from "babylonjs-gui/src/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/src/3D/controls/holographicButton' {
  2628. import { Button3D } from "babylonjs-gui/src/3D/controls/button3D";
  2629. import { Mesh, StandardMaterial, Nullable, Scene, TransformNode } from "babylonjs";
  2630. import { FluentMaterial } from "babylonjs-gui/src/3D/materials/fluentMaterial";
  2631. import { AdvancedDynamicTexture } from "babylonjs-gui/src/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/src/3D/controls/meshButton3D' {
  2680. import { Scene, TransformNode, AbstractMesh, Mesh } from "babylonjs";
  2681. import { Button3D } from "babylonjs-gui/src/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/src/3D/controls/planePanel' {
  2700. import { Vector3 } from "babylonjs";
  2701. import { Control3D } from "babylonjs-gui/src/3D/controls/control3D";
  2702. import { VolumeBasedPanel } from "babylonjs-gui/src/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/src/3D/controls/scatterPanel' {
  2711. import { VolumeBasedPanel } from "babylonjs-gui/src/3D/controls/volumeBasedPanel";
  2712. import { float, Vector3 } from "babylonjs";
  2713. import { Control3D } from "babylonjs-gui/src/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/src/3D/controls/spherePanel' {
  2727. import { VolumeBasedPanel } from "babylonjs-gui/src/3D/controls/volumeBasedPanel";
  2728. import { float, Vector3 } from "babylonjs";
  2729. import { Control3D } from "babylonjs-gui/src/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/src/3D/controls/stackPanel3D' {
  2742. import { Container3D } from "babylonjs-gui/src/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/src/3D/controls/volumeBasedPanel' {
  2764. import { Container3D } from "babylonjs-gui/src/3D/controls/container3D";
  2765. import { int, Vector3 } from "babylonjs";
  2766. import { Control3D } from "babylonjs-gui/src/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/src/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. * Interface used to define a control that can receive focus
  2899. */
  2900. export interface IFocusableControl {
  2901. /**
  2902. * Function called when the control receives the focus
  2903. */
  2904. onFocus(): void;
  2905. /**
  2906. * Function called when the control loses the focus
  2907. */
  2908. onBlur(): void;
  2909. /**
  2910. * Function called to let the control handle keyboard events
  2911. * @param evt defines the current keyboard event
  2912. */
  2913. processKeyboard(evt: KeyboardEvent): void;
  2914. /**
  2915. * Function called to get the list of controls that should not steal the focus from this control
  2916. * @returns an array of controls
  2917. */
  2918. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  2919. }
  2920. /**
  2921. * Class used to create texture to support 2D GUI elements
  2922. * @see http://doc.babylonjs.com/how_to/gui
  2923. */
  2924. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  2925. /** @hidden */
  2926. _rootContainer: Container;
  2927. /** @hidden */
  2928. _lastPickedControl: Control;
  2929. /** @hidden */
  2930. _lastControlOver: {
  2931. [pointerId: number]: Control;
  2932. };
  2933. /** @hidden */
  2934. _lastControlDown: {
  2935. [pointerId: number]: Control;
  2936. };
  2937. /** @hidden */
  2938. _capturingControl: {
  2939. [pointerId: number]: Control;
  2940. };
  2941. /** @hidden */
  2942. _shouldBlockPointer: boolean;
  2943. /** @hidden */
  2944. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  2945. /** @hidden */
  2946. _linkedControls: Control[];
  2947. /**
  2948. * Gets or sets a boolean defining if alpha is stored as premultiplied
  2949. */
  2950. premulAlpha: boolean;
  2951. /**
  2952. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  2953. * Useful when you want more antialiasing
  2954. */
  2955. renderScale: number;
  2956. /** Gets or sets the background color */
  2957. background: string;
  2958. /**
  2959. * Gets or sets the ideal width used to design controls.
  2960. * The GUI will then rescale everything accordingly
  2961. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2962. */
  2963. idealWidth: number;
  2964. /**
  2965. * Gets or sets the ideal height used to design controls.
  2966. * The GUI will then rescale everything accordingly
  2967. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2968. */
  2969. idealHeight: number;
  2970. /**
  2971. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  2972. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2973. */
  2974. useSmallestIdeal: boolean;
  2975. /**
  2976. * Gets or sets a boolean indicating if adaptive scaling must be used
  2977. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  2978. */
  2979. renderAtIdealSize: boolean;
  2980. /**
  2981. * Gets the underlying layer used to render the texture when in fullscreen mode
  2982. */
  2983. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  2984. /**
  2985. * Gets the root container control
  2986. */
  2987. readonly rootContainer: Container;
  2988. /**
  2989. * Gets or sets the current focused control
  2990. */
  2991. focusedControl: BABYLON.Nullable<IFocusableControl>;
  2992. /**
  2993. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  2994. */
  2995. isForeground: boolean;
  2996. /**
  2997. * Creates a new AdvancedDynamicTexture
  2998. * @param name defines the name of the texture
  2999. * @param width defines the width of the texture
  3000. * @param height defines the height of the texture
  3001. * @param scene defines the hosting scene
  3002. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  3003. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  3004. */
  3005. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  3006. /**
  3007. * Function used to execute a function on all controls
  3008. * @param func defines the function to execute
  3009. * @param container defines the container where controls belong. If null the root container will be used
  3010. */
  3011. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  3012. /**
  3013. * Marks the texture as dirty forcing a complete update
  3014. */
  3015. markAsDirty(): void;
  3016. /**
  3017. * Helper function used to create a new style
  3018. * @returns a new style
  3019. * @see http://doc.babylonjs.com/how_to/gui#styles
  3020. */
  3021. createStyle(): Style;
  3022. /**
  3023. * Adds a new control to the root container
  3024. * @param control defines the control to add
  3025. * @returns the current texture
  3026. */
  3027. addControl(control: Control): AdvancedDynamicTexture;
  3028. /**
  3029. * Removes a control from the root container
  3030. * @param control defines the control to remove
  3031. * @returns the current texture
  3032. */
  3033. removeControl(control: Control): AdvancedDynamicTexture;
  3034. /**
  3035. * Release all resources
  3036. */
  3037. dispose(): void;
  3038. /** @hidden */
  3039. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  3040. /**
  3041. * Get screen coordinates for a vector3
  3042. * @param position defines the position to project
  3043. * @param worldMatrix defines the world matrix to use
  3044. * @returns the projected position
  3045. */
  3046. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  3047. /** @hidden */
  3048. _changeCursor(cursor: string): void;
  3049. /** @hidden */
  3050. _cleanControlAfterRemovalFromList(list: {
  3051. [pointerId: number]: Control;
  3052. }, control: Control): void;
  3053. /** @hidden */
  3054. _cleanControlAfterRemoval(control: Control): void;
  3055. /** Attach to all scene events required to support pointer events */
  3056. attach(): void;
  3057. /**
  3058. * Connect the texture to a hosting mesh to enable interactions
  3059. * @param mesh defines the mesh to attach to
  3060. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  3061. */
  3062. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  3063. /**
  3064. * Move the focus to a specific control
  3065. * @param control defines the control which will receive the focus
  3066. */
  3067. moveFocusToControl(control: IFocusableControl): void;
  3068. /**
  3069. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  3070. * @param mesh defines the mesh which will receive the texture
  3071. * @param width defines the texture width (1024 by default)
  3072. * @param height defines the texture height (1024 by default)
  3073. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  3074. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  3075. * @returns a new AdvancedDynamicTexture
  3076. */
  3077. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  3078. /**
  3079. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  3080. * In this mode the texture will rely on a layer for its rendering.
  3081. * This allows it to be treated like any other layer.
  3082. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  3083. * LayerMask is set through advancedTexture.layer.layerMask
  3084. * @param name defines name for the texture
  3085. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  3086. * @param scene defines the hsoting scene
  3087. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  3088. * @returns a new AdvancedDynamicTexture
  3089. */
  3090. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  3091. }
  3092. }
  3093. declare module BABYLON.GUI {
  3094. /**
  3095. * Class used to transport BABYLON.Vector2 information for pointer events
  3096. */
  3097. export class Vector2WithInfo extends BABYLON.Vector2 {
  3098. /** defines the current mouse button index */
  3099. buttonIndex: number;
  3100. /**
  3101. * Creates a new Vector2WithInfo
  3102. * @param source defines the vector2 data to transport
  3103. * @param buttonIndex defines the current mouse button index
  3104. */
  3105. constructor(source: BABYLON.Vector2,
  3106. /** defines the current mouse button index */
  3107. buttonIndex?: number);
  3108. }
  3109. /** Class used to provide 2D matrix features */
  3110. export class Matrix2D {
  3111. /** Gets the internal array of 6 floats used to store matrix data */
  3112. m: Float32Array;
  3113. /**
  3114. * Creates a new matrix
  3115. * @param m00 defines value for (0, 0)
  3116. * @param m01 defines value for (0, 1)
  3117. * @param m10 defines value for (1, 0)
  3118. * @param m11 defines value for (1, 1)
  3119. * @param m20 defines value for (2, 0)
  3120. * @param m21 defines value for (2, 1)
  3121. */
  3122. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  3123. /**
  3124. * Fills the matrix from direct values
  3125. * @param m00 defines value for (0, 0)
  3126. * @param m01 defines value for (0, 1)
  3127. * @param m10 defines value for (1, 0)
  3128. * @param m11 defines value for (1, 1)
  3129. * @param m20 defines value for (2, 0)
  3130. * @param m21 defines value for (2, 1)
  3131. * @returns the current modified matrix
  3132. */
  3133. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  3134. /**
  3135. * Gets matrix determinant
  3136. * @returns the determinant
  3137. */
  3138. determinant(): number;
  3139. /**
  3140. * Inverses the matrix and stores it in a target matrix
  3141. * @param result defines the target matrix
  3142. * @returns the current matrix
  3143. */
  3144. invertToRef(result: Matrix2D): Matrix2D;
  3145. /**
  3146. * Multiplies the current matrix with another one
  3147. * @param other defines the second operand
  3148. * @param result defines the target matrix
  3149. * @returns the current matrix
  3150. */
  3151. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  3152. /**
  3153. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  3154. * @param x defines the x coordinate to transform
  3155. * @param y defines the x coordinate to transform
  3156. * @param result defines the target vector2
  3157. * @returns the current matrix
  3158. */
  3159. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  3160. /**
  3161. * Creates an identity matrix
  3162. * @returns a new matrix
  3163. */
  3164. static Identity(): Matrix2D;
  3165. /**
  3166. * Creates a translation matrix and stores it in a target matrix
  3167. * @param x defines the x coordinate of the translation
  3168. * @param y defines the y coordinate of the translation
  3169. * @param result defines the target matrix
  3170. */
  3171. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  3172. /**
  3173. * Creates a scaling matrix and stores it in a target matrix
  3174. * @param x defines the x coordinate of the scaling
  3175. * @param y defines the y coordinate of the scaling
  3176. * @param result defines the target matrix
  3177. */
  3178. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  3179. /**
  3180. * Creates a rotation matrix and stores it in a target matrix
  3181. * @param angle defines the rotation angle
  3182. * @param result defines the target matrix
  3183. */
  3184. static RotationToRef(angle: number, result: Matrix2D): void;
  3185. /**
  3186. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  3187. * @param tx defines the x coordinate of the translation
  3188. * @param ty defines the y coordinate of the translation
  3189. * @param angle defines the rotation angle
  3190. * @param scaleX defines the x coordinate of the scaling
  3191. * @param scaleY defines the y coordinate of the scaling
  3192. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  3193. * @param result defines the target matrix
  3194. */
  3195. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  3196. }
  3197. }
  3198. declare module BABYLON.GUI {
  3199. /**
  3200. * Class used to store 2D control sizes
  3201. */
  3202. export class Measure {
  3203. /** defines left coordinate */
  3204. left: number;
  3205. /** defines top coordinate */
  3206. top: number;
  3207. /** defines width dimension */
  3208. width: number;
  3209. /** defines height dimension */
  3210. height: number;
  3211. /**
  3212. * Creates a new measure
  3213. * @param left defines left coordinate
  3214. * @param top defines top coordinate
  3215. * @param width defines width dimension
  3216. * @param height defines height dimension
  3217. */
  3218. constructor(
  3219. /** defines left coordinate */
  3220. left: number,
  3221. /** defines top coordinate */
  3222. top: number,
  3223. /** defines width dimension */
  3224. width: number,
  3225. /** defines height dimension */
  3226. height: number);
  3227. /**
  3228. * Copy from another measure
  3229. * @param other defines the other measure to copy from
  3230. */
  3231. copyFrom(other: Measure): void;
  3232. /**
  3233. * Copy from a group of 4 floats
  3234. * @param left defines left coordinate
  3235. * @param top defines top coordinate
  3236. * @param width defines width dimension
  3237. * @param height defines height dimension
  3238. */
  3239. copyFromFloats(left: number, top: number, width: number, height: number): void;
  3240. /**
  3241. * Check equality between this measure and another one
  3242. * @param other defines the other measures
  3243. * @returns true if both measures are equals
  3244. */
  3245. isEqualsTo(other: Measure): boolean;
  3246. /**
  3247. * Creates an empty measure
  3248. * @returns a new measure
  3249. */
  3250. static Empty(): Measure;
  3251. }
  3252. }
  3253. declare module BABYLON.GUI {
  3254. /**
  3255. * Class used to store a point for a MultiLine object.
  3256. * The point can be pure 2D coordinates, a mesh or a control
  3257. */
  3258. export class MultiLinePoint {
  3259. /** @hidden */
  3260. _point: BABYLON.Vector2;
  3261. /**
  3262. * Creates a new MultiLinePoint
  3263. * @param multiLine defines the source MultiLine object
  3264. */
  3265. constructor(multiLine: MultiLine);
  3266. /** Gets or sets x coordinate */
  3267. x: string | number;
  3268. /** Gets or sets y coordinate */
  3269. y: string | number;
  3270. /** Gets or sets the control associated with this point */
  3271. control: BABYLON.Nullable<Control>;
  3272. /** Gets or sets the mesh associated with this point */
  3273. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3274. /** Resets links */
  3275. resetLinks(): void;
  3276. /**
  3277. * Gets a translation vector
  3278. * @returns the translation vector
  3279. */
  3280. translate(): BABYLON.Vector2;
  3281. /** Release associated resources */
  3282. dispose(): void;
  3283. }
  3284. }
  3285. declare module BABYLON.GUI {
  3286. /**
  3287. * Define a style used by control to automatically setup properties based on a template.
  3288. * Only support font related properties so far
  3289. */
  3290. export class Style implements BABYLON.IDisposable {
  3291. /** @hidden */
  3292. _host: AdvancedDynamicTexture;
  3293. /** @hidden */
  3294. _fontSize: ValueAndUnit;
  3295. /**
  3296. * BABYLON.Observable raised when the style values are changed
  3297. */
  3298. onChangedObservable: BABYLON.Observable<Style>;
  3299. /**
  3300. * Creates a new style object
  3301. * @param host defines the AdvancedDynamicTexture which hosts this style
  3302. */
  3303. constructor(host: AdvancedDynamicTexture);
  3304. /**
  3305. * Gets or sets the font size
  3306. */
  3307. fontSize: string | number;
  3308. /**
  3309. * Gets or sets the font family
  3310. */
  3311. fontFamily: string;
  3312. /**
  3313. * Gets or sets the font style
  3314. */
  3315. fontStyle: string;
  3316. /** Gets or sets font weight */
  3317. fontWeight: string;
  3318. /** Dispose all associated resources */
  3319. dispose(): void;
  3320. }
  3321. }
  3322. declare module BABYLON.GUI {
  3323. /**
  3324. * Class used to specific a value and its associated unit
  3325. */
  3326. export class ValueAndUnit {
  3327. /** defines the unit to store */
  3328. unit: number;
  3329. /** defines a boolean indicating if the value can be negative */
  3330. negativeValueAllowed: boolean;
  3331. /**
  3332. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  3333. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3334. */
  3335. ignoreAdaptiveScaling: boolean;
  3336. /**
  3337. * Creates a new ValueAndUnit
  3338. * @param value defines the value to store
  3339. * @param unit defines the unit to store
  3340. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  3341. */
  3342. constructor(value: number,
  3343. /** defines the unit to store */
  3344. unit?: number,
  3345. /** defines a boolean indicating if the value can be negative */
  3346. negativeValueAllowed?: boolean);
  3347. /** Gets a boolean indicating if the value is a percentage */
  3348. readonly isPercentage: boolean;
  3349. /** Gets a boolean indicating if the value is store as pixel */
  3350. readonly isPixel: boolean;
  3351. /** Gets direct internal value */
  3352. readonly internalValue: number;
  3353. /**
  3354. * Gets value as pixel
  3355. * @param host defines the root host
  3356. * @param refValue defines the reference value for percentages
  3357. * @returns the value as pixel
  3358. */
  3359. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  3360. /**
  3361. * Gets the value accordingly to its unit
  3362. * @param host defines the root host
  3363. * @returns the value
  3364. */
  3365. getValue(host: AdvancedDynamicTexture): number;
  3366. /**
  3367. * Gets a string representation of the value
  3368. * @param host defines the root host
  3369. * @returns a string
  3370. */
  3371. toString(host: AdvancedDynamicTexture): string;
  3372. /**
  3373. * Store a value parsed from a string
  3374. * @param source defines the source string
  3375. * @returns true if the value was successfully parsed
  3376. */
  3377. fromString(source: string | number): boolean;
  3378. /** UNITMODE_PERCENTAGE */
  3379. static readonly UNITMODE_PERCENTAGE: number;
  3380. /** UNITMODE_PIXEL */
  3381. static readonly UNITMODE_PIXEL: number;
  3382. }
  3383. }
  3384. declare module BABYLON.GUI {
  3385. /**
  3386. * Class used to manage 3D user interface
  3387. * @see http://doc.babylonjs.com/how_to/gui3d
  3388. */
  3389. export class GUI3DManager implements BABYLON.IDisposable {
  3390. /** @hidden */
  3391. _lastPickedControl: Control3D;
  3392. /** @hidden */
  3393. _lastControlOver: {
  3394. [pointerId: number]: Control3D;
  3395. };
  3396. /** @hidden */
  3397. _lastControlDown: {
  3398. [pointerId: number]: Control3D;
  3399. };
  3400. /**
  3401. * BABYLON.Observable raised when the point picked by the pointer events changed
  3402. */
  3403. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3404. /** @hidden */
  3405. _sharedMaterials: {
  3406. [key: string]: BABYLON.Material;
  3407. };
  3408. /** Gets the hosting scene */
  3409. readonly scene: BABYLON.Scene;
  3410. /** Gets associated utility layer */
  3411. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3412. /**
  3413. * Creates a new GUI3DManager
  3414. * @param scene
  3415. */
  3416. constructor(scene?: BABYLON.Scene);
  3417. /**
  3418. * Gets the root container
  3419. */
  3420. readonly rootContainer: Container3D;
  3421. /**
  3422. * Gets a boolean indicating if the given control is in the root child list
  3423. * @param control defines the control to check
  3424. * @returns true if the control is in the root child list
  3425. */
  3426. containsControl(control: Control3D): boolean;
  3427. /**
  3428. * Adds a control to the root child list
  3429. * @param control defines the control to add
  3430. * @returns the current manager
  3431. */
  3432. addControl(control: Control3D): GUI3DManager;
  3433. /**
  3434. * Removes a control from the root child list
  3435. * @param control defines the control to remove
  3436. * @returns the current container
  3437. */
  3438. removeControl(control: Control3D): GUI3DManager;
  3439. /**
  3440. * Releases all associated resources
  3441. */
  3442. dispose(): void;
  3443. }
  3444. }
  3445. declare module BABYLON.GUI {
  3446. /**
  3447. * Class used to transport BABYLON.Vector3 information for pointer events
  3448. */
  3449. export class Vector3WithInfo extends BABYLON.Vector3 {
  3450. /** defines the current mouse button index */
  3451. buttonIndex: number;
  3452. /**
  3453. * Creates a new Vector3WithInfo
  3454. * @param source defines the vector3 data to transport
  3455. * @param buttonIndex defines the current mouse button index
  3456. */
  3457. constructor(source: BABYLON.Vector3,
  3458. /** defines the current mouse button index */
  3459. buttonIndex?: number);
  3460. }
  3461. }
  3462. declare module BABYLON.GUI {
  3463. /**
  3464. * Class used to create 2D buttons
  3465. */
  3466. export class Button extends Rectangle {
  3467. name?: string | undefined;
  3468. /**
  3469. * Function called to generate a pointer enter animation
  3470. */
  3471. pointerEnterAnimation: () => void;
  3472. /**
  3473. * Function called to generate a pointer out animation
  3474. */
  3475. pointerOutAnimation: () => void;
  3476. /**
  3477. * Function called to generate a pointer down animation
  3478. */
  3479. pointerDownAnimation: () => void;
  3480. /**
  3481. * Function called to generate a pointer up animation
  3482. */
  3483. pointerUpAnimation: () => void;
  3484. /**
  3485. * Returns the image part of the button (if any)
  3486. */
  3487. readonly image: BABYLON.Nullable<Image>;
  3488. /**
  3489. * Returns the image part of the button (if any)
  3490. */
  3491. readonly textBlock: BABYLON.Nullable<TextBlock>;
  3492. /**
  3493. * Creates a new Button
  3494. * @param name defines the name of the button
  3495. */
  3496. constructor(name?: string | undefined);
  3497. protected _getTypeName(): string;
  3498. /** @hidden */
  3499. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3500. /** @hidden */
  3501. _onPointerEnter(target: Control): boolean;
  3502. /** @hidden */
  3503. _onPointerOut(target: Control): void;
  3504. /** @hidden */
  3505. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3506. /** @hidden */
  3507. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3508. /**
  3509. * Creates a new button made with an image and a text
  3510. * @param name defines the name of the button
  3511. * @param text defines the text of the button
  3512. * @param imageUrl defines the url of the image
  3513. * @returns a new Button
  3514. */
  3515. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  3516. /**
  3517. * Creates a new button made with an image
  3518. * @param name defines the name of the button
  3519. * @param imageUrl defines the url of the image
  3520. * @returns a new Button
  3521. */
  3522. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  3523. /**
  3524. * Creates a new button made with a text
  3525. * @param name defines the name of the button
  3526. * @param text defines the text of the button
  3527. * @returns a new Button
  3528. */
  3529. static CreateSimpleButton(name: string, text: string): Button;
  3530. /**
  3531. * Creates a new button made with an image and a centered text
  3532. * @param name defines the name of the button
  3533. * @param text defines the text of the button
  3534. * @param imageUrl defines the url of the image
  3535. * @returns a new Button
  3536. */
  3537. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  3538. }
  3539. }
  3540. declare module BABYLON.GUI {
  3541. /**
  3542. * Class used to represent a 2D checkbox
  3543. */
  3544. export class Checkbox extends Control {
  3545. name?: string | undefined;
  3546. /** Gets or sets border thickness */
  3547. thickness: number;
  3548. /**
  3549. * BABYLON.Observable raised when isChecked property changes
  3550. */
  3551. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  3552. /** Gets or sets a value indicating the ratio between overall size and check size */
  3553. checkSizeRatio: number;
  3554. /** Gets or sets background color */
  3555. background: string;
  3556. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  3557. isChecked: boolean;
  3558. /**
  3559. * Creates a new CheckBox
  3560. * @param name defines the control name
  3561. */
  3562. constructor(name?: string | undefined);
  3563. protected _getTypeName(): string;
  3564. /** @hidden */
  3565. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3566. /** @hidden */
  3567. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3568. /**
  3569. * Utility function to easily create a checkbox with a header
  3570. * @param title defines the label to use for the header
  3571. * @param onValueChanged defines the callback to call when value changes
  3572. * @returns a StackPanel containing the checkbox and a textBlock
  3573. */
  3574. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  3575. }
  3576. }
  3577. declare module BABYLON.GUI {
  3578. /** Class used to create color pickers */
  3579. export class ColorPicker extends Control {
  3580. name?: string | undefined;
  3581. /**
  3582. * BABYLON.Observable raised when the value changes
  3583. */
  3584. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  3585. /** Gets or sets the color of the color picker */
  3586. value: BABYLON.Color3;
  3587. /** Gets or sets control width */
  3588. width: string | number;
  3589. /** Gets or sets control height */
  3590. height: string | number;
  3591. /** Gets or sets control size */
  3592. size: string | number;
  3593. /**
  3594. * Creates a new ColorPicker
  3595. * @param name defines the control name
  3596. */
  3597. constructor(name?: string | undefined);
  3598. protected _getTypeName(): string;
  3599. /** @hidden */
  3600. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3601. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3602. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3603. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3604. }
  3605. }
  3606. declare module BABYLON.GUI {
  3607. /**
  3608. * Root class for 2D containers
  3609. * @see http://doc.babylonjs.com/how_to/gui#containers
  3610. */
  3611. export class Container extends Control {
  3612. name?: string | undefined;
  3613. /** @hidden */
  3614. protected _children: Control[];
  3615. /** @hidden */
  3616. protected _measureForChildren: Measure;
  3617. /** @hidden */
  3618. protected _background: string;
  3619. /** @hidden */
  3620. protected _adaptWidthToChildren: boolean;
  3621. /** @hidden */
  3622. protected _adaptHeightToChildren: boolean;
  3623. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  3624. adaptHeightToChildren: boolean;
  3625. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  3626. adaptWidthToChildren: boolean;
  3627. /** Gets or sets background color */
  3628. background: string;
  3629. /** Gets the list of children */
  3630. readonly children: Control[];
  3631. /**
  3632. * Creates a new Container
  3633. * @param name defines the name of the container
  3634. */
  3635. constructor(name?: string | undefined);
  3636. protected _getTypeName(): string;
  3637. _flagDescendantsAsMatrixDirty(): void;
  3638. /**
  3639. * Gets a child using its name
  3640. * @param name defines the child name to look for
  3641. * @returns the child control if found
  3642. */
  3643. getChildByName(name: string): BABYLON.Nullable<Control>;
  3644. /**
  3645. * Gets a child using its type and its name
  3646. * @param name defines the child name to look for
  3647. * @param type defines the child type to look for
  3648. * @returns the child control if found
  3649. */
  3650. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  3651. /**
  3652. * Search for a specific control in children
  3653. * @param control defines the control to look for
  3654. * @returns true if the control is in child list
  3655. */
  3656. containsControl(control: Control): boolean;
  3657. /**
  3658. * Adds a new control to the current container
  3659. * @param control defines the control to add
  3660. * @returns the current container
  3661. */
  3662. addControl(control: BABYLON.Nullable<Control>): Container;
  3663. /**
  3664. * Removes all controls from the current container
  3665. * @returns the current container
  3666. */
  3667. clearControls(): Container;
  3668. /**
  3669. * Removes a control from the current container
  3670. * @param control defines the control to remove
  3671. * @returns the current container
  3672. */
  3673. removeControl(control: Control): Container;
  3674. /** @hidden */
  3675. _reOrderControl(control: Control): void;
  3676. /** @hidden */
  3677. _markAllAsDirty(): void;
  3678. /** @hidden */
  3679. protected _localDraw(context: CanvasRenderingContext2D): void;
  3680. /** @hidden */
  3681. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  3682. /** @hidden */
  3683. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3684. /** @hidden */
  3685. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3686. /** @hidden */
  3687. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  3688. /** @hidden */
  3689. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3690. /** Releases associated resources */
  3691. dispose(): void;
  3692. }
  3693. }
  3694. declare module BABYLON.GUI {
  3695. /**
  3696. * Root class used for all 2D controls
  3697. * @see http://doc.babylonjs.com/how_to/gui#controls
  3698. */
  3699. export class Control {
  3700. /** defines the name of the control */
  3701. name?: string | undefined;
  3702. /** @hidden */
  3703. _root: BABYLON.Nullable<Container>;
  3704. /** @hidden */
  3705. _host: AdvancedDynamicTexture;
  3706. /** Gets or sets the control parent */
  3707. parent: BABYLON.Nullable<Container>;
  3708. /** @hidden */
  3709. _currentMeasure: Measure;
  3710. /** @hidden */
  3711. _width: ValueAndUnit;
  3712. /** @hidden */
  3713. _height: ValueAndUnit;
  3714. /** @hidden */
  3715. protected _fontOffset: {
  3716. ascent: number;
  3717. height: number;
  3718. descent: number;
  3719. };
  3720. /** @hidden */
  3721. protected _horizontalAlignment: number;
  3722. /** @hidden */
  3723. protected _verticalAlignment: number;
  3724. /** @hidden */
  3725. _tempParentMeasure: Measure;
  3726. /** @hidden */
  3727. protected _cachedParentMeasure: Measure;
  3728. /** @hidden */
  3729. _left: ValueAndUnit;
  3730. /** @hidden */
  3731. _top: ValueAndUnit;
  3732. /** @hidden */
  3733. protected _invertTransformMatrix: Matrix2D;
  3734. /** @hidden */
  3735. protected _transformedPosition: BABYLON.Vector2;
  3736. /** @hidden */
  3737. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3738. protected _isEnabled: boolean;
  3739. protected _disabledColor: string;
  3740. /** @hidden */
  3741. _tag: any;
  3742. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  3743. isHitTestVisible: boolean;
  3744. /** Gets or sets a boolean indicating if the control can block pointer events */
  3745. isPointerBlocker: boolean;
  3746. /** Gets or sets a boolean indicating if the control can be focusable */
  3747. isFocusInvisible: boolean;
  3748. /** Gets or sets a boolean indicating if the children are clipped to the current control bounds */
  3749. clipChildren: boolean;
  3750. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  3751. shadowOffsetX: number;
  3752. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  3753. shadowOffsetY: number;
  3754. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  3755. shadowBlur: number;
  3756. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  3757. shadowColor: string;
  3758. /** Gets or sets the cursor to use when the control is hovered */
  3759. hoverCursor: string;
  3760. /** @hidden */
  3761. protected _linkOffsetX: ValueAndUnit;
  3762. /** @hidden */
  3763. protected _linkOffsetY: ValueAndUnit;
  3764. /** Gets the control type name */
  3765. readonly typeName: string;
  3766. /**
  3767. * An event triggered when the pointer move over the control.
  3768. */
  3769. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  3770. /**
  3771. * An event triggered when the pointer move out of the control.
  3772. */
  3773. onPointerOutObservable: BABYLON.Observable<Control>;
  3774. /**
  3775. * An event triggered when the pointer taps the control
  3776. */
  3777. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  3778. /**
  3779. * An event triggered when pointer up
  3780. */
  3781. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  3782. /**
  3783. * An event triggered when a control is clicked on
  3784. */
  3785. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  3786. /**
  3787. * An event triggered when pointer enters the control
  3788. */
  3789. onPointerEnterObservable: BABYLON.Observable<Control>;
  3790. /**
  3791. * An event triggered when the control is marked as dirty
  3792. */
  3793. onDirtyObservable: BABYLON.Observable<Control>;
  3794. /**
  3795. * An event triggered after the control is drawn
  3796. */
  3797. onAfterDrawObservable: BABYLON.Observable<Control>;
  3798. /** Gets or set information about font offsets (used to render and align text) */
  3799. fontOffset: {
  3800. ascent: number;
  3801. height: number;
  3802. descent: number;
  3803. };
  3804. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  3805. alpha: number;
  3806. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  3807. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3808. */
  3809. scaleX: number;
  3810. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  3811. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3812. */
  3813. scaleY: number;
  3814. /** Gets or sets the rotation angle (0 by default)
  3815. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3816. */
  3817. rotation: number;
  3818. /** Gets or sets the transformation center on Y axis (0 by default)
  3819. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3820. */
  3821. transformCenterY: number;
  3822. /** Gets or sets the transformation center on X axis (0 by default)
  3823. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  3824. */
  3825. transformCenterX: number;
  3826. /**
  3827. * Gets or sets the horizontal alignment
  3828. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3829. */
  3830. horizontalAlignment: number;
  3831. /**
  3832. * Gets or sets the vertical alignment
  3833. * @see http://doc.babylonjs.com/how_to/gui#alignments
  3834. */
  3835. verticalAlignment: number;
  3836. /**
  3837. * Gets or sets control width
  3838. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3839. */
  3840. width: string | number;
  3841. /**
  3842. * Gets control width in pixel
  3843. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3844. */
  3845. readonly widthInPixels: number;
  3846. /**
  3847. * Gets or sets control height
  3848. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3849. */
  3850. height: string | number;
  3851. /**
  3852. * Gets control height in pixel
  3853. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3854. */
  3855. readonly heightInPixels: number;
  3856. /** Gets or set font family */
  3857. fontFamily: string;
  3858. /** Gets or sets font style */
  3859. fontStyle: string;
  3860. /** Gets or sets font weight */
  3861. fontWeight: string;
  3862. /**
  3863. * Gets or sets style
  3864. * @see http://doc.babylonjs.com/how_to/gui#styles
  3865. */
  3866. style: BABYLON.Nullable<Style>;
  3867. /** @hidden */
  3868. readonly _isFontSizeInPercentage: boolean;
  3869. /** Gets font size in pixels */
  3870. readonly fontSizeInPixels: number;
  3871. /** Gets or sets font size */
  3872. fontSize: string | number;
  3873. /** Gets or sets foreground color */
  3874. color: string;
  3875. /** Gets or sets z index which is used to reorder controls on the z axis */
  3876. zIndex: number;
  3877. /** Gets or sets a boolean indicating if the control can be rendered */
  3878. notRenderable: boolean;
  3879. /** Gets or sets a boolean indicating if the control is visible */
  3880. isVisible: boolean;
  3881. /** Gets a boolean indicating that the control needs to update its rendering */
  3882. readonly isDirty: boolean;
  3883. /**
  3884. * Gets the current linked mesh (or null if none)
  3885. */
  3886. readonly linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3887. /**
  3888. * Gets or sets a value indicating the padding to use on the left of the control
  3889. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3890. */
  3891. paddingLeft: string | number;
  3892. /**
  3893. * Gets a value indicating the padding in pixels to use on the left of the control
  3894. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3895. */
  3896. readonly paddingLeftInPixels: number;
  3897. /**
  3898. * Gets or sets a value indicating the padding to use on the right of the control
  3899. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3900. */
  3901. paddingRight: string | number;
  3902. /**
  3903. * Gets a value indicating the padding in pixels to use on the right of the control
  3904. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3905. */
  3906. readonly paddingRightInPixels: number;
  3907. /**
  3908. * Gets or sets a value indicating the padding to use on the top of the control
  3909. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3910. */
  3911. paddingTop: string | number;
  3912. /**
  3913. * Gets a value indicating the padding in pixels to use on the top of the control
  3914. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3915. */
  3916. readonly paddingTopInPixels: number;
  3917. /**
  3918. * Gets or sets a value indicating the padding to use on the bottom of the control
  3919. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3920. */
  3921. paddingBottom: string | number;
  3922. /**
  3923. * Gets a value indicating the padding in pixels to use on the bottom of the control
  3924. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3925. */
  3926. readonly paddingBottomInPixels: number;
  3927. /**
  3928. * Gets or sets a value indicating the left coordinate of the control
  3929. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3930. */
  3931. left: string | number;
  3932. /**
  3933. * Gets a value indicating the left coordinate in pixels of the control
  3934. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3935. */
  3936. readonly leftInPixels: number;
  3937. /**
  3938. * Gets or sets a value indicating the top coordinate of the control
  3939. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3940. */
  3941. top: string | number;
  3942. /**
  3943. * Gets a value indicating the top coordinate in pixels of the control
  3944. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3945. */
  3946. readonly topInPixels: number;
  3947. /**
  3948. * Gets or sets a value indicating the offset on X axis to the linked mesh
  3949. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3950. */
  3951. linkOffsetX: string | number;
  3952. /**
  3953. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  3954. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3955. */
  3956. readonly linkOffsetXInPixels: number;
  3957. /**
  3958. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  3959. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3960. */
  3961. linkOffsetY: string | number;
  3962. /**
  3963. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  3964. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  3965. */
  3966. readonly linkOffsetYInPixels: number;
  3967. /** Gets the center coordinate on X axis */
  3968. readonly centerX: number;
  3969. /** Gets the center coordinate on Y axis */
  3970. readonly centerY: number;
  3971. /** Gets or sets if control is Enabled*/
  3972. isEnabled: boolean;
  3973. /** Gets or sets background color of control if it's disabled*/
  3974. disabledColor: string;
  3975. /**
  3976. * Creates a new control
  3977. * @param name defines the name of the control
  3978. */
  3979. constructor(
  3980. /** defines the name of the control */
  3981. name?: string | undefined);
  3982. /** @hidden */
  3983. protected _getTypeName(): string;
  3984. /** @hidden */
  3985. _resetFontCache(): void;
  3986. /**
  3987. * Determines if a container is an ascendant of the current control
  3988. * @param container defines the container to look for
  3989. * @returns true if the container is one of the ascendant of the control
  3990. */
  3991. isAscendant(container: Control): boolean;
  3992. /**
  3993. * Gets coordinates in local control space
  3994. * @param globalCoordinates defines the coordinates to transform
  3995. * @returns the new coordinates in local space
  3996. */
  3997. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  3998. /**
  3999. * Gets coordinates in local control space
  4000. * @param globalCoordinates defines the coordinates to transform
  4001. * @param result defines the target vector2 where to store the result
  4002. * @returns the current control
  4003. */
  4004. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  4005. /**
  4006. * Gets coordinates in parent local control space
  4007. * @param globalCoordinates defines the coordinates to transform
  4008. * @returns the new coordinates in parent local space
  4009. */
  4010. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  4011. /**
  4012. * Move the current control to a vector3 position projected onto the screen.
  4013. * @param position defines the target position
  4014. * @param scene defines the hosting scene
  4015. */
  4016. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  4017. /**
  4018. * Link current control with a target mesh
  4019. * @param mesh defines the mesh to link with
  4020. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4021. */
  4022. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  4023. /** @hidden */
  4024. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  4025. /** @hidden */
  4026. _markMatrixAsDirty(): void;
  4027. /** @hidden */
  4028. _flagDescendantsAsMatrixDirty(): void;
  4029. /** @hidden */
  4030. _markAsDirty(force?: boolean): void;
  4031. /** @hidden */
  4032. _markAllAsDirty(): void;
  4033. /** @hidden */
  4034. _link(root: BABYLON.Nullable<Container>, host: AdvancedDynamicTexture): void;
  4035. /** @hidden */
  4036. protected _transform(context: CanvasRenderingContext2D): void;
  4037. /** @hidden */
  4038. protected _applyStates(context: CanvasRenderingContext2D): void;
  4039. /** @hidden */
  4040. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  4041. /** @hidden */
  4042. protected _clip(context: CanvasRenderingContext2D): void;
  4043. /** @hidden */
  4044. _measure(): void;
  4045. /** @hidden */
  4046. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4047. /** @hidden */
  4048. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4049. /** @hidden */
  4050. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4051. /** @hidden */
  4052. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4053. /**
  4054. * Tests if a given coordinates belong to the current control
  4055. * @param x defines x coordinate to test
  4056. * @param y defines y coordinate to test
  4057. * @returns true if the coordinates are inside the control
  4058. */
  4059. contains(x: number, y: number): boolean;
  4060. /** @hidden */
  4061. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  4062. /** @hidden */
  4063. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4064. /** @hidden */
  4065. _onPointerEnter(target: Control): boolean;
  4066. /** @hidden */
  4067. _onPointerOut(target: Control): void;
  4068. /** @hidden */
  4069. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4070. /** @hidden */
  4071. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4072. /** @hidden */
  4073. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  4074. /** @hidden */
  4075. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  4076. /** Releases associated resources */
  4077. dispose(): void;
  4078. /** HORIZONTAL_ALIGNMENT_LEFT */
  4079. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  4080. /** HORIZONTAL_ALIGNMENT_RIGHT */
  4081. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  4082. /** HORIZONTAL_ALIGNMENT_CENTER */
  4083. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  4084. /** VERTICAL_ALIGNMENT_TOP */
  4085. static readonly VERTICAL_ALIGNMENT_TOP: number;
  4086. /** VERTICAL_ALIGNMENT_BOTTOM */
  4087. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  4088. /** VERTICAL_ALIGNMENT_CENTER */
  4089. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  4090. /** @hidden */
  4091. static _GetFontOffset(font: string): {
  4092. ascent: number;
  4093. height: number;
  4094. descent: number;
  4095. };
  4096. /**
  4097. * Creates a stack panel that can be used to render headers
  4098. * @param control defines the control to associate with the header
  4099. * @param text defines the text of the header
  4100. * @param size defines the size of the header
  4101. * @param options defines options used to configure the header
  4102. * @returns a new StackPanel
  4103. * @ignore
  4104. * @hidden
  4105. */
  4106. static AddHeader: (control: Control, text: string, size: string | number, options: {
  4107. isHorizontal: boolean;
  4108. controlFirst: boolean;
  4109. }) => any;
  4110. /** @hidden */
  4111. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  4112. }
  4113. }
  4114. declare module BABYLON.GUI {
  4115. /** Class used to create 2D ellipse containers */
  4116. export class Ellipse extends Container {
  4117. name?: string | undefined;
  4118. /** Gets or sets border thickness */
  4119. thickness: number;
  4120. /**
  4121. * Creates a new Ellipse
  4122. * @param name defines the control name
  4123. */
  4124. constructor(name?: string | undefined);
  4125. protected _getTypeName(): string;
  4126. protected _localDraw(context: CanvasRenderingContext2D): void;
  4127. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4128. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4129. }
  4130. }
  4131. declare module BABYLON.GUI {
  4132. /**
  4133. * Class used to create a 2D grid container
  4134. */
  4135. export class Grid extends Container {
  4136. name?: string | undefined;
  4137. /**
  4138. * Gets the number of columns
  4139. */
  4140. readonly columnCount: number;
  4141. /**
  4142. * Gets the number of rows
  4143. */
  4144. readonly rowCount: number;
  4145. /** Gets the list of children */
  4146. readonly children: Control[];
  4147. /**
  4148. * Adds a new row to the grid
  4149. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4150. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  4151. * @returns the current grid
  4152. */
  4153. addRowDefinition(height: number, isPixel?: boolean): Grid;
  4154. /**
  4155. * Adds a new column to the grid
  4156. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4157. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4158. * @returns the current grid
  4159. */
  4160. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  4161. /**
  4162. * Update a row definition
  4163. * @param index defines the index of the row to update
  4164. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4165. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  4166. * @returns the current grid
  4167. */
  4168. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  4169. /**
  4170. * Update a column definition
  4171. * @param index defines the index of the column to update
  4172. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4173. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4174. * @returns the current grid
  4175. */
  4176. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  4177. /**
  4178. * Gets the list of children stored in a specific cell
  4179. * @param row defines the row to check
  4180. * @param column defines the column to check
  4181. * @returns the list of controls
  4182. */
  4183. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  4184. /**
  4185. * Remove a column definition at specified index
  4186. * @param index defines the index of the column to remove
  4187. * @returns the current grid
  4188. */
  4189. removeColumnDefinition(index: number): Grid;
  4190. /**
  4191. * Remove a row definition at specified index
  4192. * @param index defines the index of the row to remove
  4193. * @returns the current grid
  4194. */
  4195. removeRowDefinition(index: number): Grid;
  4196. /**
  4197. * Adds a new control to the current grid
  4198. * @param control defines the control to add
  4199. * @param row defines the row where to add the control (0 by default)
  4200. * @param column defines the column where to add the control (0 by default)
  4201. * @returns the current grid
  4202. */
  4203. addControl(control: Control, row?: number, column?: number): Grid;
  4204. /**
  4205. * Removes a control from the current container
  4206. * @param control defines the control to remove
  4207. * @returns the current container
  4208. */
  4209. removeControl(control: Control): Container;
  4210. /**
  4211. * Creates a new Grid
  4212. * @param name defines control name
  4213. */
  4214. constructor(name?: string | undefined);
  4215. protected _getTypeName(): string;
  4216. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4217. /** Releases associated resources */
  4218. dispose(): void;
  4219. }
  4220. }
  4221. declare module BABYLON.GUI {
  4222. /**
  4223. * Class used to create 2D images
  4224. */
  4225. export class Image extends Control {
  4226. name?: string | undefined;
  4227. /**
  4228. * BABYLON.Observable notified when the content is loaded
  4229. */
  4230. onImageLoadedObservable: BABYLON.Observable<Image>;
  4231. /**
  4232. * Gets a boolean indicating that the content is loaded
  4233. */
  4234. readonly isLoaded: boolean;
  4235. /**
  4236. * Gets or sets the left coordinate in the source image
  4237. */
  4238. sourceLeft: number;
  4239. /**
  4240. * Gets or sets the top coordinate in the source image
  4241. */
  4242. sourceTop: number;
  4243. /**
  4244. * Gets or sets the width to capture in the source image
  4245. */
  4246. sourceWidth: number;
  4247. /**
  4248. * Gets or sets the height to capture in the source image
  4249. */
  4250. sourceHeight: number;
  4251. /**
  4252. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  4253. * @see http://doc.babylonjs.com/how_to/gui#image
  4254. */
  4255. autoScale: boolean;
  4256. /** Gets or sets the streching mode used by the image */
  4257. stretch: number;
  4258. /**
  4259. * Gets or sets the internal DOM image used to render the control
  4260. */
  4261. domImage: HTMLImageElement;
  4262. /**
  4263. * Gets or sets image source url
  4264. */
  4265. source: BABYLON.Nullable<string>;
  4266. /**
  4267. * Gets or sets the cell width to use when animation sheet is enabled
  4268. * @see http://doc.babylonjs.com/how_to/gui#image
  4269. */
  4270. cellWidth: number;
  4271. /**
  4272. * Gets or sets the cell height to use when animation sheet is enabled
  4273. * @see http://doc.babylonjs.com/how_to/gui#image
  4274. */
  4275. cellHeight: number;
  4276. /**
  4277. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  4278. * @see http://doc.babylonjs.com/how_to/gui#image
  4279. */
  4280. cellId: number;
  4281. /**
  4282. * Creates a new Image
  4283. * @param name defines the control name
  4284. * @param url defines the image url
  4285. */
  4286. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  4287. protected _getTypeName(): string;
  4288. /** Force the control to synchronize with its content */
  4289. synchronizeSizeWithContent(): void;
  4290. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4291. dispose(): void;
  4292. /** STRETCH_NONE */
  4293. static readonly STRETCH_NONE: number;
  4294. /** STRETCH_FILL */
  4295. static readonly STRETCH_FILL: number;
  4296. /** STRETCH_UNIFORM */
  4297. static readonly STRETCH_UNIFORM: number;
  4298. /** STRETCH_EXTEND */
  4299. static readonly STRETCH_EXTEND: number;
  4300. }
  4301. }
  4302. declare module BABYLON.GUI {
  4303. /**
  4304. * Class used to create input text control
  4305. */
  4306. export class InputText extends Control implements IFocusableControl {
  4307. name?: string | undefined;
  4308. /** @hidden */
  4309. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  4310. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  4311. promptMessage: string;
  4312. /** BABYLON.Observable raised when the text changes */
  4313. onTextChangedObservable: BABYLON.Observable<InputText>;
  4314. /** BABYLON.Observable raised just before an entered character is to be added */
  4315. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  4316. /** BABYLON.Observable raised when the control gets the focus */
  4317. onFocusObservable: BABYLON.Observable<InputText>;
  4318. /** BABYLON.Observable raised when the control loses the focus */
  4319. onBlurObservable: BABYLON.Observable<InputText>;
  4320. /** Gets or sets the maximum width allowed by the control */
  4321. maxWidth: string | number;
  4322. /** Gets the maximum width allowed by the control in pixels */
  4323. readonly maxWidthInPixels: number;
  4324. /** Gets or sets control margin */
  4325. margin: string;
  4326. /** Gets control margin in pixels */
  4327. readonly marginInPixels: number;
  4328. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  4329. autoStretchWidth: boolean;
  4330. /** Gets or sets border thickness */
  4331. thickness: number;
  4332. /** Gets or sets the background color when focused */
  4333. focusedBackground: string;
  4334. /** Gets or sets the background color */
  4335. background: string;
  4336. /** Gets or sets the placeholder color */
  4337. placeholderColor: string;
  4338. /** Gets or sets the text displayed when the control is empty */
  4339. placeholderText: string;
  4340. /** Gets or sets the dead key flag */
  4341. deadKey: boolean;
  4342. /** Gets or sets if the current key should be added */
  4343. addKey: boolean;
  4344. /** Gets or sets the value of the current key being entered */
  4345. currentKey: string;
  4346. /** Gets or sets the text displayed in the control */
  4347. text: string;
  4348. /** Gets or sets control width */
  4349. width: string | number;
  4350. /**
  4351. * Creates a new InputText
  4352. * @param name defines the control name
  4353. * @param text defines the text of the control
  4354. */
  4355. constructor(name?: string | undefined, text?: string);
  4356. /** @hidden */
  4357. onBlur(): void;
  4358. /** @hidden */
  4359. onFocus(): void;
  4360. protected _getTypeName(): string;
  4361. /**
  4362. * Function called to get the list of controls that should not steal the focus from this control
  4363. * @returns an array of controls
  4364. */
  4365. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  4366. /** @hidden */
  4367. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  4368. /** @hidden */
  4369. processKeyboard(evt: KeyboardEvent): void;
  4370. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4371. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4372. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4373. protected _beforeRenderText(text: string): string;
  4374. dispose(): void;
  4375. }
  4376. }
  4377. declare module BABYLON.GUI {
  4378. /**
  4379. * Class used to create a password control
  4380. */
  4381. export class InputPassword extends InputText {
  4382. protected _beforeRenderText(text: string): string;
  4383. }
  4384. }
  4385. declare module BABYLON.GUI {
  4386. /** Class used to render 2D lines */
  4387. export class Line extends Control {
  4388. name?: string | undefined;
  4389. /** Gets or sets the dash pattern */
  4390. dash: Array<number>;
  4391. /** Gets or sets the control connected with the line end */
  4392. connectedControl: Control;
  4393. /** Gets or sets start coordinates on X axis */
  4394. x1: string | number;
  4395. /** Gets or sets start coordinates on Y axis */
  4396. y1: string | number;
  4397. /** Gets or sets end coordinates on X axis */
  4398. x2: string | number;
  4399. /** Gets or sets end coordinates on Y axis */
  4400. y2: string | number;
  4401. /** Gets or sets line width */
  4402. lineWidth: number;
  4403. /** Gets or sets horizontal alignment */
  4404. horizontalAlignment: number;
  4405. /** Gets or sets vertical alignment */
  4406. verticalAlignment: number;
  4407. /**
  4408. * Creates a new Line
  4409. * @param name defines the control name
  4410. */
  4411. constructor(name?: string | undefined);
  4412. protected _getTypeName(): string;
  4413. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4414. _measure(): void;
  4415. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4416. /**
  4417. * Move one end of the line given 3D cartesian coordinates.
  4418. * @param position Targeted world position
  4419. * @param scene BABYLON.Scene
  4420. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4421. */
  4422. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  4423. /**
  4424. * Move one end of the line to a position in screen absolute space.
  4425. * @param projectedPosition Position in screen absolute space (X, Y)
  4426. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4427. */
  4428. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  4429. }
  4430. }
  4431. declare module BABYLON.GUI {
  4432. /**
  4433. * Class used to create multi line control
  4434. */
  4435. export class MultiLine extends Control {
  4436. name?: string | undefined;
  4437. /**
  4438. * Creates a new MultiLine
  4439. * @param name defines the control name
  4440. */
  4441. constructor(name?: string | undefined);
  4442. /** Gets or sets dash pattern */
  4443. dash: Array<number>;
  4444. /**
  4445. * Gets point stored at specified index
  4446. * @param index defines the index to look for
  4447. * @returns the requested point if found
  4448. */
  4449. getAt(index: number): MultiLinePoint;
  4450. /** Function called when a point is updated */
  4451. onPointUpdate: () => void;
  4452. /**
  4453. * Adds new points to the point collection
  4454. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  4455. * @returns the list of created MultiLinePoint
  4456. */
  4457. add(...items: (AbstractMesh | Control | {
  4458. x: string | number;
  4459. y: string | number;
  4460. })[]): MultiLinePoint[];
  4461. /**
  4462. * Adds a new point to the point collection
  4463. * @param item defines the item (mesh, control or 2d coordiantes) to add
  4464. * @returns the created MultiLinePoint
  4465. */
  4466. push(item?: (AbstractMesh | Control | {
  4467. x: string | number;
  4468. y: string | number;
  4469. })): MultiLinePoint;
  4470. /**
  4471. * Remove a specific value or point from the active point collection
  4472. * @param value defines the value or point to remove
  4473. */
  4474. remove(value: number | MultiLinePoint): void;
  4475. /**
  4476. * Resets this object to initial state (no point)
  4477. */
  4478. reset(): void;
  4479. /**
  4480. * Resets all links
  4481. */
  4482. resetLinks(): void;
  4483. /** Gets or sets line width */
  4484. lineWidth: number;
  4485. horizontalAlignment: number;
  4486. verticalAlignment: number;
  4487. protected _getTypeName(): string;
  4488. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4489. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4490. _measure(): void;
  4491. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4492. dispose(): void;
  4493. }
  4494. }
  4495. declare module BABYLON.GUI {
  4496. /**
  4497. * Class used to create radio button controls
  4498. */
  4499. export class RadioButton extends Control {
  4500. name?: string | undefined;
  4501. /** Gets or sets border thickness */
  4502. thickness: number;
  4503. /** Gets or sets group name */
  4504. group: string;
  4505. /** BABYLON.Observable raised when isChecked is changed */
  4506. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  4507. /** Gets or sets a value indicating the ratio between overall size and check size */
  4508. checkSizeRatio: number;
  4509. /** Gets or sets background color */
  4510. background: string;
  4511. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  4512. isChecked: boolean;
  4513. /**
  4514. * Creates a new RadioButton
  4515. * @param name defines the control name
  4516. */
  4517. constructor(name?: string | undefined);
  4518. protected _getTypeName(): string;
  4519. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4520. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4521. /**
  4522. * Utility function to easily create a radio button with a header
  4523. * @param title defines the label to use for the header
  4524. * @param group defines the group to use for the radio button
  4525. * @param isChecked defines the initial state of the radio button
  4526. * @param onValueChanged defines the callback to call when value changes
  4527. * @returns a StackPanel containing the radio button and a textBlock
  4528. */
  4529. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  4530. }
  4531. }
  4532. declare module BABYLON.GUI {
  4533. /**
  4534. * Class used to create a 2D stack panel container
  4535. */
  4536. export class StackPanel extends Container {
  4537. name?: string | undefined;
  4538. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  4539. isVertical: boolean;
  4540. /**
  4541. * Gets or sets panel width.
  4542. * This value should not be set when in horizontal mode as it will be computed automatically
  4543. */
  4544. width: string | number;
  4545. /**
  4546. * Gets or sets panel height.
  4547. * This value should not be set when in vertical mode as it will be computed automatically
  4548. */
  4549. height: string | number;
  4550. /**
  4551. * Creates a new StackPanel
  4552. * @param name defines control name
  4553. */
  4554. constructor(name?: string | undefined);
  4555. protected _getTypeName(): string;
  4556. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4557. }
  4558. }
  4559. declare module BABYLON.GUI {
  4560. /** Class used to create a RadioGroup
  4561. * which contains groups of radio buttons
  4562. */
  4563. export class SelectorGroup {
  4564. /** name of SelectorGroup */
  4565. name: string;
  4566. /**
  4567. * Creates a new SelectorGroup
  4568. * @param name of group, used as a group heading
  4569. */
  4570. constructor(
  4571. /** name of SelectorGroup */
  4572. name: string);
  4573. /** Gets the groupPanel of the SelectorGroup */
  4574. readonly groupPanel: StackPanel;
  4575. /** Gets the selectors array */
  4576. readonly selectors: StackPanel[];
  4577. /** Gets and sets the group header */
  4578. header: string;
  4579. /** @hidden*/
  4580. _getSelector(selectorNb: number): StackPanel | undefined;
  4581. /** Removes the selector at the given position
  4582. * @param selectorNb the position of the selector within the group
  4583. */
  4584. removeSelector(selectorNb: number): void;
  4585. }
  4586. /** Class used to create a CheckboxGroup
  4587. * which contains groups of checkbox buttons
  4588. */
  4589. export class CheckboxGroup extends SelectorGroup {
  4590. /** Adds a checkbox as a control
  4591. * @param text is the label for the selector
  4592. * @param func is the function called when the Selector is checked
  4593. * @param checked is true when Selector is checked
  4594. */
  4595. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  4596. /** @hidden */
  4597. _setSelectorLabel(selectorNb: number, label: string): void;
  4598. /** @hidden */
  4599. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4600. /** @hidden */
  4601. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4602. /** @hidden */
  4603. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4604. }
  4605. /** Class used to create a RadioGroup
  4606. * which contains groups of radio buttons
  4607. */
  4608. export class RadioGroup extends SelectorGroup {
  4609. /** Adds a radio button as a control
  4610. * @param label is the label for the selector
  4611. * @param func is the function called when the Selector is checked
  4612. * @param checked is true when Selector is checked
  4613. */
  4614. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  4615. /** @hidden */
  4616. _setSelectorLabel(selectorNb: number, label: string): void;
  4617. /** @hidden */
  4618. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4619. /** @hidden */
  4620. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4621. /** @hidden */
  4622. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4623. }
  4624. /** Class used to create a SliderGroup
  4625. * which contains groups of slider buttons
  4626. */
  4627. export class SliderGroup extends SelectorGroup {
  4628. /**
  4629. * Adds a slider to the SelectorGroup
  4630. * @param label is the label for the SliderBar
  4631. * @param func is the function called when the Slider moves
  4632. * @param unit is a string describing the units used, eg degrees or metres
  4633. * @param min is the minimum value for the Slider
  4634. * @param max is the maximum value for the Slider
  4635. * @param value is the start value for the Slider between min and max
  4636. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  4637. */
  4638. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  4639. /** @hidden */
  4640. _setSelectorLabel(selectorNb: number, label: string): void;
  4641. /** @hidden */
  4642. _setSelectorLabelColor(selectorNb: number, color: string): void;
  4643. /** @hidden */
  4644. _setSelectorButtonColor(selectorNb: number, color: string): void;
  4645. /** @hidden */
  4646. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  4647. }
  4648. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  4649. * @see http://doc.babylonjs.com/how_to/selector
  4650. */
  4651. export class SelectionPanel extends Rectangle {
  4652. /** name of SelectionPanel */
  4653. name: string;
  4654. /** an array of SelectionGroups */
  4655. groups: SelectorGroup[];
  4656. /**
  4657. * Creates a new SelectionPanel
  4658. * @param name of SelectionPanel
  4659. * @param groups is an array of SelectionGroups
  4660. */
  4661. constructor(
  4662. /** name of SelectionPanel */
  4663. name: string,
  4664. /** an array of SelectionGroups */
  4665. groups?: SelectorGroup[]);
  4666. protected _getTypeName(): string;
  4667. /** Gets or sets the headerColor */
  4668. headerColor: string;
  4669. /** Gets or sets the button color */
  4670. buttonColor: string;
  4671. /** Gets or sets the label color */
  4672. labelColor: string;
  4673. /** Gets or sets the button background */
  4674. buttonBackground: string;
  4675. /** Gets or sets the color of separator bar */
  4676. barColor: string;
  4677. /** Gets or sets the height of separator bar */
  4678. barHeight: string;
  4679. /** Gets or sets the height of spacers*/
  4680. spacerHeight: string;
  4681. /** Add a group to the selection panel
  4682. * @param group is the selector group to add
  4683. */
  4684. addGroup(group: SelectorGroup): void;
  4685. /** Remove the group from the given position
  4686. * @param groupNb is the position of the group in the list
  4687. */
  4688. removeGroup(groupNb: number): void;
  4689. /** Change a group header label
  4690. * @param label is the new group header label
  4691. * @param groupNb is the number of the group to relabel
  4692. * */
  4693. setHeaderName(label: string, groupNb: number): void;
  4694. /** Change selector label to the one given
  4695. * @param label is the new selector label
  4696. * @param groupNb is the number of the groupcontaining the selector
  4697. * @param selectorNb is the number of the selector within a group to relabel
  4698. * */
  4699. relabel(label: string, groupNb: number, selectorNb: number): void;
  4700. /** For a given group position remove the selector at the given position
  4701. * @param groupNb is the number of the group to remove the selector from
  4702. * @param selectorNb is the number of the selector within the group
  4703. */
  4704. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  4705. /** For a given group position of correct type add a checkbox button
  4706. * @param groupNb is the number of the group to remove the selector from
  4707. * @param label is the label for the selector
  4708. * @param func is the function called when the Selector is checked
  4709. * @param checked is true when Selector is checked
  4710. */
  4711. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  4712. /** For a given group position of correct type add a radio button
  4713. * @param groupNb is the number of the group to remove the selector from
  4714. * @param label is the label for the selector
  4715. * @param func is the function called when the Selector is checked
  4716. * @param checked is true when Selector is checked
  4717. */
  4718. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  4719. /**
  4720. * For a given slider group add a slider
  4721. * @param groupNb is the number of the group to add the slider to
  4722. * @param label is the label for the Slider
  4723. * @param func is the function called when the Slider moves
  4724. * @param unit is a string describing the units used, eg degrees or metres
  4725. * @param min is the minimum value for the Slider
  4726. * @param max is the maximum value for the Slider
  4727. * @param value is the start value for the Slider between min and max
  4728. * @param onVal is the function used to format the value displayed, eg radians to degrees
  4729. */
  4730. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  4731. }
  4732. }
  4733. declare module BABYLON.GUI {
  4734. /**
  4735. * Enum that determines the text-wrapping mode to use.
  4736. */
  4737. export enum TextWrapping {
  4738. /**
  4739. * Clip the text when it's larger than Control.width; this is the default mode.
  4740. */
  4741. Clip = 0,
  4742. /**
  4743. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  4744. */
  4745. WordWrap = 1,
  4746. /**
  4747. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  4748. */
  4749. Ellipsis = 2
  4750. }
  4751. /**
  4752. * Class used to create text block control
  4753. */
  4754. export class TextBlock extends Control {
  4755. /**
  4756. * Defines the name of the control
  4757. */
  4758. name?: string | undefined;
  4759. /**
  4760. * An event triggered after the text is changed
  4761. */
  4762. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  4763. /**
  4764. * An event triggered after the text was broken up into lines
  4765. */
  4766. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  4767. /**
  4768. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  4769. */
  4770. readonly lines: any[];
  4771. /**
  4772. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  4773. */
  4774. resizeToFit: boolean;
  4775. /**
  4776. * Gets or sets a boolean indicating if text must be wrapped
  4777. */
  4778. textWrapping: TextWrapping | boolean;
  4779. /**
  4780. * Gets or sets text to display
  4781. */
  4782. text: string;
  4783. /**
  4784. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  4785. */
  4786. textHorizontalAlignment: number;
  4787. /**
  4788. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  4789. */
  4790. textVerticalAlignment: number;
  4791. /**
  4792. * Gets or sets line spacing value
  4793. */
  4794. lineSpacing: string | number;
  4795. /**
  4796. * Gets or sets outlineWidth of the text to display
  4797. */
  4798. outlineWidth: number;
  4799. /**
  4800. * Gets or sets outlineColor of the text to display
  4801. */
  4802. outlineColor: string;
  4803. /**
  4804. * Creates a new TextBlock object
  4805. * @param name defines the name of the control
  4806. * @param text defines the text to display (emptry string by default)
  4807. */
  4808. constructor(
  4809. /**
  4810. * Defines the name of the control
  4811. */
  4812. name?: string | undefined, text?: string);
  4813. protected _getTypeName(): string;
  4814. /** @hidden */
  4815. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4816. protected _applyStates(context: CanvasRenderingContext2D): void;
  4817. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4818. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  4819. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  4820. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  4821. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  4822. protected _renderLines(context: CanvasRenderingContext2D): void;
  4823. /**
  4824. * Given a width constraint applied on the text block, find the expected height
  4825. * @returns expected height
  4826. */
  4827. computeExpectedHeight(): number;
  4828. dispose(): void;
  4829. }
  4830. }
  4831. declare module BABYLON.GUI {
  4832. /**
  4833. * Class used to store key control properties
  4834. */
  4835. export class KeyPropertySet {
  4836. /** Width */
  4837. width?: string;
  4838. /** Height */
  4839. height?: string;
  4840. /** Left padding */
  4841. paddingLeft?: string;
  4842. /** Right padding */
  4843. paddingRight?: string;
  4844. /** Top padding */
  4845. paddingTop?: string;
  4846. /** Bottom padding */
  4847. paddingBottom?: string;
  4848. /** Foreground color */
  4849. color?: string;
  4850. /** Background color */
  4851. background?: string;
  4852. }
  4853. /**
  4854. * Class used to create virtual keyboard
  4855. */
  4856. export class VirtualKeyboard extends StackPanel {
  4857. /** BABYLON.Observable raised when a key is pressed */
  4858. onKeyPressObservable: BABYLON.Observable<string>;
  4859. /** Gets or sets default key button width */
  4860. defaultButtonWidth: string;
  4861. /** Gets or sets default key button height */
  4862. defaultButtonHeight: string;
  4863. /** Gets or sets default key button left padding */
  4864. defaultButtonPaddingLeft: string;
  4865. /** Gets or sets default key button right padding */
  4866. defaultButtonPaddingRight: string;
  4867. /** Gets or sets default key button top padding */
  4868. defaultButtonPaddingTop: string;
  4869. /** Gets or sets default key button bottom padding */
  4870. defaultButtonPaddingBottom: string;
  4871. /** Gets or sets default key button foreground color */
  4872. defaultButtonColor: string;
  4873. /** Gets or sets default key button background color */
  4874. defaultButtonBackground: string;
  4875. /** Gets or sets shift button foreground color */
  4876. shiftButtonColor: string;
  4877. /** Gets or sets shift button thickness*/
  4878. selectedShiftThickness: number;
  4879. /** Gets shift key state */
  4880. shiftState: number;
  4881. protected _getTypeName(): string;
  4882. /**
  4883. * Adds a new row of keys
  4884. * @param keys defines the list of keys to add
  4885. * @param propertySets defines the associated property sets
  4886. */
  4887. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  4888. /**
  4889. * Set the shift key to a specific state
  4890. * @param shiftState defines the new shift state
  4891. */
  4892. applyShiftState(shiftState: number): void;
  4893. /** Gets the input text control currently attached to the keyboard */
  4894. readonly connectedInputText: BABYLON.Nullable<InputText>;
  4895. /**
  4896. * Connects the keyboard with an input text control
  4897. *
  4898. * @param input defines the target control
  4899. */
  4900. connect(input: InputText): void;
  4901. /**
  4902. * Disconnects the keyboard from connected InputText controls
  4903. *
  4904. * @param input optionally defines a target control, otherwise all are disconnected
  4905. */
  4906. disconnect(input?: InputText): void;
  4907. /**
  4908. * Release all resources
  4909. */
  4910. dispose(): void;
  4911. /**
  4912. * Creates a new keyboard using a default layout
  4913. *
  4914. * @param name defines control name
  4915. * @returns a new VirtualKeyboard
  4916. */
  4917. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  4918. }
  4919. }
  4920. declare module BABYLON.GUI {
  4921. /** Class used to create rectangle container */
  4922. export class Rectangle extends Container {
  4923. name?: string | undefined;
  4924. /** Gets or sets border thickness */
  4925. thickness: number;
  4926. /** Gets or sets the corner radius angle */
  4927. cornerRadius: number;
  4928. /**
  4929. * Creates a new Rectangle
  4930. * @param name defines the control name
  4931. */
  4932. constructor(name?: string | undefined);
  4933. protected _getTypeName(): string;
  4934. protected _localDraw(context: CanvasRenderingContext2D): void;
  4935. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4936. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4937. }
  4938. }
  4939. declare module BABYLON.GUI {
  4940. /** Class used to render a grid */
  4941. export class DisplayGrid extends Control {
  4942. name?: string | undefined;
  4943. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  4944. displayMinorLines: boolean;
  4945. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  4946. displayMajorLines: boolean;
  4947. /** Gets or sets background color (Black by default) */
  4948. background: string;
  4949. /** Gets or sets the width of each cell (20 by default) */
  4950. cellWidth: number;
  4951. /** Gets or sets the height of each cell (20 by default) */
  4952. cellHeight: number;
  4953. /** Gets or sets the tickness of minor lines (1 by default) */
  4954. minorLineTickness: number;
  4955. /** Gets or sets the color of minor lines (DarkGray by default) */
  4956. minorLineColor: string;
  4957. /** Gets or sets the tickness of major lines (2 by default) */
  4958. majorLineTickness: number;
  4959. /** Gets or sets the color of major lines (White by default) */
  4960. majorLineColor: string;
  4961. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  4962. majorLineFrequency: number;
  4963. /**
  4964. * Creates a new GridDisplayRectangle
  4965. * @param name defines the control name
  4966. */
  4967. constructor(name?: string | undefined);
  4968. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4969. protected _getTypeName(): string;
  4970. }
  4971. }
  4972. declare module BABYLON.GUI {
  4973. /**
  4974. * Class used to create slider controls
  4975. */
  4976. export class BaseSlider extends Control {
  4977. name?: string | undefined;
  4978. protected _thumbWidth: ValueAndUnit;
  4979. protected _barOffset: ValueAndUnit;
  4980. protected _displayThumb: boolean;
  4981. protected _effectiveBarOffset: number;
  4982. protected _renderLeft: number;
  4983. protected _renderTop: number;
  4984. protected _renderWidth: number;
  4985. protected _renderHeight: number;
  4986. protected _backgroundBoxLength: number;
  4987. protected _backgroundBoxThickness: number;
  4988. protected _effectiveThumbThickness: number;
  4989. /** BABYLON.Observable raised when the sldier value changes */
  4990. onValueChangedObservable: BABYLON.Observable<number>;
  4991. /** Gets or sets a boolean indicating if the thumb must be rendered */
  4992. displayThumb: boolean;
  4993. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  4994. barOffset: string | number;
  4995. /** Gets main bar offset in pixels*/
  4996. readonly barOffsetInPixels: number;
  4997. /** Gets or sets thumb width */
  4998. thumbWidth: string | number;
  4999. /** Gets thumb width in pixels */
  5000. readonly thumbWidthInPixels: number;
  5001. /** Gets or sets minimum value */
  5002. minimum: number;
  5003. /** Gets or sets maximum value */
  5004. maximum: number;
  5005. /** Gets or sets current value */
  5006. value: number;
  5007. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  5008. isVertical: boolean;
  5009. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  5010. isThumbClamped: boolean;
  5011. /**
  5012. * Creates a new BaseSlider
  5013. * @param name defines the control name
  5014. */
  5015. constructor(name?: string | undefined);
  5016. protected _getTypeName(): string;
  5017. protected _getThumbPosition(): number;
  5018. protected _getThumbThickness(type: string): number;
  5019. protected _prepareRenderingData(type: string): void;
  5020. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  5021. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  5022. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5023. }
  5024. }
  5025. declare module BABYLON.GUI {
  5026. /**
  5027. * Class used to create slider controls
  5028. */
  5029. export class Slider extends BaseSlider {
  5030. name?: string | undefined;
  5031. /** Gets or sets border color */
  5032. borderColor: string;
  5033. /** Gets or sets background color */
  5034. background: string;
  5035. /** Gets or sets a boolean indicating if the thumb should be round or square */
  5036. isThumbCircle: boolean;
  5037. /**
  5038. * Creates a new Slider
  5039. * @param name defines the control name
  5040. */
  5041. constructor(name?: string | undefined);
  5042. protected _getTypeName(): string;
  5043. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5044. }
  5045. }
  5046. declare module BABYLON.GUI {
  5047. /**
  5048. * Class used to create slider controls based on images
  5049. */
  5050. export class ImageBasedSlider extends BaseSlider {
  5051. name?: string | undefined;
  5052. displayThumb: boolean;
  5053. /**
  5054. * Gets or sets the image used to render the background
  5055. */
  5056. backgroundImage: Image;
  5057. /**
  5058. * Gets or sets the image used to render the value bar
  5059. */
  5060. valueBarImage: Image;
  5061. /**
  5062. * Gets or sets the image used to render the thumb
  5063. */
  5064. thumbImage: Image;
  5065. /**
  5066. * Creates a new ImageBasedSlider
  5067. * @param name defines the control name
  5068. */
  5069. constructor(name?: string | undefined);
  5070. protected _getTypeName(): string;
  5071. _draw(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5072. }
  5073. }
  5074. declare module BABYLON.GUI {
  5075. /**
  5076. * Forcing an export so that this code will execute
  5077. * @hidden
  5078. */
  5079. const name = "Statics";
  5080. }
  5081. declare module BABYLON.GUI {
  5082. /**
  5083. * Class used as a root to all buttons
  5084. */
  5085. export class AbstractButton3D extends Control3D {
  5086. /**
  5087. * Creates a new button
  5088. * @param name defines the control name
  5089. */
  5090. constructor(name?: string);
  5091. protected _getTypeName(): string;
  5092. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5093. }
  5094. }
  5095. declare module BABYLON.GUI {
  5096. /**
  5097. * Class used to create a button in 3D
  5098. */
  5099. export class Button3D extends AbstractButton3D {
  5100. /** @hidden */
  5101. protected _currentMaterial: BABYLON.Material;
  5102. /**
  5103. * Gets or sets the texture resolution used to render content (512 by default)
  5104. */
  5105. contentResolution: BABYLON.int;
  5106. /**
  5107. * Gets or sets the texture scale ratio used to render content (2 by default)
  5108. */
  5109. contentScaleRatio: number;
  5110. protected _disposeFacadeTexture(): void;
  5111. protected _resetContent(): void;
  5112. /**
  5113. * Creates a new button
  5114. * @param name defines the control name
  5115. */
  5116. constructor(name?: string);
  5117. /**
  5118. * Gets or sets the GUI 2D content used to display the button's facade
  5119. */
  5120. content: Control;
  5121. /**
  5122. * Apply the facade texture (created from the content property).
  5123. * This function can be overloaded by child classes
  5124. * @param facadeTexture defines the AdvancedDynamicTexture to use
  5125. */
  5126. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5127. protected _getTypeName(): string;
  5128. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5129. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5130. /**
  5131. * Releases all associated resources
  5132. */
  5133. dispose(): void;
  5134. }
  5135. }
  5136. declare module BABYLON.GUI {
  5137. /**
  5138. * Class used to create containers for controls
  5139. */
  5140. export class Container3D extends Control3D {
  5141. /**
  5142. * Gets the list of child controls
  5143. */
  5144. protected _children: Control3D[];
  5145. /**
  5146. * Gets the list of child controls
  5147. */
  5148. readonly children: Array<Control3D>;
  5149. /**
  5150. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  5151. * This is helpful to optimize layout operation when adding multiple children in a row
  5152. */
  5153. blockLayout: boolean;
  5154. /**
  5155. * Creates a new container
  5156. * @param name defines the container name
  5157. */
  5158. constructor(name?: string);
  5159. /**
  5160. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  5161. * @returns the current container
  5162. */
  5163. updateLayout(): Container3D;
  5164. /**
  5165. * Gets a boolean indicating if the given control is in the children of this control
  5166. * @param control defines the control to check
  5167. * @returns true if the control is in the child list
  5168. */
  5169. containsControl(control: Control3D): boolean;
  5170. /**
  5171. * Adds a control to the children of this control
  5172. * @param control defines the control to add
  5173. * @returns the current container
  5174. */
  5175. addControl(control: Control3D): Container3D;
  5176. /**
  5177. * This function will be called everytime a new control is added
  5178. */
  5179. protected _arrangeChildren(): void;
  5180. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5181. /**
  5182. * Removes a control from the children of this control
  5183. * @param control defines the control to remove
  5184. * @returns the current container
  5185. */
  5186. removeControl(control: Control3D): Container3D;
  5187. protected _getTypeName(): string;
  5188. /**
  5189. * Releases all associated resources
  5190. */
  5191. dispose(): void;
  5192. /** Control rotation will remain unchanged */
  5193. static readonly UNSET_ORIENTATION: number;
  5194. /** Control will rotate to make it look at sphere central axis */
  5195. static readonly FACEORIGIN_ORIENTATION: number;
  5196. /** Control will rotate to make it look back at sphere central axis */
  5197. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  5198. /** Control will rotate to look at z axis (0, 0, 1) */
  5199. static readonly FACEFORWARD_ORIENTATION: number;
  5200. /** Control will rotate to look at negative z axis (0, 0, -1) */
  5201. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  5202. }
  5203. }
  5204. declare module BABYLON.GUI {
  5205. /**
  5206. * Class used as base class for controls
  5207. */
  5208. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  5209. /** Defines the control name */
  5210. name?: string | undefined;
  5211. /** @hidden */
  5212. _host: GUI3DManager;
  5213. /** Gets or sets the control position in world space */
  5214. position: BABYLON.Vector3;
  5215. /** Gets or sets the control scaling in world space */
  5216. scaling: BABYLON.Vector3;
  5217. /** Callback used to start pointer enter animation */
  5218. pointerEnterAnimation: () => void;
  5219. /** Callback used to start pointer out animation */
  5220. pointerOutAnimation: () => void;
  5221. /** Callback used to start pointer down animation */
  5222. pointerDownAnimation: () => void;
  5223. /** Callback used to start pointer up animation */
  5224. pointerUpAnimation: () => void;
  5225. /**
  5226. * An event triggered when the pointer move over the control
  5227. */
  5228. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  5229. /**
  5230. * An event triggered when the pointer move out of the control
  5231. */
  5232. onPointerOutObservable: BABYLON.Observable<Control3D>;
  5233. /**
  5234. * An event triggered when the pointer taps the control
  5235. */
  5236. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  5237. /**
  5238. * An event triggered when pointer is up
  5239. */
  5240. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  5241. /**
  5242. * An event triggered when a control is clicked on (with a mouse)
  5243. */
  5244. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  5245. /**
  5246. * An event triggered when pointer enters the control
  5247. */
  5248. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  5249. /**
  5250. * Gets or sets the parent container
  5251. */
  5252. parent: BABYLON.Nullable<Container3D>;
  5253. /**
  5254. * Gets the list of attached behaviors
  5255. * @see http://doc.babylonjs.com/features/behaviour
  5256. */
  5257. readonly behaviors: BABYLON.Behavior<Control3D>[];
  5258. /**
  5259. * Attach a behavior to the control
  5260. * @see http://doc.babylonjs.com/features/behaviour
  5261. * @param behavior defines the behavior to attach
  5262. * @returns the current control
  5263. */
  5264. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5265. /**
  5266. * Remove an attached behavior
  5267. * @see http://doc.babylonjs.com/features/behaviour
  5268. * @param behavior defines the behavior to attach
  5269. * @returns the current control
  5270. */
  5271. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5272. /**
  5273. * Gets an attached behavior by name
  5274. * @param name defines the name of the behavior to look for
  5275. * @see http://doc.babylonjs.com/features/behaviour
  5276. * @returns null if behavior was not found else the requested behavior
  5277. */
  5278. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  5279. /** Gets or sets a boolean indicating if the control is visible */
  5280. isVisible: boolean;
  5281. /**
  5282. * Creates a new control
  5283. * @param name defines the control name
  5284. */
  5285. constructor(
  5286. /** Defines the control name */
  5287. name?: string | undefined);
  5288. /**
  5289. * Gets a string representing the class name
  5290. */
  5291. readonly typeName: string;
  5292. protected _getTypeName(): string;
  5293. /**
  5294. * Gets the transform node used by this control
  5295. */
  5296. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  5297. /**
  5298. * Gets the mesh used to render this control
  5299. */
  5300. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  5301. /**
  5302. * Link the control as child of the given node
  5303. * @param node defines the node to link to. Use null to unlink the control
  5304. * @returns the current control
  5305. */
  5306. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  5307. /** @hidden **/
  5308. _prepareNode(scene: BABYLON.Scene): void;
  5309. /**
  5310. * Node creation.
  5311. * Can be overriden by children
  5312. * @param scene defines the scene where the node must be attached
  5313. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  5314. */
  5315. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5316. /**
  5317. * Affect a material to the given mesh
  5318. * @param mesh defines the mesh which will represent the control
  5319. */
  5320. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5321. /** @hidden */
  5322. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  5323. /** @hidden */
  5324. _onPointerEnter(target: Control3D): boolean;
  5325. /** @hidden */
  5326. _onPointerOut(target: Control3D): void;
  5327. /** @hidden */
  5328. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5329. /** @hidden */
  5330. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5331. /** @hidden */
  5332. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  5333. /** @hidden */
  5334. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5335. /** @hidden */
  5336. _disposeNode(): void;
  5337. /**
  5338. * Releases all associated resources
  5339. */
  5340. dispose(): void;
  5341. }
  5342. }
  5343. declare module BABYLON.GUI {
  5344. /**
  5345. * Class used to create a container panel deployed on the surface of a cylinder
  5346. */
  5347. export class CylinderPanel extends VolumeBasedPanel {
  5348. /**
  5349. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  5350. */
  5351. radius: BABYLON.float;
  5352. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5353. }
  5354. }
  5355. declare module BABYLON.GUI {
  5356. /**
  5357. * Class used to create a holographic button in 3D
  5358. */
  5359. export class HolographicButton extends Button3D {
  5360. /**
  5361. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  5362. */
  5363. tooltipText: BABYLON.Nullable<string>;
  5364. /**
  5365. * Gets or sets text for the button
  5366. */
  5367. text: string;
  5368. /**
  5369. * Gets or sets the image url for the button
  5370. */
  5371. imageUrl: string;
  5372. /**
  5373. * Gets the back material used by this button
  5374. */
  5375. readonly backMaterial: FluentMaterial;
  5376. /**
  5377. * Gets the front material used by this button
  5378. */
  5379. readonly frontMaterial: FluentMaterial;
  5380. /**
  5381. * Gets the plate material used by this button
  5382. */
  5383. readonly plateMaterial: BABYLON.StandardMaterial;
  5384. /**
  5385. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  5386. */
  5387. readonly shareMaterials: boolean;
  5388. /**
  5389. * Creates a new button
  5390. * @param name defines the control name
  5391. */
  5392. constructor(name?: string, shareMaterials?: boolean);
  5393. protected _getTypeName(): string;
  5394. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5395. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5396. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  5397. /**
  5398. * Releases all associated resources
  5399. */
  5400. dispose(): void;
  5401. }
  5402. }
  5403. declare module BABYLON.GUI {
  5404. /**
  5405. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  5406. */
  5407. export class MeshButton3D extends Button3D {
  5408. /** @hidden */
  5409. protected _currentMesh: BABYLON.Mesh;
  5410. /**
  5411. * Creates a new 3D button based on a mesh
  5412. * @param mesh mesh to become a 3D button
  5413. * @param name defines the control name
  5414. */
  5415. constructor(mesh: BABYLON.Mesh, name?: string);
  5416. protected _getTypeName(): string;
  5417. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5418. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5419. }
  5420. }
  5421. declare module BABYLON.GUI {
  5422. /**
  5423. * Class used to create a container panel deployed on the surface of a plane
  5424. */
  5425. export class PlanePanel extends VolumeBasedPanel {
  5426. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5427. }
  5428. }
  5429. declare module BABYLON.GUI {
  5430. /**
  5431. * Class used to create a container panel where items get randomized planar mapping
  5432. */
  5433. export class ScatterPanel extends VolumeBasedPanel {
  5434. /**
  5435. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  5436. */
  5437. iteration: BABYLON.float;
  5438. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5439. protected _finalProcessing(): void;
  5440. }
  5441. }
  5442. declare module BABYLON.GUI {
  5443. /**
  5444. * Class used to create a container panel deployed on the surface of a sphere
  5445. */
  5446. export class SpherePanel extends VolumeBasedPanel {
  5447. /**
  5448. * Gets or sets the radius of the sphere where to project controls (5 by default)
  5449. */
  5450. radius: BABYLON.float;
  5451. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5452. }
  5453. }
  5454. declare module BABYLON.GUI {
  5455. /**
  5456. * Class used to create a stack panel in 3D on XY plane
  5457. */
  5458. export class StackPanel3D extends Container3D {
  5459. /**
  5460. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  5461. */
  5462. isVertical: boolean;
  5463. /**
  5464. * Gets or sets the distance between elements
  5465. */
  5466. margin: number;
  5467. /**
  5468. * Creates new StackPanel
  5469. * @param isVertical
  5470. */
  5471. constructor(isVertical?: boolean);
  5472. protected _arrangeChildren(): void;
  5473. }
  5474. }
  5475. declare module BABYLON.GUI {
  5476. /**
  5477. * Abstract class used to create a container panel deployed on the surface of a volume
  5478. */
  5479. export abstract class VolumeBasedPanel extends Container3D {
  5480. protected _cellWidth: number;
  5481. protected _cellHeight: number;
  5482. /**
  5483. * Gets or sets the distance between elements
  5484. */
  5485. margin: number;
  5486. /**
  5487. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  5488. * | Value | Type | Description |
  5489. * | ----- | ----------------------------------- | ----------- |
  5490. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  5491. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  5492. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  5493. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  5494. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  5495. */
  5496. orientation: number;
  5497. /**
  5498. * Gets or sets the number of columns requested (10 by default).
  5499. * The panel will automatically compute the number of rows based on number of child controls.
  5500. */
  5501. columns: BABYLON.int;
  5502. /**
  5503. * Gets or sets a the number of rows requested.
  5504. * The panel will automatically compute the number of columns based on number of child controls.
  5505. */
  5506. rows: BABYLON.int;
  5507. /**
  5508. * Creates new VolumeBasedPanel
  5509. */
  5510. constructor();
  5511. protected _arrangeChildren(): void;
  5512. /** Child classes must implement this function to provide correct control positioning */
  5513. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5514. /** Child classes can implement this function to provide additional processing */
  5515. protected _finalProcessing(): void;
  5516. }
  5517. }
  5518. declare module BABYLON.GUI {
  5519. /** @hidden */
  5520. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  5521. INNERGLOW: boolean;
  5522. BORDER: boolean;
  5523. HOVERLIGHT: boolean;
  5524. TEXTURE: boolean;
  5525. constructor();
  5526. }
  5527. /**
  5528. * Class used to render controls with fluent desgin
  5529. */
  5530. export class FluentMaterial extends BABYLON.PushMaterial {
  5531. /**
  5532. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  5533. */
  5534. innerGlowColorIntensity: number;
  5535. /**
  5536. * Gets or sets the inner glow color (white by default)
  5537. */
  5538. innerGlowColor: BABYLON.Color3;
  5539. /**
  5540. * Gets or sets alpha value (default is 1.0)
  5541. */
  5542. alpha: number;
  5543. /**
  5544. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  5545. */
  5546. albedoColor: BABYLON.Color3;
  5547. /**
  5548. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  5549. */
  5550. renderBorders: boolean;
  5551. /**
  5552. * Gets or sets border width (default is 0.5)
  5553. */
  5554. borderWidth: number;
  5555. /**
  5556. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  5557. */
  5558. edgeSmoothingValue: number;
  5559. /**
  5560. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  5561. */
  5562. borderMinValue: number;
  5563. /**
  5564. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  5565. */
  5566. renderHoverLight: boolean;
  5567. /**
  5568. * Gets or sets the radius used to render the hover light (default is 1.0)
  5569. */
  5570. hoverRadius: number;
  5571. /**
  5572. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  5573. */
  5574. hoverColor: BABYLON.Color4;
  5575. /**
  5576. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  5577. */
  5578. hoverPosition: BABYLON.Vector3;
  5579. /** Gets or sets the texture to use for albedo color */
  5580. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  5581. /**
  5582. * Creates a new Fluent material
  5583. * @param name defines the name of the material
  5584. * @param scene defines the hosting scene
  5585. */
  5586. constructor(name: string, scene: BABYLON.Scene);
  5587. needAlphaBlending(): boolean;
  5588. needAlphaTesting(): boolean;
  5589. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  5590. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  5591. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  5592. getActiveTextures(): BABYLON.BaseTexture[];
  5593. hasTexture(texture: BABYLON.BaseTexture): boolean;
  5594. dispose(forceDisposeEffect?: boolean): void;
  5595. clone(name: string): FluentMaterial;
  5596. serialize(): any;
  5597. getClassName(): string;
  5598. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  5599. }
  5600. }