babylon.gui.module.d.ts 277 KB

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