babylon.gui.module.d.ts 278 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114
  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. * Gets a string representing the child cell info (row x column)
  1535. * @param child defines the control to get info from
  1536. * @returns a string containing the child cell info (row x column)
  1537. */
  1538. getChildCellInfo(child: Control): string;
  1539. /**
  1540. * Remove a column definition at specified index
  1541. * @param index defines the index of the column to remove
  1542. * @returns the current grid
  1543. */
  1544. removeColumnDefinition(index: number): Grid;
  1545. /**
  1546. * Remove a row definition at specified index
  1547. * @param index defines the index of the row to remove
  1548. * @returns the current grid
  1549. */
  1550. removeRowDefinition(index: number): Grid;
  1551. /**
  1552. * Adds a new control to the current grid
  1553. * @param control defines the control to add
  1554. * @param row defines the row where to add the control (0 by default)
  1555. * @param column defines the column where to add the control (0 by default)
  1556. * @returns the current grid
  1557. */
  1558. addControl(control: Control, row?: number, column?: number): Grid;
  1559. /**
  1560. * Removes a control from the current container
  1561. * @param control defines the control to remove
  1562. * @returns the current container
  1563. */
  1564. removeControl(control: Control): Container;
  1565. /**
  1566. * Creates a new Grid
  1567. * @param name defines control name
  1568. */
  1569. constructor(name?: string | undefined);
  1570. protected _getTypeName(): string;
  1571. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  1572. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1573. _flagDescendantsAsMatrixDirty(): void;
  1574. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  1575. /** Releases associated resources */
  1576. dispose(): void;
  1577. }
  1578. }
  1579. declare module 'babylonjs-gui/2D/controls/image' {
  1580. import { Control } from "babylonjs-gui/2D/controls/control";
  1581. import { Nullable, Observable } from "babylonjs";
  1582. import { Measure } from "2D";
  1583. /**
  1584. * Class used to create 2D images
  1585. */
  1586. export class Image extends Control {
  1587. name?: string | undefined;
  1588. /**
  1589. * Observable notified when the content is loaded
  1590. */
  1591. onImageLoadedObservable: Observable<Image>;
  1592. /**
  1593. * Gets a boolean indicating that the content is loaded
  1594. */
  1595. readonly isLoaded: boolean;
  1596. /**
  1597. * Gets or sets the left coordinate in the source image
  1598. */
  1599. sourceLeft: number;
  1600. /**
  1601. * Gets or sets the top coordinate in the source image
  1602. */
  1603. sourceTop: number;
  1604. /**
  1605. * Gets or sets the width to capture in the source image
  1606. */
  1607. sourceWidth: number;
  1608. /**
  1609. * Gets or sets the height to capture in the source image
  1610. */
  1611. sourceHeight: number;
  1612. /**
  1613. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  1614. * @see http://doc.babylonjs.com/how_to/gui#image
  1615. */
  1616. autoScale: boolean;
  1617. /** Gets or sets the streching mode used by the image */
  1618. stretch: number;
  1619. /**
  1620. * Gets or sets the internal DOM image used to render the control
  1621. */
  1622. domImage: HTMLImageElement;
  1623. /**
  1624. * Gets or sets image source url
  1625. */
  1626. source: Nullable<string>;
  1627. /**
  1628. * Gets or sets the cell width to use when animation sheet is enabled
  1629. * @see http://doc.babylonjs.com/how_to/gui#image
  1630. */
  1631. cellWidth: number;
  1632. /**
  1633. * Gets or sets the cell height to use when animation sheet is enabled
  1634. * @see http://doc.babylonjs.com/how_to/gui#image
  1635. */
  1636. cellHeight: number;
  1637. /**
  1638. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  1639. * @see http://doc.babylonjs.com/how_to/gui#image
  1640. */
  1641. cellId: number;
  1642. /**
  1643. * Creates a new Image
  1644. * @param name defines the control name
  1645. * @param url defines the image url
  1646. */
  1647. constructor(name?: string | undefined, url?: Nullable<string>);
  1648. protected _getTypeName(): string;
  1649. /** Force the control to synchronize with its content */
  1650. synchronizeSizeWithContent(): void;
  1651. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1652. _draw(context: CanvasRenderingContext2D): void;
  1653. dispose(): void;
  1654. /** STRETCH_NONE */
  1655. static readonly STRETCH_NONE: number;
  1656. /** STRETCH_FILL */
  1657. static readonly STRETCH_FILL: number;
  1658. /** STRETCH_UNIFORM */
  1659. static readonly STRETCH_UNIFORM: number;
  1660. /** STRETCH_EXTEND */
  1661. static readonly STRETCH_EXTEND: number;
  1662. }
  1663. }
  1664. declare module 'babylonjs-gui/2D/controls/inputText' {
  1665. import { Control } from "babylonjs-gui/2D/controls/control";
  1666. import { IFocusableControl } from "babylonjs-gui/2D/advancedDynamicTexture";
  1667. import { Nullable, Observable, Vector2 } from 'babylonjs';
  1668. import { VirtualKeyboard } from "babylonjs-gui/2D/controls/virtualKeyboard";
  1669. /**
  1670. * Class used to create input text control
  1671. */
  1672. export class InputText extends Control implements IFocusableControl {
  1673. name?: string | undefined;
  1674. /** @hidden */
  1675. _connectedVirtualKeyboard: Nullable<VirtualKeyboard>;
  1676. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  1677. promptMessage: string;
  1678. /** Observable raised when the text changes */
  1679. onTextChangedObservable: Observable<InputText>;
  1680. /** Observable raised just before an entered character is to be added */
  1681. onBeforeKeyAddObservable: Observable<InputText>;
  1682. /** Observable raised when the control gets the focus */
  1683. onFocusObservable: Observable<InputText>;
  1684. /** Observable raised when the control loses the focus */
  1685. onBlurObservable: Observable<InputText>;
  1686. /**Observable raised when the text is highlighted */
  1687. onTextHighlightObservable: Observable<InputText>;
  1688. /**Observable raised when copy event is triggered */
  1689. onTextCopyObservable: Observable<InputText>;
  1690. /** Observable raised when cut event is triggered */
  1691. onTextCutObservable: Observable<InputText>;
  1692. /** Observable raised when paste event is triggered */
  1693. onTextPasteObservable: Observable<InputText>;
  1694. /** Gets or sets the maximum width allowed by the control */
  1695. maxWidth: string | number;
  1696. /** Gets the maximum width allowed by the control in pixels */
  1697. readonly maxWidthInPixels: number;
  1698. /** Gets or sets the text highlighter transparency; default: 0.4 */
  1699. highligherOpacity: number;
  1700. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  1701. onFocusSelectAll: boolean;
  1702. /** Gets or sets the text hightlight color */
  1703. textHighlightColor: string;
  1704. /** Gets or sets control margin */
  1705. margin: string;
  1706. /** Gets control margin in pixels */
  1707. readonly marginInPixels: number;
  1708. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  1709. autoStretchWidth: boolean;
  1710. /** Gets or sets border thickness */
  1711. thickness: number;
  1712. /** Gets or sets the background color when focused */
  1713. focusedBackground: string;
  1714. /** Gets or sets the background color */
  1715. background: string;
  1716. /** Gets or sets the placeholder color */
  1717. placeholderColor: string;
  1718. /** Gets or sets the text displayed when the control is empty */
  1719. placeholderText: string;
  1720. /** Gets or sets the dead key flag */
  1721. deadKey: boolean;
  1722. /** Gets or sets the highlight text */
  1723. highlightedText: string;
  1724. /** Gets or sets if the current key should be added */
  1725. addKey: boolean;
  1726. /** Gets or sets the value of the current key being entered */
  1727. currentKey: string;
  1728. /** Gets or sets the text displayed in the control */
  1729. text: string;
  1730. /** Gets or sets control width */
  1731. width: string | number;
  1732. /**
  1733. * Creates a new InputText
  1734. * @param name defines the control name
  1735. * @param text defines the text of the control
  1736. */
  1737. constructor(name?: string | undefined, text?: string);
  1738. /** @hidden */
  1739. onBlur(): void;
  1740. /** @hidden */
  1741. onFocus(): void;
  1742. protected _getTypeName(): string;
  1743. /**
  1744. * Function called to get the list of controls that should not steal the focus from this control
  1745. * @returns an array of controls
  1746. */
  1747. keepsFocusWith(): Nullable<Control[]>;
  1748. /** @hidden */
  1749. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  1750. /**
  1751. * Handles the keyboard event
  1752. * @param evt Defines the KeyboardEvent
  1753. */
  1754. processKeyboard(evt: KeyboardEvent): void;
  1755. _draw(context: CanvasRenderingContext2D): void;
  1756. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1757. _onPointerMove(target: Control, coordinates: Vector2): void;
  1758. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  1759. protected _beforeRenderText(text: string): string;
  1760. dispose(): void;
  1761. }
  1762. }
  1763. declare module 'babylonjs-gui/2D/controls/inputPassword' {
  1764. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  1765. /**
  1766. * Class used to create a password control
  1767. */
  1768. export class InputPassword extends InputText {
  1769. protected _beforeRenderText(text: string): string;
  1770. }
  1771. }
  1772. declare module 'babylonjs-gui/2D/controls/line' {
  1773. import { Control } from "babylonjs-gui/2D/controls/control";
  1774. import { Vector3, Scene } from "babylonjs";
  1775. import { Measure } from "babylonjs-gui/2D/measure";
  1776. /** Class used to render 2D lines */
  1777. export class Line extends Control {
  1778. name?: string | undefined;
  1779. /** Gets or sets the dash pattern */
  1780. dash: Array<number>;
  1781. /** Gets or sets the control connected with the line end */
  1782. connectedControl: Control;
  1783. /** Gets or sets start coordinates on X axis */
  1784. x1: string | number;
  1785. /** Gets or sets start coordinates on Y axis */
  1786. y1: string | number;
  1787. /** Gets or sets end coordinates on X axis */
  1788. x2: string | number;
  1789. /** Gets or sets end coordinates on Y axis */
  1790. y2: string | number;
  1791. /** Gets or sets line width */
  1792. lineWidth: number;
  1793. /** Gets or sets horizontal alignment */
  1794. horizontalAlignment: number;
  1795. /** Gets or sets vertical alignment */
  1796. verticalAlignment: number;
  1797. /**
  1798. * Creates a new Line
  1799. * @param name defines the control name
  1800. */
  1801. constructor(name?: string | undefined);
  1802. protected _getTypeName(): string;
  1803. _draw(context: CanvasRenderingContext2D): void;
  1804. _measure(): void;
  1805. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1806. /**
  1807. * Move one end of the line given 3D cartesian coordinates.
  1808. * @param position Targeted world position
  1809. * @param scene Scene
  1810. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1811. */
  1812. moveToVector3(position: Vector3, scene: Scene, end?: boolean): void;
  1813. /**
  1814. * Move one end of the line to a position in screen absolute space.
  1815. * @param projectedPosition Position in screen absolute space (X, Y)
  1816. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  1817. */
  1818. _moveToProjectedPosition(projectedPosition: Vector3, end?: boolean): void;
  1819. }
  1820. }
  1821. declare module 'babylonjs-gui/2D/controls/multiLine' {
  1822. import { Control } from "babylonjs-gui/2D/controls/control";
  1823. import { MultiLinePoint } from "babylonjs-gui/2D/multiLinePoint";
  1824. import { AbstractMesh } from "babylonjs";
  1825. import { Measure } from "babylonjs-gui/2D/measure";
  1826. /**
  1827. * Class used to create multi line control
  1828. */
  1829. export class MultiLine extends Control {
  1830. name?: string | undefined;
  1831. /**
  1832. * Creates a new MultiLine
  1833. * @param name defines the control name
  1834. */
  1835. constructor(name?: string | undefined);
  1836. /** Gets or sets dash pattern */
  1837. dash: Array<number>;
  1838. /**
  1839. * Gets point stored at specified index
  1840. * @param index defines the index to look for
  1841. * @returns the requested point if found
  1842. */
  1843. getAt(index: number): MultiLinePoint;
  1844. /** Function called when a point is updated */
  1845. onPointUpdate: () => void;
  1846. /**
  1847. * Adds new points to the point collection
  1848. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  1849. * @returns the list of created MultiLinePoint
  1850. */
  1851. add(...items: (AbstractMesh | Control | {
  1852. x: string | number;
  1853. y: string | number;
  1854. })[]): MultiLinePoint[];
  1855. /**
  1856. * Adds a new point to the point collection
  1857. * @param item defines the item (mesh, control or 2d coordiantes) to add
  1858. * @returns the created MultiLinePoint
  1859. */
  1860. push(item?: (AbstractMesh | Control | {
  1861. x: string | number;
  1862. y: string | number;
  1863. })): MultiLinePoint;
  1864. /**
  1865. * Remove a specific value or point from the active point collection
  1866. * @param value defines the value or point to remove
  1867. */
  1868. remove(value: number | MultiLinePoint): void;
  1869. /**
  1870. * Resets this object to initial state (no point)
  1871. */
  1872. reset(): void;
  1873. /**
  1874. * Resets all links
  1875. */
  1876. resetLinks(): void;
  1877. /** Gets or sets line width */
  1878. lineWidth: number;
  1879. horizontalAlignment: number;
  1880. verticalAlignment: number;
  1881. protected _getTypeName(): string;
  1882. _draw(context: CanvasRenderingContext2D): void;
  1883. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1884. _measure(): void;
  1885. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1886. dispose(): void;
  1887. }
  1888. }
  1889. declare module 'babylonjs-gui/2D/controls/radioButton' {
  1890. import { Control } from "babylonjs-gui/2D/controls/control";
  1891. import { Observable, Vector2 } from "babylonjs";
  1892. import { StackPanel } from "babylonjs-gui/2D/controls";
  1893. /**
  1894. * Class used to create radio button controls
  1895. */
  1896. export class RadioButton extends Control {
  1897. name?: string | undefined;
  1898. /** Gets or sets border thickness */
  1899. thickness: number;
  1900. /** Gets or sets group name */
  1901. group: string;
  1902. /** Observable raised when isChecked is changed */
  1903. onIsCheckedChangedObservable: Observable<boolean>;
  1904. /** Gets or sets a value indicating the ratio between overall size and check size */
  1905. checkSizeRatio: number;
  1906. /** Gets or sets background color */
  1907. background: string;
  1908. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  1909. isChecked: boolean;
  1910. /**
  1911. * Creates a new RadioButton
  1912. * @param name defines the control name
  1913. */
  1914. constructor(name?: string | undefined);
  1915. protected _getTypeName(): string;
  1916. _draw(context: CanvasRenderingContext2D): void;
  1917. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  1918. /**
  1919. * Utility function to easily create a radio button with a header
  1920. * @param title defines the label to use for the header
  1921. * @param group defines the group to use for the radio button
  1922. * @param isChecked defines the initial state of the radio button
  1923. * @param onValueChanged defines the callback to call when value changes
  1924. * @returns a StackPanel containing the radio button and a textBlock
  1925. */
  1926. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  1927. }
  1928. }
  1929. declare module 'babylonjs-gui/2D/controls/stackPanel' {
  1930. import { Container } from "babylonjs-gui/2D/controls/container";
  1931. import { Measure } from "babylonjs-gui/2D/measure";
  1932. /**
  1933. * Class used to create a 2D stack panel container
  1934. */
  1935. export class StackPanel extends Container {
  1936. name?: string | undefined;
  1937. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  1938. isVertical: boolean;
  1939. /**
  1940. * Gets or sets panel width.
  1941. * This value should not be set when in horizontal mode as it will be computed automatically
  1942. */
  1943. width: string | number;
  1944. /**
  1945. * Gets or sets panel height.
  1946. * This value should not be set when in vertical mode as it will be computed automatically
  1947. */
  1948. height: string | number;
  1949. /**
  1950. * Creates a new StackPanel
  1951. * @param name defines control name
  1952. */
  1953. constructor(name?: string | undefined);
  1954. protected _getTypeName(): string;
  1955. /** @hidden */
  1956. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1957. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  1958. protected _postMeasure(): void;
  1959. }
  1960. }
  1961. declare module 'babylonjs-gui/2D/controls/selector' {
  1962. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  1963. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  1964. /** Class used to create a RadioGroup
  1965. * which contains groups of radio buttons
  1966. */
  1967. export class SelectorGroup {
  1968. /** name of SelectorGroup */
  1969. name: string;
  1970. /**
  1971. * Creates a new SelectorGroup
  1972. * @param name of group, used as a group heading
  1973. */
  1974. constructor(
  1975. /** name of SelectorGroup */
  1976. name: string);
  1977. /** Gets the groupPanel of the SelectorGroup */
  1978. readonly groupPanel: StackPanel;
  1979. /** Gets the selectors array */
  1980. readonly selectors: StackPanel[];
  1981. /** Gets and sets the group header */
  1982. header: string;
  1983. /** @hidden*/
  1984. _getSelector(selectorNb: number): StackPanel | undefined;
  1985. /** Removes the selector at the given position
  1986. * @param selectorNb the position of the selector within the group
  1987. */
  1988. removeSelector(selectorNb: number): void;
  1989. }
  1990. /** Class used to create a CheckboxGroup
  1991. * which contains groups of checkbox buttons
  1992. */
  1993. export class CheckboxGroup extends SelectorGroup {
  1994. /** Adds a checkbox as a control
  1995. * @param text is the label for the selector
  1996. * @param func is the function called when the Selector is checked
  1997. * @param checked is true when Selector is checked
  1998. */
  1999. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  2000. /** @hidden */
  2001. _setSelectorLabel(selectorNb: number, label: string): void;
  2002. /** @hidden */
  2003. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2004. /** @hidden */
  2005. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2006. /** @hidden */
  2007. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2008. }
  2009. /** Class used to create a RadioGroup
  2010. * which contains groups of radio buttons
  2011. */
  2012. export class RadioGroup extends SelectorGroup {
  2013. /** Adds a radio button as a control
  2014. * @param label is the label for the selector
  2015. * @param func is the function called when the Selector is checked
  2016. * @param checked is true when Selector is checked
  2017. */
  2018. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  2019. /** @hidden */
  2020. _setSelectorLabel(selectorNb: number, label: string): void;
  2021. /** @hidden */
  2022. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2023. /** @hidden */
  2024. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2025. /** @hidden */
  2026. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2027. }
  2028. /** Class used to create a SliderGroup
  2029. * which contains groups of slider buttons
  2030. */
  2031. export class SliderGroup extends SelectorGroup {
  2032. /**
  2033. * Adds a slider to the SelectorGroup
  2034. * @param label is the label for the SliderBar
  2035. * @param func is the function called when the Slider moves
  2036. * @param unit is a string describing the units used, eg degrees or metres
  2037. * @param min is the minimum value for the Slider
  2038. * @param max is the maximum value for the Slider
  2039. * @param value is the start value for the Slider between min and max
  2040. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  2041. */
  2042. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  2043. /** @hidden */
  2044. _setSelectorLabel(selectorNb: number, label: string): void;
  2045. /** @hidden */
  2046. _setSelectorLabelColor(selectorNb: number, color: string): void;
  2047. /** @hidden */
  2048. _setSelectorButtonColor(selectorNb: number, color: string): void;
  2049. /** @hidden */
  2050. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  2051. }
  2052. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  2053. * @see http://doc.babylonjs.com/how_to/selector
  2054. */
  2055. export class SelectionPanel extends Rectangle {
  2056. /** name of SelectionPanel */
  2057. name: string;
  2058. /** an array of SelectionGroups */
  2059. groups: SelectorGroup[];
  2060. /**
  2061. * Creates a new SelectionPanel
  2062. * @param name of SelectionPanel
  2063. * @param groups is an array of SelectionGroups
  2064. */
  2065. constructor(
  2066. /** name of SelectionPanel */
  2067. name: string,
  2068. /** an array of SelectionGroups */
  2069. groups?: SelectorGroup[]);
  2070. protected _getTypeName(): string;
  2071. /** Gets or sets the headerColor */
  2072. headerColor: string;
  2073. /** Gets or sets the button color */
  2074. buttonColor: string;
  2075. /** Gets or sets the label color */
  2076. labelColor: string;
  2077. /** Gets or sets the button background */
  2078. buttonBackground: string;
  2079. /** Gets or sets the color of separator bar */
  2080. barColor: string;
  2081. /** Gets or sets the height of separator bar */
  2082. barHeight: string;
  2083. /** Gets or sets the height of spacers*/
  2084. spacerHeight: string;
  2085. /** Add a group to the selection panel
  2086. * @param group is the selector group to add
  2087. */
  2088. addGroup(group: SelectorGroup): void;
  2089. /** Remove the group from the given position
  2090. * @param groupNb is the position of the group in the list
  2091. */
  2092. removeGroup(groupNb: number): void;
  2093. /** Change a group header label
  2094. * @param label is the new group header label
  2095. * @param groupNb is the number of the group to relabel
  2096. * */
  2097. setHeaderName(label: string, groupNb: number): void;
  2098. /** Change selector label to the one given
  2099. * @param label is the new selector label
  2100. * @param groupNb is the number of the groupcontaining the selector
  2101. * @param selectorNb is the number of the selector within a group to relabel
  2102. * */
  2103. relabel(label: string, groupNb: number, selectorNb: number): void;
  2104. /** For a given group position remove the selector at the given position
  2105. * @param groupNb is the number of the group to remove the selector from
  2106. * @param selectorNb is the number of the selector within the group
  2107. */
  2108. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  2109. /** For a given group position of correct type add a checkbox button
  2110. * @param groupNb is the number of the group to remove the selector from
  2111. * @param label is the label for the selector
  2112. * @param func is the function called when the Selector is checked
  2113. * @param checked is true when Selector is checked
  2114. */
  2115. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2116. /** For a given group position of correct type add a radio button
  2117. * @param groupNb is the number of the group to remove the selector from
  2118. * @param label is the label for the selector
  2119. * @param func is the function called when the Selector is checked
  2120. * @param checked is true when Selector is checked
  2121. */
  2122. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  2123. /**
  2124. * For a given slider group add a slider
  2125. * @param groupNb is the number of the group to add the slider to
  2126. * @param label is the label for the Slider
  2127. * @param func is the function called when the Slider moves
  2128. * @param unit is a string describing the units used, eg degrees or metres
  2129. * @param min is the minimum value for the Slider
  2130. * @param max is the maximum value for the Slider
  2131. * @param value is the start value for the Slider between min and max
  2132. * @param onVal is the function used to format the value displayed, eg radians to degrees
  2133. */
  2134. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  2135. }
  2136. }
  2137. declare module 'babylonjs-gui/2D/controls/scrollViewers/scrollViewer' {
  2138. import { Rectangle } from "babylonjs-gui/2D/controls/rectangle";
  2139. import { Control } from "babylonjs-gui/2D/controls/control";
  2140. import { Container } from "babylonjs-gui/2D/controls/container";
  2141. import { Nullable } from "babylonjs";
  2142. import { AdvancedDynamicTexture, Measure } from "2D";
  2143. /**
  2144. * Class used to hold a viewer window and sliders in a grid
  2145. */
  2146. export class ScrollViewer extends Rectangle {
  2147. /**
  2148. * Adds a new control to the current container
  2149. * @param control defines the control to add
  2150. * @returns the current container
  2151. */
  2152. addControl(control: Nullable<Control>): Container;
  2153. /**
  2154. * Removes a control from the current container
  2155. * @param control defines the control to remove
  2156. * @returns the current container
  2157. */
  2158. removeControl(control: Control): Container;
  2159. /** Gets the list of children */
  2160. readonly children: Control[];
  2161. _flagDescendantsAsMatrixDirty(): void;
  2162. /**
  2163. * Creates a new ScrollViewer
  2164. * @param name of ScrollViewer
  2165. */
  2166. constructor(name?: string);
  2167. /** Reset the scroll viewer window to initial size */
  2168. resetWindow(): void;
  2169. protected _getTypeName(): string;
  2170. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2171. protected _postMeasure(): void;
  2172. /**
  2173. * Gets or sets the mouse wheel precision
  2174. * from 0 to 1 with a default value of 0.05
  2175. * */
  2176. wheelPrecision: number;
  2177. /** Gets or sets the bar color */
  2178. barColor: string;
  2179. /** Gets or sets the size of the bar */
  2180. barSize: number;
  2181. /** Gets or sets the bar background */
  2182. barBackground: string;
  2183. _link(host: AdvancedDynamicTexture): void;
  2184. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  2185. /** Releases associated resources */
  2186. dispose(): void;
  2187. }
  2188. }
  2189. declare module 'babylonjs-gui/2D/controls/textBlock' {
  2190. import { Observable } from "babylonjs";
  2191. import { Measure } from "babylonjs-gui/2D/measure";
  2192. import { Control } from "babylonjs-gui/2D/controls/control";
  2193. /**
  2194. * Enum that determines the text-wrapping mode to use.
  2195. */
  2196. export enum TextWrapping {
  2197. /**
  2198. * Clip the text when it's larger than Control.width; this is the default mode.
  2199. */
  2200. Clip = 0,
  2201. /**
  2202. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  2203. */
  2204. WordWrap = 1,
  2205. /**
  2206. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  2207. */
  2208. Ellipsis = 2
  2209. }
  2210. /**
  2211. * Class used to create text block control
  2212. */
  2213. export class TextBlock extends Control {
  2214. /**
  2215. * Defines the name of the control
  2216. */
  2217. name?: string | undefined;
  2218. /**
  2219. * An event triggered after the text is changed
  2220. */
  2221. onTextChangedObservable: Observable<TextBlock>;
  2222. /**
  2223. * An event triggered after the text was broken up into lines
  2224. */
  2225. onLinesReadyObservable: Observable<TextBlock>;
  2226. /**
  2227. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  2228. */
  2229. readonly lines: any[];
  2230. /**
  2231. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  2232. */
  2233. resizeToFit: boolean;
  2234. /**
  2235. * Gets or sets a boolean indicating if text must be wrapped
  2236. */
  2237. textWrapping: TextWrapping | boolean;
  2238. /**
  2239. * Gets or sets text to display
  2240. */
  2241. text: string;
  2242. /**
  2243. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  2244. */
  2245. textHorizontalAlignment: number;
  2246. /**
  2247. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  2248. */
  2249. textVerticalAlignment: number;
  2250. /**
  2251. * Gets or sets line spacing value
  2252. */
  2253. lineSpacing: string | number;
  2254. /**
  2255. * Gets or sets outlineWidth of the text to display
  2256. */
  2257. outlineWidth: number;
  2258. /**
  2259. * Gets or sets outlineColor of the text to display
  2260. */
  2261. outlineColor: string;
  2262. /**
  2263. * Creates a new TextBlock object
  2264. * @param name defines the name of the control
  2265. * @param text defines the text to display (emptry string by default)
  2266. */
  2267. constructor(
  2268. /**
  2269. * Defines the name of the control
  2270. */
  2271. name?: string | undefined, text?: string);
  2272. protected _getTypeName(): string;
  2273. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2274. /** @hidden */
  2275. _draw(context: CanvasRenderingContext2D): void;
  2276. protected _applyStates(context: CanvasRenderingContext2D): void;
  2277. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  2278. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  2279. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  2280. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  2281. protected _renderLines(context: CanvasRenderingContext2D): void;
  2282. /**
  2283. * Given a width constraint applied on the text block, find the expected height
  2284. * @returns expected height
  2285. */
  2286. computeExpectedHeight(): number;
  2287. dispose(): void;
  2288. }
  2289. }
  2290. declare module 'babylonjs-gui/2D/controls/virtualKeyboard' {
  2291. import { StackPanel } from "babylonjs-gui/2D/controls/stackPanel";
  2292. import { Observable, Nullable } from "babylonjs";
  2293. import { InputText } from "babylonjs-gui/2D/controls/inputText";
  2294. /**
  2295. * Class used to store key control properties
  2296. */
  2297. export class KeyPropertySet {
  2298. /** Width */
  2299. width?: string;
  2300. /** Height */
  2301. height?: string;
  2302. /** Left padding */
  2303. paddingLeft?: string;
  2304. /** Right padding */
  2305. paddingRight?: string;
  2306. /** Top padding */
  2307. paddingTop?: string;
  2308. /** Bottom padding */
  2309. paddingBottom?: string;
  2310. /** Foreground color */
  2311. color?: string;
  2312. /** Background color */
  2313. background?: string;
  2314. }
  2315. /**
  2316. * Class used to create virtual keyboard
  2317. */
  2318. export class VirtualKeyboard extends StackPanel {
  2319. /** Observable raised when a key is pressed */
  2320. onKeyPressObservable: Observable<string>;
  2321. /** Gets or sets default key button width */
  2322. defaultButtonWidth: string;
  2323. /** Gets or sets default key button height */
  2324. defaultButtonHeight: string;
  2325. /** Gets or sets default key button left padding */
  2326. defaultButtonPaddingLeft: string;
  2327. /** Gets or sets default key button right padding */
  2328. defaultButtonPaddingRight: string;
  2329. /** Gets or sets default key button top padding */
  2330. defaultButtonPaddingTop: string;
  2331. /** Gets or sets default key button bottom padding */
  2332. defaultButtonPaddingBottom: string;
  2333. /** Gets or sets default key button foreground color */
  2334. defaultButtonColor: string;
  2335. /** Gets or sets default key button background color */
  2336. defaultButtonBackground: string;
  2337. /** Gets or sets shift button foreground color */
  2338. shiftButtonColor: string;
  2339. /** Gets or sets shift button thickness*/
  2340. selectedShiftThickness: number;
  2341. /** Gets shift key state */
  2342. shiftState: number;
  2343. protected _getTypeName(): string;
  2344. /**
  2345. * Adds a new row of keys
  2346. * @param keys defines the list of keys to add
  2347. * @param propertySets defines the associated property sets
  2348. */
  2349. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  2350. /**
  2351. * Set the shift key to a specific state
  2352. * @param shiftState defines the new shift state
  2353. */
  2354. applyShiftState(shiftState: number): void;
  2355. /** Gets the input text control currently attached to the keyboard */
  2356. readonly connectedInputText: Nullable<InputText>;
  2357. /**
  2358. * Connects the keyboard with an input text control
  2359. *
  2360. * @param input defines the target control
  2361. */
  2362. connect(input: InputText): void;
  2363. /**
  2364. * Disconnects the keyboard from connected InputText controls
  2365. *
  2366. * @param input optionally defines a target control, otherwise all are disconnected
  2367. */
  2368. disconnect(input?: InputText): void;
  2369. /**
  2370. * Release all resources
  2371. */
  2372. dispose(): void;
  2373. /**
  2374. * Creates a new keyboard using a default layout
  2375. *
  2376. * @param name defines control name
  2377. * @returns a new VirtualKeyboard
  2378. */
  2379. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  2380. }
  2381. }
  2382. declare module 'babylonjs-gui/2D/controls/rectangle' {
  2383. import { Container } from "babylonjs-gui/2D/controls/container";
  2384. import { Measure } from "babylonjs-gui/2D/measure";
  2385. /** Class used to create rectangle container */
  2386. export class Rectangle extends Container {
  2387. name?: string | undefined;
  2388. /** Gets or sets border thickness */
  2389. thickness: number;
  2390. /** Gets or sets the corner radius angle */
  2391. cornerRadius: number;
  2392. /**
  2393. * Creates a new Rectangle
  2394. * @param name defines the control name
  2395. */
  2396. constructor(name?: string | undefined);
  2397. protected _getTypeName(): string;
  2398. protected _localDraw(context: CanvasRenderingContext2D): void;
  2399. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  2400. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  2401. }
  2402. }
  2403. declare module 'babylonjs-gui/2D/controls/displayGrid' {
  2404. import { Control } from "babylonjs-gui/2D/controls";
  2405. /** Class used to render a grid */
  2406. export class DisplayGrid extends Control {
  2407. name?: string | undefined;
  2408. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  2409. displayMinorLines: boolean;
  2410. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  2411. displayMajorLines: boolean;
  2412. /** Gets or sets background color (Black by default) */
  2413. background: string;
  2414. /** Gets or sets the width of each cell (20 by default) */
  2415. cellWidth: number;
  2416. /** Gets or sets the height of each cell (20 by default) */
  2417. cellHeight: number;
  2418. /** Gets or sets the tickness of minor lines (1 by default) */
  2419. minorLineTickness: number;
  2420. /** Gets or sets the color of minor lines (DarkGray by default) */
  2421. minorLineColor: string;
  2422. /** Gets or sets the tickness of major lines (2 by default) */
  2423. majorLineTickness: number;
  2424. /** Gets or sets the color of major lines (White by default) */
  2425. majorLineColor: string;
  2426. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  2427. majorLineFrequency: number;
  2428. /**
  2429. * Creates a new GridDisplayRectangle
  2430. * @param name defines the control name
  2431. */
  2432. constructor(name?: string | undefined);
  2433. _draw(context: CanvasRenderingContext2D): void;
  2434. protected _getTypeName(): string;
  2435. }
  2436. }
  2437. declare module 'babylonjs-gui/2D/controls/sliders/baseSlider' {
  2438. import { Control } from "babylonjs-gui/2D/controls/control";
  2439. import { ValueAndUnit } from "babylonjs-gui/2D/valueAndUnit";
  2440. import { Observable, Vector2 } from "babylonjs";
  2441. /**
  2442. * Class used to create slider controls
  2443. */
  2444. export class BaseSlider extends Control {
  2445. name?: string | undefined;
  2446. protected _thumbWidth: ValueAndUnit;
  2447. protected _barOffset: ValueAndUnit;
  2448. protected _displayThumb: boolean;
  2449. protected _effectiveBarOffset: number;
  2450. protected _renderLeft: number;
  2451. protected _renderTop: number;
  2452. protected _renderWidth: number;
  2453. protected _renderHeight: number;
  2454. protected _backgroundBoxLength: number;
  2455. protected _backgroundBoxThickness: number;
  2456. protected _effectiveThumbThickness: number;
  2457. /** Observable raised when the sldier value changes */
  2458. onValueChangedObservable: Observable<number>;
  2459. /** Gets or sets a boolean indicating if the thumb must be rendered */
  2460. displayThumb: boolean;
  2461. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  2462. barOffset: string | number;
  2463. /** Gets main bar offset in pixels*/
  2464. readonly barOffsetInPixels: number;
  2465. /** Gets or sets thumb width */
  2466. thumbWidth: string | number;
  2467. /** Gets thumb width in pixels */
  2468. readonly thumbWidthInPixels: number;
  2469. /** Gets or sets minimum value */
  2470. minimum: number;
  2471. /** Gets or sets maximum value */
  2472. maximum: number;
  2473. /** Gets or sets current value */
  2474. value: number;
  2475. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  2476. isVertical: boolean;
  2477. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  2478. isThumbClamped: boolean;
  2479. /**
  2480. * Creates a new BaseSlider
  2481. * @param name defines the control name
  2482. */
  2483. constructor(name?: string | undefined);
  2484. protected _getTypeName(): string;
  2485. protected _getThumbPosition(): number;
  2486. protected _getThumbThickness(type: string): number;
  2487. protected _prepareRenderingData(type: string): void;
  2488. /** @hidden */
  2489. protected _updateValueFromPointer(x: number, y: number): void;
  2490. _onPointerDown(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number): boolean;
  2491. _onPointerMove(target: Control, coordinates: Vector2): void;
  2492. _onPointerUp(target: Control, coordinates: Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2493. }
  2494. }
  2495. declare module 'babylonjs-gui/2D/controls/sliders/slider' {
  2496. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  2497. /**
  2498. * Class used to create slider controls
  2499. */
  2500. export class Slider extends BaseSlider {
  2501. name?: string | undefined;
  2502. protected _displayValueBar: boolean;
  2503. /** Gets or sets a boolean indicating if the value bar must be rendered */
  2504. displayValueBar: boolean;
  2505. /** Gets or sets border color */
  2506. borderColor: string;
  2507. /** Gets or sets background color */
  2508. background: string;
  2509. /** Gets or sets a boolean indicating if the thumb should be round or square */
  2510. isThumbCircle: boolean;
  2511. /**
  2512. * Creates a new Slider
  2513. * @param name defines the control name
  2514. */
  2515. constructor(name?: string | undefined);
  2516. protected _getTypeName(): string;
  2517. _draw(context: CanvasRenderingContext2D): void;
  2518. }
  2519. }
  2520. declare module 'babylonjs-gui/2D/controls/sliders/imageBasedSlider' {
  2521. import { BaseSlider } from "babylonjs-gui/2D/controls/sliders/baseSlider";
  2522. import { Image } from "babylonjs-gui/2D/controls/image";
  2523. /**
  2524. * Class used to create slider controls based on images
  2525. */
  2526. export class ImageBasedSlider extends BaseSlider {
  2527. name?: string | undefined;
  2528. displayThumb: boolean;
  2529. /**
  2530. * Gets or sets the image used to render the background
  2531. */
  2532. backgroundImage: Image;
  2533. /**
  2534. * Gets or sets the image used to render the value bar
  2535. */
  2536. valueBarImage: Image;
  2537. /**
  2538. * Gets or sets the image used to render the thumb
  2539. */
  2540. thumbImage: Image;
  2541. /**
  2542. * Creates a new ImageBasedSlider
  2543. * @param name defines the control name
  2544. */
  2545. constructor(name?: string | undefined);
  2546. protected _getTypeName(): string;
  2547. _draw(context: CanvasRenderingContext2D): void;
  2548. }
  2549. }
  2550. declare module 'babylonjs-gui/2D/controls/statics' {
  2551. /**
  2552. * Forcing an export so that this code will execute
  2553. * @hidden
  2554. */
  2555. const name = "Statics";
  2556. export { name };
  2557. }
  2558. declare module 'babylonjs-gui/3D/controls/abstractButton3D' {
  2559. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2560. import { TransformNode, Scene } from "babylonjs";
  2561. /**
  2562. * Class used as a root to all buttons
  2563. */
  2564. export class AbstractButton3D extends Control3D {
  2565. /**
  2566. * Creates a new button
  2567. * @param name defines the control name
  2568. */
  2569. constructor(name?: string);
  2570. protected _getTypeName(): string;
  2571. protected _createNode(scene: Scene): TransformNode;
  2572. }
  2573. }
  2574. declare module 'babylonjs-gui/3D/controls/button3D' {
  2575. import { AbstractButton3D } from "babylonjs-gui/3D/controls/abstractButton3D";
  2576. import { Material, int, Scene, TransformNode, AbstractMesh } from "babylonjs";
  2577. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2578. import { Control } from "babylonjs-gui/2D/controls/control";
  2579. /**
  2580. * Class used to create a button in 3D
  2581. */
  2582. export class Button3D extends AbstractButton3D {
  2583. /** @hidden */
  2584. protected _currentMaterial: Material;
  2585. /**
  2586. * Gets or sets the texture resolution used to render content (512 by default)
  2587. */
  2588. contentResolution: int;
  2589. /**
  2590. * Gets or sets the texture scale ratio used to render content (2 by default)
  2591. */
  2592. contentScaleRatio: number;
  2593. protected _disposeFacadeTexture(): void;
  2594. protected _resetContent(): void;
  2595. /**
  2596. * Creates a new button
  2597. * @param name defines the control name
  2598. */
  2599. constructor(name?: string);
  2600. /**
  2601. * Gets or sets the GUI 2D content used to display the button's facade
  2602. */
  2603. content: Control;
  2604. /**
  2605. * Apply the facade texture (created from the content property).
  2606. * This function can be overloaded by child classes
  2607. * @param facadeTexture defines the AdvancedDynamicTexture to use
  2608. */
  2609. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2610. protected _getTypeName(): string;
  2611. protected _createNode(scene: Scene): TransformNode;
  2612. protected _affectMaterial(mesh: AbstractMesh): void;
  2613. /**
  2614. * Releases all associated resources
  2615. */
  2616. dispose(): void;
  2617. }
  2618. }
  2619. declare module 'babylonjs-gui/3D/controls/container3D' {
  2620. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2621. import { Scene, Nullable, TransformNode } from "babylonjs";
  2622. /**
  2623. * Class used to create containers for controls
  2624. */
  2625. export class Container3D extends Control3D {
  2626. /**
  2627. * Gets the list of child controls
  2628. */
  2629. protected _children: Control3D[];
  2630. /**
  2631. * Gets the list of child controls
  2632. */
  2633. readonly children: Array<Control3D>;
  2634. /**
  2635. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  2636. * This is helpful to optimize layout operation when adding multiple children in a row
  2637. */
  2638. blockLayout: boolean;
  2639. /**
  2640. * Creates a new container
  2641. * @param name defines the container name
  2642. */
  2643. constructor(name?: string);
  2644. /**
  2645. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  2646. * @returns the current container
  2647. */
  2648. updateLayout(): Container3D;
  2649. /**
  2650. * Gets a boolean indicating if the given control is in the children of this control
  2651. * @param control defines the control to check
  2652. * @returns true if the control is in the child list
  2653. */
  2654. containsControl(control: Control3D): boolean;
  2655. /**
  2656. * Adds a control to the children of this control
  2657. * @param control defines the control to add
  2658. * @returns the current container
  2659. */
  2660. addControl(control: Control3D): Container3D;
  2661. /**
  2662. * This function will be called everytime a new control is added
  2663. */
  2664. protected _arrangeChildren(): void;
  2665. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2666. /**
  2667. * Removes a control from the children of this control
  2668. * @param control defines the control to remove
  2669. * @returns the current container
  2670. */
  2671. removeControl(control: Control3D): Container3D;
  2672. protected _getTypeName(): string;
  2673. /**
  2674. * Releases all associated resources
  2675. */
  2676. dispose(): void;
  2677. /** Control rotation will remain unchanged */
  2678. static readonly UNSET_ORIENTATION: number;
  2679. /** Control will rotate to make it look at sphere central axis */
  2680. static readonly FACEORIGIN_ORIENTATION: number;
  2681. /** Control will rotate to make it look back at sphere central axis */
  2682. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  2683. /** Control will rotate to look at z axis (0, 0, 1) */
  2684. static readonly FACEFORWARD_ORIENTATION: number;
  2685. /** Control will rotate to look at negative z axis (0, 0, -1) */
  2686. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  2687. }
  2688. }
  2689. declare module 'babylonjs-gui/3D/controls/control3D' {
  2690. import { IDisposable, IBehaviorAware, Nullable, TransformNode, Vector3, Observable, Behavior, AbstractMesh, Scene } from "babylonjs";
  2691. import { GUI3DManager } from "babylonjs-gui/3D/gui3DManager";
  2692. import { Vector3WithInfo } from "babylonjs-gui/3D/vector3WithInfo";
  2693. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2694. /**
  2695. * Class used as base class for controls
  2696. */
  2697. export class Control3D implements IDisposable, IBehaviorAware<Control3D> {
  2698. /** Defines the control name */
  2699. name?: string | undefined;
  2700. /** @hidden */
  2701. _host: GUI3DManager;
  2702. /** Gets or sets the control position in world space */
  2703. position: Vector3;
  2704. /** Gets or sets the control scaling in world space */
  2705. scaling: Vector3;
  2706. /** Callback used to start pointer enter animation */
  2707. pointerEnterAnimation: () => void;
  2708. /** Callback used to start pointer out animation */
  2709. pointerOutAnimation: () => void;
  2710. /** Callback used to start pointer down animation */
  2711. pointerDownAnimation: () => void;
  2712. /** Callback used to start pointer up animation */
  2713. pointerUpAnimation: () => void;
  2714. /**
  2715. * An event triggered when the pointer move over the control
  2716. */
  2717. onPointerMoveObservable: Observable<Vector3>;
  2718. /**
  2719. * An event triggered when the pointer move out of the control
  2720. */
  2721. onPointerOutObservable: Observable<Control3D>;
  2722. /**
  2723. * An event triggered when the pointer taps the control
  2724. */
  2725. onPointerDownObservable: Observable<Vector3WithInfo>;
  2726. /**
  2727. * An event triggered when pointer is up
  2728. */
  2729. onPointerUpObservable: Observable<Vector3WithInfo>;
  2730. /**
  2731. * An event triggered when a control is clicked on (with a mouse)
  2732. */
  2733. onPointerClickObservable: Observable<Vector3WithInfo>;
  2734. /**
  2735. * An event triggered when pointer enters the control
  2736. */
  2737. onPointerEnterObservable: Observable<Control3D>;
  2738. /**
  2739. * Gets or sets the parent container
  2740. */
  2741. parent: Nullable<Container3D>;
  2742. /**
  2743. * Gets the list of attached behaviors
  2744. * @see http://doc.babylonjs.com/features/behaviour
  2745. */
  2746. readonly behaviors: Behavior<Control3D>[];
  2747. /**
  2748. * Attach a behavior to the control
  2749. * @see http://doc.babylonjs.com/features/behaviour
  2750. * @param behavior defines the behavior to attach
  2751. * @returns the current control
  2752. */
  2753. addBehavior(behavior: Behavior<Control3D>): Control3D;
  2754. /**
  2755. * Remove an attached behavior
  2756. * @see http://doc.babylonjs.com/features/behaviour
  2757. * @param behavior defines the behavior to attach
  2758. * @returns the current control
  2759. */
  2760. removeBehavior(behavior: Behavior<Control3D>): Control3D;
  2761. /**
  2762. * Gets an attached behavior by name
  2763. * @param name defines the name of the behavior to look for
  2764. * @see http://doc.babylonjs.com/features/behaviour
  2765. * @returns null if behavior was not found else the requested behavior
  2766. */
  2767. getBehaviorByName(name: string): Nullable<Behavior<Control3D>>;
  2768. /** Gets or sets a boolean indicating if the control is visible */
  2769. isVisible: boolean;
  2770. /**
  2771. * Creates a new control
  2772. * @param name defines the control name
  2773. */
  2774. constructor(
  2775. /** Defines the control name */
  2776. name?: string | undefined);
  2777. /**
  2778. * Gets a string representing the class name
  2779. */
  2780. readonly typeName: string;
  2781. /**
  2782. * Get the current class name of the control.
  2783. * @returns current class name
  2784. */
  2785. getClassName(): string;
  2786. protected _getTypeName(): string;
  2787. /**
  2788. * Gets the transform node used by this control
  2789. */
  2790. readonly node: Nullable<TransformNode>;
  2791. /**
  2792. * Gets the mesh used to render this control
  2793. */
  2794. readonly mesh: Nullable<AbstractMesh>;
  2795. /**
  2796. * Link the control as child of the given node
  2797. * @param node defines the node to link to. Use null to unlink the control
  2798. * @returns the current control
  2799. */
  2800. linkToTransformNode(node: Nullable<TransformNode>): Control3D;
  2801. /** @hidden **/
  2802. _prepareNode(scene: Scene): void;
  2803. /**
  2804. * Node creation.
  2805. * Can be overriden by children
  2806. * @param scene defines the scene where the node must be attached
  2807. * @returns the attached node or null if none. Must return a Mesh or AbstractMesh if there is an atttached visible object
  2808. */
  2809. protected _createNode(scene: Scene): Nullable<TransformNode>;
  2810. /**
  2811. * Affect a material to the given mesh
  2812. * @param mesh defines the mesh which will represent the control
  2813. */
  2814. protected _affectMaterial(mesh: AbstractMesh): void;
  2815. /** @hidden */
  2816. _onPointerMove(target: Control3D, coordinates: Vector3): void;
  2817. /** @hidden */
  2818. _onPointerEnter(target: Control3D): boolean;
  2819. /** @hidden */
  2820. _onPointerOut(target: Control3D): void;
  2821. /** @hidden */
  2822. _onPointerDown(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number): boolean;
  2823. /** @hidden */
  2824. _onPointerUp(target: Control3D, coordinates: Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  2825. /** @hidden */
  2826. forcePointerUp(pointerId?: Nullable<number>): void;
  2827. /** @hidden */
  2828. _processObservables(type: number, pickedPoint: Vector3, pointerId: number, buttonIndex: number): boolean;
  2829. /** @hidden */
  2830. _disposeNode(): void;
  2831. /**
  2832. * Releases all associated resources
  2833. */
  2834. dispose(): void;
  2835. }
  2836. }
  2837. declare module 'babylonjs-gui/3D/controls/cylinderPanel' {
  2838. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2839. import { float, Vector3 } from "babylonjs";
  2840. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2841. /**
  2842. * Class used to create a container panel deployed on the surface of a cylinder
  2843. */
  2844. export class CylinderPanel extends VolumeBasedPanel {
  2845. /**
  2846. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  2847. */
  2848. radius: float;
  2849. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2850. }
  2851. }
  2852. declare module 'babylonjs-gui/3D/controls/holographicButton' {
  2853. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2854. import { Mesh, StandardMaterial, Nullable, Scene, TransformNode } from "babylonjs";
  2855. import { FluentMaterial } from "babylonjs-gui/3D/materials/fluentMaterial";
  2856. import { AdvancedDynamicTexture } from "babylonjs-gui/2D/advancedDynamicTexture";
  2857. /**
  2858. * Class used to create a holographic button in 3D
  2859. */
  2860. export class HolographicButton extends Button3D {
  2861. /**
  2862. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  2863. */
  2864. tooltipText: Nullable<string>;
  2865. /**
  2866. * Gets or sets text for the button
  2867. */
  2868. text: string;
  2869. /**
  2870. * Gets or sets the image url for the button
  2871. */
  2872. imageUrl: string;
  2873. /**
  2874. * Gets the back material used by this button
  2875. */
  2876. readonly backMaterial: FluentMaterial;
  2877. /**
  2878. * Gets the front material used by this button
  2879. */
  2880. readonly frontMaterial: FluentMaterial;
  2881. /**
  2882. * Gets the plate material used by this button
  2883. */
  2884. readonly plateMaterial: StandardMaterial;
  2885. /**
  2886. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  2887. */
  2888. readonly shareMaterials: boolean;
  2889. /**
  2890. * Creates a new button
  2891. * @param name defines the control name
  2892. */
  2893. constructor(name?: string, shareMaterials?: boolean);
  2894. protected _getTypeName(): string;
  2895. protected _createNode(scene: Scene): TransformNode;
  2896. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  2897. protected _affectMaterial(mesh: Mesh): void;
  2898. /**
  2899. * Releases all associated resources
  2900. */
  2901. dispose(): void;
  2902. }
  2903. }
  2904. declare module 'babylonjs-gui/3D/controls/meshButton3D' {
  2905. import { Scene, TransformNode, AbstractMesh, Mesh } from "babylonjs";
  2906. import { Button3D } from "babylonjs-gui/3D/controls/button3D";
  2907. /**
  2908. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  2909. */
  2910. export class MeshButton3D extends Button3D {
  2911. /** @hidden */
  2912. protected _currentMesh: Mesh;
  2913. /**
  2914. * Creates a new 3D button based on a mesh
  2915. * @param mesh mesh to become a 3D button
  2916. * @param name defines the control name
  2917. */
  2918. constructor(mesh: Mesh, name?: string);
  2919. protected _getTypeName(): string;
  2920. protected _createNode(scene: Scene): TransformNode;
  2921. protected _affectMaterial(mesh: AbstractMesh): void;
  2922. }
  2923. }
  2924. declare module 'babylonjs-gui/3D/controls/planePanel' {
  2925. import { Vector3 } from "babylonjs";
  2926. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2927. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2928. /**
  2929. * Class used to create a container panel deployed on the surface of a plane
  2930. */
  2931. export class PlanePanel extends VolumeBasedPanel {
  2932. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2933. }
  2934. }
  2935. declare module 'babylonjs-gui/3D/controls/scatterPanel' {
  2936. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2937. import { float, Vector3 } from "babylonjs";
  2938. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2939. /**
  2940. * Class used to create a container panel where items get randomized planar mapping
  2941. */
  2942. export class ScatterPanel extends VolumeBasedPanel {
  2943. /**
  2944. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  2945. */
  2946. iteration: float;
  2947. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2948. protected _finalProcessing(): void;
  2949. }
  2950. }
  2951. declare module 'babylonjs-gui/3D/controls/spherePanel' {
  2952. import { VolumeBasedPanel } from "babylonjs-gui/3D/controls/volumeBasedPanel";
  2953. import { float, Vector3 } from "babylonjs";
  2954. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2955. /**
  2956. * Class used to create a container panel deployed on the surface of a sphere
  2957. */
  2958. export class SpherePanel extends VolumeBasedPanel {
  2959. /**
  2960. * Gets or sets the radius of the sphere where to project controls (5 by default)
  2961. */
  2962. radius: float;
  2963. protected _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  2964. }
  2965. }
  2966. declare module 'babylonjs-gui/3D/controls/stackPanel3D' {
  2967. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2968. /**
  2969. * Class used to create a stack panel in 3D on XY plane
  2970. */
  2971. export class StackPanel3D extends Container3D {
  2972. /**
  2973. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  2974. */
  2975. isVertical: boolean;
  2976. /**
  2977. * Gets or sets the distance between elements
  2978. */
  2979. margin: number;
  2980. /**
  2981. * Creates new StackPanel
  2982. * @param isVertical
  2983. */
  2984. constructor(isVertical?: boolean);
  2985. protected _arrangeChildren(): void;
  2986. }
  2987. }
  2988. declare module 'babylonjs-gui/3D/controls/volumeBasedPanel' {
  2989. import { Container3D } from "babylonjs-gui/3D/controls/container3D";
  2990. import { int, Vector3 } from "babylonjs";
  2991. import { Control3D } from "babylonjs-gui/3D/controls/control3D";
  2992. /**
  2993. * Abstract class used to create a container panel deployed on the surface of a volume
  2994. */
  2995. export abstract class VolumeBasedPanel extends Container3D {
  2996. protected _cellWidth: number;
  2997. protected _cellHeight: number;
  2998. /**
  2999. * Gets or sets the distance between elements
  3000. */
  3001. margin: number;
  3002. /**
  3003. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  3004. * | Value | Type | Description |
  3005. * | ----- | ----------------------------------- | ----------- |
  3006. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  3007. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  3008. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  3009. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  3010. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  3011. */
  3012. orientation: number;
  3013. /**
  3014. * Gets or sets the number of columns requested (10 by default).
  3015. * The panel will automatically compute the number of rows based on number of child controls.
  3016. */
  3017. columns: int;
  3018. /**
  3019. * Gets or sets a the number of rows requested.
  3020. * The panel will automatically compute the number of columns based on number of child controls.
  3021. */
  3022. rows: int;
  3023. /**
  3024. * Creates new VolumeBasedPanel
  3025. */
  3026. constructor();
  3027. protected _arrangeChildren(): void;
  3028. /** Child classes must implement this function to provide correct control positioning */
  3029. protected abstract _mapGridNode(control: Control3D, nodePosition: Vector3): void;
  3030. /** Child classes can implement this function to provide additional processing */
  3031. protected _finalProcessing(): void;
  3032. }
  3033. }
  3034. declare module 'babylonjs-gui/3D/materials/fluentMaterial' {
  3035. import { MaterialDefines, PushMaterial, Color3, Color4, Vector3, Scene, Nullable, BaseTexture, AbstractMesh, SubMesh, Matrix, Mesh } from "babylonjs";
  3036. /** @hidden */
  3037. export class FluentMaterialDefines extends MaterialDefines {
  3038. INNERGLOW: boolean;
  3039. BORDER: boolean;
  3040. HOVERLIGHT: boolean;
  3041. TEXTURE: boolean;
  3042. constructor();
  3043. }
  3044. /**
  3045. * Class used to render controls with fluent desgin
  3046. */
  3047. export class FluentMaterial extends PushMaterial {
  3048. /**
  3049. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  3050. */
  3051. innerGlowColorIntensity: number;
  3052. /**
  3053. * Gets or sets the inner glow color (white by default)
  3054. */
  3055. innerGlowColor: Color3;
  3056. /**
  3057. * Gets or sets alpha value (default is 1.0)
  3058. */
  3059. alpha: number;
  3060. /**
  3061. * Gets or sets the albedo color (Default is Color3(0.3, 0.35, 0.4))
  3062. */
  3063. albedoColor: Color3;
  3064. /**
  3065. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  3066. */
  3067. renderBorders: boolean;
  3068. /**
  3069. * Gets or sets border width (default is 0.5)
  3070. */
  3071. borderWidth: number;
  3072. /**
  3073. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  3074. */
  3075. edgeSmoothingValue: number;
  3076. /**
  3077. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  3078. */
  3079. borderMinValue: number;
  3080. /**
  3081. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  3082. */
  3083. renderHoverLight: boolean;
  3084. /**
  3085. * Gets or sets the radius used to render the hover light (default is 1.0)
  3086. */
  3087. hoverRadius: number;
  3088. /**
  3089. * Gets or sets the color used to render the hover light (default is Color4(0.3, 0.3, 0.3, 1.0))
  3090. */
  3091. hoverColor: Color4;
  3092. /**
  3093. * Gets or sets the hover light position in world space (default is Vector3.Zero())
  3094. */
  3095. hoverPosition: Vector3;
  3096. /** Gets or sets the texture to use for albedo color */
  3097. albedoTexture: Nullable<BaseTexture>;
  3098. /**
  3099. * Creates a new Fluent material
  3100. * @param name defines the name of the material
  3101. * @param scene defines the hosting scene
  3102. */
  3103. constructor(name: string, scene: Scene);
  3104. needAlphaBlending(): boolean;
  3105. needAlphaTesting(): boolean;
  3106. getAlphaTestTexture(): Nullable<BaseTexture>;
  3107. isReadyForSubMesh(mesh: AbstractMesh, subMesh: SubMesh, useInstances?: boolean): boolean;
  3108. bindForSubMesh(world: Matrix, mesh: Mesh, subMesh: SubMesh): void;
  3109. getActiveTextures(): BaseTexture[];
  3110. hasTexture(texture: BaseTexture): boolean;
  3111. dispose(forceDisposeEffect?: boolean): void;
  3112. clone(name: string): FluentMaterial;
  3113. serialize(): any;
  3114. getClassName(): string;
  3115. static Parse(source: any, scene: Scene, rootUrl: string): FluentMaterial;
  3116. }
  3117. }
  3118. /*Babylon.js GUI*/
  3119. // Dependencies for this module:
  3120. // ../../../../Tools/Gulp/babylonjs
  3121. // ../../../../Tools/Gulp/2D
  3122. declare module BABYLON.GUI {
  3123. }
  3124. declare module BABYLON.GUI {
  3125. }
  3126. declare module BABYLON.GUI {
  3127. }
  3128. declare module BABYLON.GUI {
  3129. }
  3130. declare module BABYLON.GUI {
  3131. /**
  3132. * Interface used to define a control that can receive focus
  3133. */
  3134. export interface IFocusableControl {
  3135. /**
  3136. * Function called when the control receives the focus
  3137. */
  3138. onFocus(): void;
  3139. /**
  3140. * Function called when the control loses the focus
  3141. */
  3142. onBlur(): void;
  3143. /**
  3144. * Function called to let the control handle keyboard events
  3145. * @param evt defines the current keyboard event
  3146. */
  3147. processKeyboard(evt: KeyboardEvent): void;
  3148. /**
  3149. * Function called to get the list of controls that should not steal the focus from this control
  3150. * @returns an array of controls
  3151. */
  3152. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  3153. }
  3154. /**
  3155. * Class used to create texture to support 2D GUI elements
  3156. * @see http://doc.babylonjs.com/how_to/gui
  3157. */
  3158. export class AdvancedDynamicTexture extends BABYLON.DynamicTexture {
  3159. /** @hidden */
  3160. _rootContainer: Container;
  3161. /** @hidden */
  3162. _lastPickedControl: Control;
  3163. /** @hidden */
  3164. _lastControlOver: {
  3165. [pointerId: number]: Control;
  3166. };
  3167. /** @hidden */
  3168. _lastControlDown: {
  3169. [pointerId: number]: Control;
  3170. };
  3171. /** @hidden */
  3172. _capturingControl: {
  3173. [pointerId: number]: Control;
  3174. };
  3175. /** @hidden */
  3176. _shouldBlockPointer: boolean;
  3177. /** @hidden */
  3178. _layerToDispose: BABYLON.Nullable<BABYLON.Layer>;
  3179. /** @hidden */
  3180. _linkedControls: Control[];
  3181. /**
  3182. * BABYLON.Observable event triggered each time an clipboard event is received from the rendering canvas
  3183. */
  3184. onClipboardObservable: BABYLON.Observable<BABYLON.ClipboardInfo>;
  3185. /**
  3186. * BABYLON.Observable event triggered each time a pointer down is intercepted by a control
  3187. */
  3188. onControlPickedObservable: BABYLON.Observable<Control>;
  3189. /**
  3190. * Gets or sets a boolean defining if alpha is stored as premultiplied
  3191. */
  3192. premulAlpha: boolean;
  3193. /**
  3194. * Gets or sets a number used to scale rendering size (2 means that the texture will be twice bigger).
  3195. * Useful when you want more antialiasing
  3196. */
  3197. renderScale: number;
  3198. /** Gets or sets the background color */
  3199. background: string;
  3200. /**
  3201. * Gets or sets the ideal width 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. idealWidth: number;
  3206. /**
  3207. * Gets or sets the ideal height used to design controls.
  3208. * The GUI will then rescale everything accordingly
  3209. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3210. */
  3211. idealHeight: number;
  3212. /**
  3213. * Gets or sets a boolean indicating if the smallest ideal value must be used if idealWidth and idealHeight are both set
  3214. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3215. */
  3216. useSmallestIdeal: boolean;
  3217. /**
  3218. * Gets or sets a boolean indicating if adaptive scaling must be used
  3219. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3220. */
  3221. renderAtIdealSize: boolean;
  3222. /**
  3223. * Gets the underlying layer used to render the texture when in fullscreen mode
  3224. */
  3225. readonly layer: BABYLON.Nullable<BABYLON.Layer>;
  3226. /**
  3227. * Gets the root container control
  3228. */
  3229. readonly rootContainer: Container;
  3230. /**
  3231. * Returns an array containing the root container.
  3232. * This is mostly used to let the Inspector introspects the ADT
  3233. * @returns an array containing the rootContainer
  3234. */
  3235. getChildren(): Array<Container>;
  3236. /**
  3237. * Will return all controls that are inside this texture
  3238. * @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
  3239. * @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
  3240. * @return all child controls
  3241. */
  3242. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  3243. /**
  3244. * Gets or sets the current focused control
  3245. */
  3246. focusedControl: BABYLON.Nullable<IFocusableControl>;
  3247. /**
  3248. * Gets or sets a boolean indicating if the texture must be rendered in background or foreground when in fullscreen mode
  3249. */
  3250. isForeground: boolean;
  3251. /**
  3252. * Gets or set information about clipboardData
  3253. */
  3254. clipboardData: string;
  3255. /**
  3256. * Creates a new AdvancedDynamicTexture
  3257. * @param name defines the name of the texture
  3258. * @param width defines the width of the texture
  3259. * @param height defines the height of the texture
  3260. * @param scene defines the hosting scene
  3261. * @param generateMipMaps defines a boolean indicating if mipmaps must be generated (false by default)
  3262. * @param samplingMode defines the texture sampling mode (Texture.NEAREST_SAMPLINGMODE by default)
  3263. */
  3264. constructor(name: string, width: number | undefined, height: number | undefined, scene: BABYLON.Nullable<BABYLON.Scene>, generateMipMaps?: boolean, samplingMode?: number);
  3265. /**
  3266. * Get the current class name of the texture useful for serialization or dynamic coding.
  3267. * @returns "AdvancedDynamicTexture"
  3268. */
  3269. getClassName(): string;
  3270. /**
  3271. * Function used to execute a function on all controls
  3272. * @param func defines the function to execute
  3273. * @param container defines the container where controls belong. If null the root container will be used
  3274. */
  3275. executeOnAllControls(func: (control: Control) => void, container?: Container): void;
  3276. /**
  3277. * Marks the texture as dirty forcing a complete update
  3278. */
  3279. markAsDirty(): void;
  3280. /**
  3281. * Helper function used to create a new style
  3282. * @returns a new style
  3283. * @see http://doc.babylonjs.com/how_to/gui#styles
  3284. */
  3285. createStyle(): Style;
  3286. /**
  3287. * Adds a new control to the root container
  3288. * @param control defines the control to add
  3289. * @returns the current texture
  3290. */
  3291. addControl(control: Control): AdvancedDynamicTexture;
  3292. /**
  3293. * Removes a control from the root container
  3294. * @param control defines the control to remove
  3295. * @returns the current texture
  3296. */
  3297. removeControl(control: Control): AdvancedDynamicTexture;
  3298. /**
  3299. * Release all resources
  3300. */
  3301. dispose(): void;
  3302. /** @hidden */
  3303. _getGlobalViewport(scene: BABYLON.Scene): BABYLON.Viewport;
  3304. /**
  3305. * Get screen coordinates for a vector3
  3306. * @param position defines the position to project
  3307. * @param worldMatrix defines the world matrix to use
  3308. * @returns the projected position
  3309. */
  3310. getProjectedPosition(position: BABYLON.Vector3, worldMatrix: BABYLON.Matrix): BABYLON.Vector2;
  3311. /** @hidden */
  3312. _changeCursor(cursor: string): void;
  3313. /** @hidden */
  3314. _registerLastControlDown(control: Control, pointerId: number): void;
  3315. /** @hidden */
  3316. _cleanControlAfterRemovalFromList(list: {
  3317. [pointerId: number]: Control;
  3318. }, control: Control): void;
  3319. /** @hidden */
  3320. _cleanControlAfterRemoval(control: Control): void;
  3321. /** Attach to all scene events required to support pointer events */
  3322. attach(): void;
  3323. /**
  3324. * Register the clipboard Events onto the canvas
  3325. */
  3326. registerClipboardEvents(): void;
  3327. /**
  3328. * Unregister the clipboard Events from the canvas
  3329. */
  3330. unRegisterClipboardEvents(): void;
  3331. /**
  3332. * Connect the texture to a hosting mesh to enable interactions
  3333. * @param mesh defines the mesh to attach to
  3334. * @param supportPointerMove defines a boolean indicating if pointer move events must be catched as well
  3335. */
  3336. attachToMesh(mesh: BABYLON.AbstractMesh, supportPointerMove?: boolean): void;
  3337. /**
  3338. * Move the focus to a specific control
  3339. * @param control defines the control which will receive the focus
  3340. */
  3341. moveFocusToControl(control: IFocusableControl): void;
  3342. /**
  3343. * Creates a new AdvancedDynamicTexture in projected mode (ie. attached to a mesh)
  3344. * @param mesh defines the mesh which will receive the texture
  3345. * @param width defines the texture width (1024 by default)
  3346. * @param height defines the texture height (1024 by default)
  3347. * @param supportPointerMove defines a boolean indicating if the texture must capture move events (true by default)
  3348. * @param onlyAlphaTesting defines a boolean indicating that alpha blending will not be used (only alpha testing) (false by default)
  3349. * @returns a new AdvancedDynamicTexture
  3350. */
  3351. static CreateForMesh(mesh: BABYLON.AbstractMesh, width?: number, height?: number, supportPointerMove?: boolean, onlyAlphaTesting?: boolean): AdvancedDynamicTexture;
  3352. /**
  3353. * Creates a new AdvancedDynamicTexture in fullscreen mode.
  3354. * In this mode the texture will rely on a layer for its rendering.
  3355. * This allows it to be treated like any other layer.
  3356. * As such, if you have a multi camera setup, you can set the layerMask on the GUI as well.
  3357. * LayerMask is set through advancedTexture.layer.layerMask
  3358. * @param name defines name for the texture
  3359. * @param foreground defines a boolean indicating if the texture must be rendered in foreground (default is true)
  3360. * @param scene defines the hsoting scene
  3361. * @param sampling defines the texture sampling mode (Texture.BILINEAR_SAMPLINGMODE by default)
  3362. * @returns a new AdvancedDynamicTexture
  3363. */
  3364. static CreateFullscreenUI(name: string, foreground?: boolean, scene?: BABYLON.Nullable<BABYLON.Scene>, sampling?: number): AdvancedDynamicTexture;
  3365. }
  3366. }
  3367. declare module BABYLON.GUI {
  3368. /**
  3369. * Class used to transport BABYLON.Vector2 information for pointer events
  3370. */
  3371. export class Vector2WithInfo extends BABYLON.Vector2 {
  3372. /** defines the current mouse button index */
  3373. buttonIndex: number;
  3374. /**
  3375. * Creates a new Vector2WithInfo
  3376. * @param source defines the vector2 data to transport
  3377. * @param buttonIndex defines the current mouse button index
  3378. */
  3379. constructor(source: BABYLON.Vector2,
  3380. /** defines the current mouse button index */
  3381. buttonIndex?: number);
  3382. }
  3383. /** Class used to provide 2D matrix features */
  3384. export class Matrix2D {
  3385. /** Gets the internal array of 6 floats used to store matrix data */
  3386. m: Float32Array;
  3387. /**
  3388. * Creates a new matrix
  3389. * @param m00 defines value for (0, 0)
  3390. * @param m01 defines value for (0, 1)
  3391. * @param m10 defines value for (1, 0)
  3392. * @param m11 defines value for (1, 1)
  3393. * @param m20 defines value for (2, 0)
  3394. * @param m21 defines value for (2, 1)
  3395. */
  3396. constructor(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number);
  3397. /**
  3398. * Fills the matrix from direct values
  3399. * @param m00 defines value for (0, 0)
  3400. * @param m01 defines value for (0, 1)
  3401. * @param m10 defines value for (1, 0)
  3402. * @param m11 defines value for (1, 1)
  3403. * @param m20 defines value for (2, 0)
  3404. * @param m21 defines value for (2, 1)
  3405. * @returns the current modified matrix
  3406. */
  3407. fromValues(m00: number, m01: number, m10: number, m11: number, m20: number, m21: number): Matrix2D;
  3408. /**
  3409. * Gets matrix determinant
  3410. * @returns the determinant
  3411. */
  3412. determinant(): number;
  3413. /**
  3414. * Inverses the matrix and stores it in a target matrix
  3415. * @param result defines the target matrix
  3416. * @returns the current matrix
  3417. */
  3418. invertToRef(result: Matrix2D): Matrix2D;
  3419. /**
  3420. * Multiplies the current matrix with another one
  3421. * @param other defines the second operand
  3422. * @param result defines the target matrix
  3423. * @returns the current matrix
  3424. */
  3425. multiplyToRef(other: Matrix2D, result: Matrix2D): Matrix2D;
  3426. /**
  3427. * Applies the current matrix to a set of 2 floats and stores the result in a vector2
  3428. * @param x defines the x coordinate to transform
  3429. * @param y defines the x coordinate to transform
  3430. * @param result defines the target vector2
  3431. * @returns the current matrix
  3432. */
  3433. transformCoordinates(x: number, y: number, result: BABYLON.Vector2): Matrix2D;
  3434. /**
  3435. * Creates an identity matrix
  3436. * @returns a new matrix
  3437. */
  3438. static Identity(): Matrix2D;
  3439. /**
  3440. * Creates a translation matrix and stores it in a target matrix
  3441. * @param x defines the x coordinate of the translation
  3442. * @param y defines the y coordinate of the translation
  3443. * @param result defines the target matrix
  3444. */
  3445. static TranslationToRef(x: number, y: number, result: Matrix2D): void;
  3446. /**
  3447. * Creates a scaling matrix and stores it in a target matrix
  3448. * @param x defines the x coordinate of the scaling
  3449. * @param y defines the y coordinate of the scaling
  3450. * @param result defines the target matrix
  3451. */
  3452. static ScalingToRef(x: number, y: number, result: Matrix2D): void;
  3453. /**
  3454. * Creates a rotation matrix and stores it in a target matrix
  3455. * @param angle defines the rotation angle
  3456. * @param result defines the target matrix
  3457. */
  3458. static RotationToRef(angle: number, result: Matrix2D): void;
  3459. /**
  3460. * Composes a matrix from translation, rotation, scaling and parent matrix and stores it in a target matrix
  3461. * @param tx defines the x coordinate of the translation
  3462. * @param ty defines the y coordinate of the translation
  3463. * @param angle defines the rotation angle
  3464. * @param scaleX defines the x coordinate of the scaling
  3465. * @param scaleY defines the y coordinate of the scaling
  3466. * @param parentMatrix defines the parent matrix to multiply by (can be null)
  3467. * @param result defines the target matrix
  3468. */
  3469. static ComposeToRef(tx: number, ty: number, angle: number, scaleX: number, scaleY: number, parentMatrix: BABYLON.Nullable<Matrix2D>, result: Matrix2D): void;
  3470. }
  3471. }
  3472. declare module BABYLON.GUI {
  3473. /**
  3474. * Class used to store 2D control sizes
  3475. */
  3476. export class Measure {
  3477. /** defines left coordinate */
  3478. left: number;
  3479. /** defines top coordinate */
  3480. top: number;
  3481. /** defines width dimension */
  3482. width: number;
  3483. /** defines height dimension */
  3484. height: number;
  3485. /**
  3486. * Creates a new measure
  3487. * @param left defines left coordinate
  3488. * @param top defines top coordinate
  3489. * @param width defines width dimension
  3490. * @param height defines height dimension
  3491. */
  3492. constructor(
  3493. /** defines left coordinate */
  3494. left: number,
  3495. /** defines top coordinate */
  3496. top: number,
  3497. /** defines width dimension */
  3498. width: number,
  3499. /** defines height dimension */
  3500. height: number);
  3501. /**
  3502. * Copy from another measure
  3503. * @param other defines the other measure to copy from
  3504. */
  3505. copyFrom(other: Measure): void;
  3506. /**
  3507. * Copy from a group of 4 floats
  3508. * @param left defines left coordinate
  3509. * @param top defines top coordinate
  3510. * @param width defines width dimension
  3511. * @param height defines height dimension
  3512. */
  3513. copyFromFloats(left: number, top: number, width: number, height: number): void;
  3514. /**
  3515. * Check equality between this measure and another one
  3516. * @param other defines the other measures
  3517. * @returns true if both measures are equals
  3518. */
  3519. isEqualsTo(other: Measure): boolean;
  3520. /**
  3521. * Creates an empty measure
  3522. * @returns a new measure
  3523. */
  3524. static Empty(): Measure;
  3525. }
  3526. }
  3527. declare module BABYLON.GUI {
  3528. /**
  3529. * Class used to store a point for a MultiLine object.
  3530. * The point can be pure 2D coordinates, a mesh or a control
  3531. */
  3532. export class MultiLinePoint {
  3533. /** @hidden */
  3534. _point: BABYLON.Vector2;
  3535. /**
  3536. * Creates a new MultiLinePoint
  3537. * @param multiLine defines the source MultiLine object
  3538. */
  3539. constructor(multiLine: MultiLine);
  3540. /** Gets or sets x coordinate */
  3541. x: string | number;
  3542. /** Gets or sets y coordinate */
  3543. y: string | number;
  3544. /** Gets or sets the control associated with this point */
  3545. control: BABYLON.Nullable<Control>;
  3546. /** Gets or sets the mesh associated with this point */
  3547. mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  3548. /** Resets links */
  3549. resetLinks(): void;
  3550. /**
  3551. * Gets a translation vector
  3552. * @returns the translation vector
  3553. */
  3554. translate(): BABYLON.Vector2;
  3555. /** Release associated resources */
  3556. dispose(): void;
  3557. }
  3558. }
  3559. declare module BABYLON.GUI {
  3560. /**
  3561. * Define a style used by control to automatically setup properties based on a template.
  3562. * Only support font related properties so far
  3563. */
  3564. export class Style implements BABYLON.IDisposable {
  3565. /** @hidden */
  3566. _host: AdvancedDynamicTexture;
  3567. /** @hidden */
  3568. _fontSize: ValueAndUnit;
  3569. /**
  3570. * BABYLON.Observable raised when the style values are changed
  3571. */
  3572. onChangedObservable: BABYLON.Observable<Style>;
  3573. /**
  3574. * Creates a new style object
  3575. * @param host defines the AdvancedDynamicTexture which hosts this style
  3576. */
  3577. constructor(host: AdvancedDynamicTexture);
  3578. /**
  3579. * Gets or sets the font size
  3580. */
  3581. fontSize: string | number;
  3582. /**
  3583. * Gets or sets the font family
  3584. */
  3585. fontFamily: string;
  3586. /**
  3587. * Gets or sets the font style
  3588. */
  3589. fontStyle: string;
  3590. /** Gets or sets font weight */
  3591. fontWeight: string;
  3592. /** Dispose all associated resources */
  3593. dispose(): void;
  3594. }
  3595. }
  3596. declare module BABYLON.GUI {
  3597. /**
  3598. * Class used to specific a value and its associated unit
  3599. */
  3600. export class ValueAndUnit {
  3601. /** defines the unit to store */
  3602. unit: number;
  3603. /** defines a boolean indicating if the value can be negative */
  3604. negativeValueAllowed: boolean;
  3605. /**
  3606. * Gets or sets a value indicating that this value will not scale accordingly with adaptive scaling property
  3607. * @see http://doc.babylonjs.com/how_to/gui#adaptive-scaling
  3608. */
  3609. ignoreAdaptiveScaling: boolean;
  3610. /**
  3611. * Creates a new ValueAndUnit
  3612. * @param value defines the value to store
  3613. * @param unit defines the unit to store
  3614. * @param negativeValueAllowed defines a boolean indicating if the value can be negative
  3615. */
  3616. constructor(value: number,
  3617. /** defines the unit to store */
  3618. unit?: number,
  3619. /** defines a boolean indicating if the value can be negative */
  3620. negativeValueAllowed?: boolean);
  3621. /** Gets a boolean indicating if the value is a percentage */
  3622. readonly isPercentage: boolean;
  3623. /** Gets a boolean indicating if the value is store as pixel */
  3624. readonly isPixel: boolean;
  3625. /** Gets direct internal value */
  3626. readonly internalValue: number;
  3627. /**
  3628. * Gets value as pixel
  3629. * @param host defines the root host
  3630. * @param refValue defines the reference value for percentages
  3631. * @returns the value as pixel
  3632. */
  3633. getValueInPixel(host: AdvancedDynamicTexture, refValue: number): number;
  3634. /**
  3635. * Update the current value and unit. This should be done cautiously as the GUi won't be marked as dirty with this function.
  3636. * @param value defines the value to store
  3637. * @param unit defines the unit to store
  3638. * @returns the current ValueAndUnit
  3639. */
  3640. updateInPlace(value: number, unit?: number): ValueAndUnit;
  3641. /**
  3642. * Gets the value accordingly to its unit
  3643. * @param host defines the root host
  3644. * @returns the value
  3645. */
  3646. getValue(host: AdvancedDynamicTexture): number;
  3647. /**
  3648. * Gets a string representation of the value
  3649. * @param host defines the root host
  3650. * @returns a string
  3651. */
  3652. toString(host: AdvancedDynamicTexture): string;
  3653. /**
  3654. * Store a value parsed from a string
  3655. * @param source defines the source string
  3656. * @returns true if the value was successfully parsed
  3657. */
  3658. fromString(source: string | number): boolean;
  3659. /** UNITMODE_PERCENTAGE */
  3660. static readonly UNITMODE_PERCENTAGE: number;
  3661. /** UNITMODE_PIXEL */
  3662. static readonly UNITMODE_PIXEL: number;
  3663. }
  3664. }
  3665. declare module BABYLON.GUI {
  3666. }
  3667. declare module BABYLON.GUI {
  3668. }
  3669. declare module BABYLON.GUI {
  3670. /**
  3671. * Class used to manage 3D user interface
  3672. * @see http://doc.babylonjs.com/how_to/gui3d
  3673. */
  3674. export class GUI3DManager implements BABYLON.IDisposable {
  3675. /** @hidden */
  3676. _lastPickedControl: Control3D;
  3677. /** @hidden */
  3678. _lastControlOver: {
  3679. [pointerId: number]: Control3D;
  3680. };
  3681. /** @hidden */
  3682. _lastControlDown: {
  3683. [pointerId: number]: Control3D;
  3684. };
  3685. /**
  3686. * BABYLON.Observable raised when the point picked by the pointer events changed
  3687. */
  3688. onPickedPointChangedObservable: BABYLON.Observable<BABYLON.Nullable<BABYLON.Vector3>>;
  3689. /** @hidden */
  3690. _sharedMaterials: {
  3691. [key: string]: BABYLON.Material;
  3692. };
  3693. /** Gets the hosting scene */
  3694. readonly scene: BABYLON.Scene;
  3695. /** Gets associated utility layer */
  3696. readonly utilityLayer: BABYLON.Nullable<BABYLON.UtilityLayerRenderer>;
  3697. /**
  3698. * Creates a new GUI3DManager
  3699. * @param scene
  3700. */
  3701. constructor(scene?: BABYLON.Scene);
  3702. /**
  3703. * Gets the root container
  3704. */
  3705. readonly rootContainer: Container3D;
  3706. /**
  3707. * Gets a boolean indicating if the given control is in the root child list
  3708. * @param control defines the control to check
  3709. * @returns true if the control is in the root child list
  3710. */
  3711. containsControl(control: Control3D): boolean;
  3712. /**
  3713. * Adds a control to the root child list
  3714. * @param control defines the control to add
  3715. * @returns the current manager
  3716. */
  3717. addControl(control: Control3D): GUI3DManager;
  3718. /**
  3719. * Removes a control from the root child list
  3720. * @param control defines the control to remove
  3721. * @returns the current container
  3722. */
  3723. removeControl(control: Control3D): GUI3DManager;
  3724. /**
  3725. * Releases all associated resources
  3726. */
  3727. dispose(): void;
  3728. }
  3729. }
  3730. declare module BABYLON.GUI {
  3731. /**
  3732. * Class used to transport BABYLON.Vector3 information for pointer events
  3733. */
  3734. export class Vector3WithInfo extends BABYLON.Vector3 {
  3735. /** defines the current mouse button index */
  3736. buttonIndex: number;
  3737. /**
  3738. * Creates a new Vector3WithInfo
  3739. * @param source defines the vector3 data to transport
  3740. * @param buttonIndex defines the current mouse button index
  3741. */
  3742. constructor(source: BABYLON.Vector3,
  3743. /** defines the current mouse button index */
  3744. buttonIndex?: number);
  3745. }
  3746. }
  3747. declare module BABYLON.GUI {
  3748. /**
  3749. * Class used to create 2D buttons
  3750. */
  3751. export class Button extends Rectangle {
  3752. name?: string | undefined;
  3753. /**
  3754. * Function called to generate a pointer enter animation
  3755. */
  3756. pointerEnterAnimation: () => void;
  3757. /**
  3758. * Function called to generate a pointer out animation
  3759. */
  3760. pointerOutAnimation: () => void;
  3761. /**
  3762. * Function called to generate a pointer down animation
  3763. */
  3764. pointerDownAnimation: () => void;
  3765. /**
  3766. * Function called to generate a pointer up animation
  3767. */
  3768. pointerUpAnimation: () => void;
  3769. /**
  3770. * Returns the image part of the button (if any)
  3771. */
  3772. readonly image: BABYLON.Nullable<Image>;
  3773. /**
  3774. * Returns the image part of the button (if any)
  3775. */
  3776. readonly textBlock: BABYLON.Nullable<TextBlock>;
  3777. /**
  3778. * Creates a new Button
  3779. * @param name defines the name of the button
  3780. */
  3781. constructor(name?: string | undefined);
  3782. protected _getTypeName(): string;
  3783. /** @hidden */
  3784. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3785. /** @hidden */
  3786. _onPointerEnter(target: Control): boolean;
  3787. /** @hidden */
  3788. _onPointerOut(target: Control): void;
  3789. /** @hidden */
  3790. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3791. /** @hidden */
  3792. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3793. /**
  3794. * Creates a new button made with an image and a text
  3795. * @param name defines the name of the button
  3796. * @param text defines the text of the button
  3797. * @param imageUrl defines the url of the image
  3798. * @returns a new Button
  3799. */
  3800. static CreateImageButton(name: string, text: string, imageUrl: string): Button;
  3801. /**
  3802. * Creates a new button made with an image
  3803. * @param name defines the name of the button
  3804. * @param imageUrl defines the url of the image
  3805. * @returns a new Button
  3806. */
  3807. static CreateImageOnlyButton(name: string, imageUrl: string): Button;
  3808. /**
  3809. * Creates a new button made with a text
  3810. * @param name defines the name of the button
  3811. * @param text defines the text of the button
  3812. * @returns a new Button
  3813. */
  3814. static CreateSimpleButton(name: string, text: string): Button;
  3815. /**
  3816. * Creates a new button made with an image and a centered text
  3817. * @param name defines the name of the button
  3818. * @param text defines the text of the button
  3819. * @param imageUrl defines the url of the image
  3820. * @returns a new Button
  3821. */
  3822. static CreateImageWithCenterTextButton(name: string, text: string, imageUrl: string): Button;
  3823. }
  3824. }
  3825. declare module BABYLON.GUI {
  3826. /**
  3827. * Class used to represent a 2D checkbox
  3828. */
  3829. export class Checkbox extends Control {
  3830. name?: string | undefined;
  3831. /** Gets or sets border thickness */
  3832. thickness: number;
  3833. /**
  3834. * BABYLON.Observable raised when isChecked property changes
  3835. */
  3836. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  3837. /** Gets or sets a value indicating the ratio between overall size and check size */
  3838. checkSizeRatio: number;
  3839. /** Gets or sets background color */
  3840. background: string;
  3841. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  3842. isChecked: boolean;
  3843. /**
  3844. * Creates a new CheckBox
  3845. * @param name defines the control name
  3846. */
  3847. constructor(name?: string | undefined);
  3848. protected _getTypeName(): string;
  3849. /** @hidden */
  3850. _draw(context: CanvasRenderingContext2D): void;
  3851. /** @hidden */
  3852. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3853. /**
  3854. * Utility function to easily create a checkbox with a header
  3855. * @param title defines the label to use for the header
  3856. * @param onValueChanged defines the callback to call when value changes
  3857. * @returns a StackPanel containing the checkbox and a textBlock
  3858. */
  3859. static AddCheckBoxWithHeader(title: string, onValueChanged: (value: boolean) => void): StackPanel;
  3860. }
  3861. }
  3862. declare module BABYLON.GUI {
  3863. /** Class used to create color pickers */
  3864. export class ColorPicker extends Control {
  3865. name?: string | undefined;
  3866. /**
  3867. * BABYLON.Observable raised when the value changes
  3868. */
  3869. onValueChangedObservable: BABYLON.Observable<BABYLON.Color3>;
  3870. /** Gets or sets the color of the color picker */
  3871. value: BABYLON.Color3;
  3872. /**
  3873. * Gets or sets control width
  3874. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  3875. */
  3876. width: string | number;
  3877. /** Gets or sets control height */
  3878. height: string | number;
  3879. /** Gets or sets control size */
  3880. size: string | number;
  3881. /**
  3882. * Creates a new ColorPicker
  3883. * @param name defines the control name
  3884. */
  3885. constructor(name?: string | undefined);
  3886. protected _getTypeName(): string;
  3887. /** @hidden */
  3888. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3889. /** @hidden */
  3890. _draw(context: CanvasRenderingContext2D): void;
  3891. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  3892. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  3893. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  3894. }
  3895. }
  3896. declare module BABYLON.GUI {
  3897. /**
  3898. * Root class for 2D containers
  3899. * @see http://doc.babylonjs.com/how_to/gui#containers
  3900. */
  3901. export class Container extends Control {
  3902. name?: string | undefined;
  3903. /** @hidden */
  3904. protected _children: Control[];
  3905. /** @hidden */
  3906. protected _measureForChildren: Measure;
  3907. /** @hidden */
  3908. protected _background: string;
  3909. /** @hidden */
  3910. protected _adaptWidthToChildren: boolean;
  3911. /** @hidden */
  3912. protected _adaptHeightToChildren: boolean;
  3913. /** Gets or sets a boolean indicating if the container should try to adapt to its children height */
  3914. adaptHeightToChildren: boolean;
  3915. /** Gets or sets a boolean indicating if the container should try to adapt to its children width */
  3916. adaptWidthToChildren: boolean;
  3917. /** Gets or sets background color */
  3918. background: string;
  3919. /** Gets the list of children */
  3920. readonly children: Control[];
  3921. /**
  3922. * Creates a new Container
  3923. * @param name defines the name of the container
  3924. */
  3925. constructor(name?: string | undefined);
  3926. protected _getTypeName(): string;
  3927. _flagDescendantsAsMatrixDirty(): void;
  3928. /**
  3929. * Gets a child using its name
  3930. * @param name defines the child name to look for
  3931. * @returns the child control if found
  3932. */
  3933. getChildByName(name: string): BABYLON.Nullable<Control>;
  3934. /**
  3935. * Gets a child using its type and its name
  3936. * @param name defines the child name to look for
  3937. * @param type defines the child type to look for
  3938. * @returns the child control if found
  3939. */
  3940. getChildByType(name: string, type: string): BABYLON.Nullable<Control>;
  3941. /**
  3942. * Search for a specific control in children
  3943. * @param control defines the control to look for
  3944. * @returns true if the control is in child list
  3945. */
  3946. containsControl(control: Control): boolean;
  3947. /**
  3948. * Adds a new control to the current container
  3949. * @param control defines the control to add
  3950. * @returns the current container
  3951. */
  3952. addControl(control: BABYLON.Nullable<Control>): Container;
  3953. /**
  3954. * Removes all controls from the current container
  3955. * @returns the current container
  3956. */
  3957. clearControls(): Container;
  3958. /**
  3959. * Removes a control from the current container
  3960. * @param control defines the control to remove
  3961. * @returns the current container
  3962. */
  3963. removeControl(control: Control): Container;
  3964. /** @hidden */
  3965. _reOrderControl(control: Control): void;
  3966. /** @hidden */
  3967. _offsetLeft(offset: number): void;
  3968. /** @hidden */
  3969. _offsetTop(offset: number): void;
  3970. /** @hidden */
  3971. _markAllAsDirty(): void;
  3972. /** @hidden */
  3973. protected _localDraw(context: CanvasRenderingContext2D): void;
  3974. /** @hidden */
  3975. _link(host: AdvancedDynamicTexture): void;
  3976. /** @hidden */
  3977. protected _beforeLayout(): void;
  3978. /** @hidden */
  3979. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  3980. protected _postMeasure(): void;
  3981. /** @hidden */
  3982. _draw(context: CanvasRenderingContext2D): void;
  3983. /** @hidden */
  3984. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  3985. /** @hidden */
  3986. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  3987. /** @hidden */
  3988. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  3989. /** Releases associated resources */
  3990. dispose(): void;
  3991. }
  3992. }
  3993. declare module BABYLON.GUI {
  3994. /**
  3995. * Root class used for all 2D controls
  3996. * @see http://doc.babylonjs.com/how_to/gui#controls
  3997. */
  3998. export class Control {
  3999. /** defines the name of the control */
  4000. name?: string | undefined;
  4001. /**
  4002. * Gets or sets a boolean indicating if alpha must be an inherited value (false by default)
  4003. */
  4004. static AllowAlphaInheritance: boolean;
  4005. /** @hidden */
  4006. _host: AdvancedDynamicTexture;
  4007. /** Gets or sets the control parent */
  4008. parent: BABYLON.Nullable<Container>;
  4009. /** @hidden */
  4010. _currentMeasure: Measure;
  4011. /** @hidden */
  4012. _width: ValueAndUnit;
  4013. /** @hidden */
  4014. _height: ValueAndUnit;
  4015. /** @hidden */
  4016. protected _fontOffset: {
  4017. ascent: number;
  4018. height: number;
  4019. descent: number;
  4020. };
  4021. /** @hidden */
  4022. protected _horizontalAlignment: number;
  4023. /** @hidden */
  4024. protected _verticalAlignment: number;
  4025. /** @hidden */
  4026. protected _isDirty: boolean;
  4027. /** @hidden */
  4028. _tempParentMeasure: Measure;
  4029. /** @hidden */
  4030. protected _cachedParentMeasure: Measure;
  4031. /** @hidden */
  4032. _left: ValueAndUnit;
  4033. /** @hidden */
  4034. _top: ValueAndUnit;
  4035. /** @hidden */
  4036. protected _invertTransformMatrix: Matrix2D;
  4037. /** @hidden */
  4038. protected _transformedPosition: BABYLON.Vector2;
  4039. /** @hidden */
  4040. _linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  4041. protected _isEnabled: boolean;
  4042. protected _disabledColor: string;
  4043. /** @hidden */
  4044. protected _rebuildLayout: boolean;
  4045. /** @hidden */
  4046. _isClipped: boolean;
  4047. /** @hidden */
  4048. _tag: any;
  4049. /**
  4050. * 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
  4051. */
  4052. uniqueId: number;
  4053. /**
  4054. * Gets or sets an object used to store user defined information for the node
  4055. */
  4056. metadata: any;
  4057. /** Gets or sets a boolean indicating if the control can be hit with pointer events */
  4058. isHitTestVisible: boolean;
  4059. /** Gets or sets a boolean indicating if the control can block pointer events */
  4060. isPointerBlocker: boolean;
  4061. /** Gets or sets a boolean indicating if the control can be focusable */
  4062. isFocusInvisible: boolean;
  4063. /** Gets or sets a boolean indicating if the children are clipped to the current control bounds */
  4064. clipChildren: boolean;
  4065. /** Gets or sets a value indicating the offset to apply on X axis to render the shadow */
  4066. shadowOffsetX: number;
  4067. /** Gets or sets a value indicating the offset to apply on Y axis to render the shadow */
  4068. shadowOffsetY: number;
  4069. /** Gets or sets a value indicating the amount of blur to use to render the shadow */
  4070. shadowBlur: number;
  4071. /** Gets or sets a value indicating the color of the shadow (black by default ie. "#000") */
  4072. shadowColor: string;
  4073. /** Gets or sets the cursor to use when the control is hovered */
  4074. hoverCursor: string;
  4075. /** @hidden */
  4076. protected _linkOffsetX: ValueAndUnit;
  4077. /** @hidden */
  4078. protected _linkOffsetY: ValueAndUnit;
  4079. /** Gets the control type name */
  4080. readonly typeName: string;
  4081. /**
  4082. * Get the current class name of the control.
  4083. * @returns current class name
  4084. */
  4085. getClassName(): string;
  4086. /**
  4087. * An event triggered when the pointer move over the control.
  4088. */
  4089. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector2>;
  4090. /**
  4091. * An event triggered when the pointer move out of the control.
  4092. */
  4093. onPointerOutObservable: BABYLON.Observable<Control>;
  4094. /**
  4095. * An event triggered when the pointer taps the control
  4096. */
  4097. onPointerDownObservable: BABYLON.Observable<Vector2WithInfo>;
  4098. /**
  4099. * An event triggered when pointer up
  4100. */
  4101. onPointerUpObservable: BABYLON.Observable<Vector2WithInfo>;
  4102. /**
  4103. * An event triggered when a control is clicked on
  4104. */
  4105. onPointerClickObservable: BABYLON.Observable<Vector2WithInfo>;
  4106. /**
  4107. * An event triggered when pointer enters the control
  4108. */
  4109. onPointerEnterObservable: BABYLON.Observable<Control>;
  4110. /**
  4111. * An event triggered when the control is marked as dirty
  4112. */
  4113. onDirtyObservable: BABYLON.Observable<Control>;
  4114. /**
  4115. * An event triggered before drawing the control
  4116. */
  4117. onBeforeDrawObservable: BABYLON.Observable<Control>;
  4118. /**
  4119. * An event triggered after the control was drawn
  4120. */
  4121. onAfterDrawObservable: BABYLON.Observable<Control>;
  4122. /**
  4123. * Get the hosting AdvancedDynamicTexture
  4124. */
  4125. readonly host: AdvancedDynamicTexture;
  4126. /** Gets or set information about font offsets (used to render and align text) */
  4127. fontOffset: {
  4128. ascent: number;
  4129. height: number;
  4130. descent: number;
  4131. };
  4132. /** Gets or sets alpha value for the control (1 means opaque and 0 means entirely transparent) */
  4133. alpha: number;
  4134. /**
  4135. * Gets or sets a boolean indicating that we want to highlight the control (mostly for debugging purpose)
  4136. */
  4137. isHighlighted: boolean;
  4138. /** Gets or sets a value indicating the scale factor on X axis (1 by default)
  4139. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4140. */
  4141. scaleX: number;
  4142. /** Gets or sets a value indicating the scale factor on Y axis (1 by default)
  4143. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4144. */
  4145. scaleY: number;
  4146. /** Gets or sets the rotation angle (0 by default)
  4147. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4148. */
  4149. rotation: number;
  4150. /** Gets or sets the transformation center on Y axis (0 by default)
  4151. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4152. */
  4153. transformCenterY: number;
  4154. /** Gets or sets the transformation center on X axis (0 by default)
  4155. * @see http://doc.babylonjs.com/how_to/gui#rotation-and-scaling
  4156. */
  4157. transformCenterX: number;
  4158. /**
  4159. * Gets or sets the horizontal alignment
  4160. * @see http://doc.babylonjs.com/how_to/gui#alignments
  4161. */
  4162. horizontalAlignment: number;
  4163. /**
  4164. * Gets or sets the vertical alignment
  4165. * @see http://doc.babylonjs.com/how_to/gui#alignments
  4166. */
  4167. verticalAlignment: number;
  4168. /**
  4169. * Gets or sets control width
  4170. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4171. */
  4172. width: string | number;
  4173. /**
  4174. * Gets control width in pixel
  4175. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4176. */
  4177. readonly widthInPixels: number;
  4178. /**
  4179. * Gets or sets control height
  4180. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4181. */
  4182. height: string | number;
  4183. /**
  4184. * Gets control height in pixel
  4185. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4186. */
  4187. readonly heightInPixels: number;
  4188. /** Gets or set font family */
  4189. fontFamily: string;
  4190. /** Gets or sets font style */
  4191. fontStyle: string;
  4192. /** Gets or sets font weight */
  4193. fontWeight: string;
  4194. /**
  4195. * Gets or sets style
  4196. * @see http://doc.babylonjs.com/how_to/gui#styles
  4197. */
  4198. style: BABYLON.Nullable<Style>;
  4199. /** @hidden */
  4200. readonly _isFontSizeInPercentage: boolean;
  4201. /** Gets font size in pixels */
  4202. readonly fontSizeInPixels: number;
  4203. /** Gets or sets font size */
  4204. fontSize: string | number;
  4205. /** Gets or sets foreground color */
  4206. color: string;
  4207. /** Gets or sets z index which is used to reorder controls on the z axis */
  4208. zIndex: number;
  4209. /** Gets or sets a boolean indicating if the control can be rendered */
  4210. notRenderable: boolean;
  4211. /** Gets or sets a boolean indicating if the control is visible */
  4212. isVisible: boolean;
  4213. /** Gets a boolean indicating that the control needs to update its rendering */
  4214. readonly isDirty: boolean;
  4215. /**
  4216. * Gets the current linked mesh (or null if none)
  4217. */
  4218. readonly linkedMesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  4219. /**
  4220. * Gets or sets a value indicating the padding to use on the left of the control
  4221. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4222. */
  4223. paddingLeft: string | number;
  4224. /**
  4225. * Gets a value indicating the padding in pixels to use on the left of the control
  4226. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4227. */
  4228. readonly paddingLeftInPixels: number;
  4229. /**
  4230. * Gets or sets a value indicating the padding to use on the right of the control
  4231. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4232. */
  4233. paddingRight: string | number;
  4234. /**
  4235. * Gets a value indicating the padding in pixels to use on the right of the control
  4236. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4237. */
  4238. readonly paddingRightInPixels: number;
  4239. /**
  4240. * Gets or sets a value indicating the padding to use on the top of the control
  4241. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4242. */
  4243. paddingTop: string | number;
  4244. /**
  4245. * Gets a value indicating the padding in pixels to use on the top of the control
  4246. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4247. */
  4248. readonly paddingTopInPixels: number;
  4249. /**
  4250. * Gets or sets a value indicating the padding to use on the bottom of the control
  4251. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4252. */
  4253. paddingBottom: string | number;
  4254. /**
  4255. * Gets a value indicating the padding in pixels to use on the bottom of the control
  4256. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4257. */
  4258. readonly paddingBottomInPixels: number;
  4259. /**
  4260. * Gets or sets a value indicating the left coordinate of the control
  4261. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4262. */
  4263. left: string | number;
  4264. /**
  4265. * Gets a value indicating the left coordinate in pixels of the control
  4266. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4267. */
  4268. readonly leftInPixels: number;
  4269. /**
  4270. * Gets or sets a value indicating the top coordinate of the control
  4271. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4272. */
  4273. top: string | number;
  4274. /**
  4275. * Gets a value indicating the top coordinate in pixels of the control
  4276. * @see http://doc.babylonjs.com/how_to/gui#position-and-size
  4277. */
  4278. readonly topInPixels: number;
  4279. /**
  4280. * Gets or sets a value indicating the offset on X axis to the linked mesh
  4281. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4282. */
  4283. linkOffsetX: string | number;
  4284. /**
  4285. * Gets a value indicating the offset in pixels on X axis to the linked mesh
  4286. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4287. */
  4288. readonly linkOffsetXInPixels: number;
  4289. /**
  4290. * Gets or sets a value indicating the offset on Y axis to the linked mesh
  4291. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4292. */
  4293. linkOffsetY: string | number;
  4294. /**
  4295. * Gets a value indicating the offset in pixels on Y axis to the linked mesh
  4296. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4297. */
  4298. readonly linkOffsetYInPixels: number;
  4299. /** Gets the center coordinate on X axis */
  4300. readonly centerX: number;
  4301. /** Gets the center coordinate on Y axis */
  4302. readonly centerY: number;
  4303. /** Gets or sets if control is Enabled*/
  4304. isEnabled: boolean;
  4305. /** Gets or sets background color of control if it's disabled*/
  4306. disabledColor: string;
  4307. /**
  4308. * Creates a new control
  4309. * @param name defines the name of the control
  4310. */
  4311. constructor(
  4312. /** defines the name of the control */
  4313. name?: string | undefined);
  4314. /** @hidden */
  4315. protected _getTypeName(): string;
  4316. /**
  4317. * Gets the first ascendant in the hierarchy of the given type
  4318. * @param className defines the required type
  4319. * @returns the ascendant or null if not found
  4320. */
  4321. getAscendantOfClass(className: string): BABYLON.Nullable<Control>;
  4322. /** @hidden */
  4323. _resetFontCache(): void;
  4324. /**
  4325. * Determines if a container is an ascendant of the current control
  4326. * @param container defines the container to look for
  4327. * @returns true if the container is one of the ascendant of the control
  4328. */
  4329. isAscendant(container: Control): boolean;
  4330. /**
  4331. * Gets coordinates in local control space
  4332. * @param globalCoordinates defines the coordinates to transform
  4333. * @returns the new coordinates in local space
  4334. */
  4335. getLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  4336. /**
  4337. * Gets coordinates in local control space
  4338. * @param globalCoordinates defines the coordinates to transform
  4339. * @param result defines the target vector2 where to store the result
  4340. * @returns the current control
  4341. */
  4342. getLocalCoordinatesToRef(globalCoordinates: BABYLON.Vector2, result: BABYLON.Vector2): Control;
  4343. /**
  4344. * Gets coordinates in parent local control space
  4345. * @param globalCoordinates defines the coordinates to transform
  4346. * @returns the new coordinates in parent local space
  4347. */
  4348. getParentLocalCoordinates(globalCoordinates: BABYLON.Vector2): BABYLON.Vector2;
  4349. /**
  4350. * Move the current control to a vector3 position projected onto the screen.
  4351. * @param position defines the target position
  4352. * @param scene defines the hosting scene
  4353. */
  4354. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene): void;
  4355. /** @hidden */
  4356. _getDescendants(results: Control[], directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): void;
  4357. /**
  4358. * Will return all controls that have this control as ascendant
  4359. * @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
  4360. * @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
  4361. * @return all child controls
  4362. */
  4363. getDescendants(directDescendantsOnly?: boolean, predicate?: (control: Control) => boolean): Control[];
  4364. /**
  4365. * Link current control with a target mesh
  4366. * @param mesh defines the mesh to link with
  4367. * @see http://doc.babylonjs.com/how_to/gui#tracking-positions
  4368. */
  4369. linkWithMesh(mesh: BABYLON.Nullable<BABYLON.AbstractMesh>): void;
  4370. /** @hidden */
  4371. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3): void;
  4372. /** @hidden */
  4373. _offsetLeft(offset: number): void;
  4374. /** @hidden */
  4375. _offsetTop(offset: number): void;
  4376. /** @hidden */
  4377. _markMatrixAsDirty(): void;
  4378. /** @hidden */
  4379. _flagDescendantsAsMatrixDirty(): void;
  4380. /** @hidden */
  4381. _markAsDirty(force?: boolean): void;
  4382. /** @hidden */
  4383. _markAllAsDirty(): void;
  4384. /** @hidden */
  4385. _link(host: AdvancedDynamicTexture): void;
  4386. /** @hidden */
  4387. protected _transform(context: CanvasRenderingContext2D): void;
  4388. /** @hidden */
  4389. _renderHighlight(context: CanvasRenderingContext2D): void;
  4390. /** @hidden */
  4391. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  4392. /** @hidden */
  4393. protected _applyStates(context: CanvasRenderingContext2D): void;
  4394. /** @hidden */
  4395. _layout(parentMeasure: Measure, context: CanvasRenderingContext2D): boolean;
  4396. /** @hidden */
  4397. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4398. /** @hidden */
  4399. _measure(): void;
  4400. /** @hidden */
  4401. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4402. /** @hidden */
  4403. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4404. /** @hidden */
  4405. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4406. /** @hidden */
  4407. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4408. /** @hidden */
  4409. _render(context: CanvasRenderingContext2D): boolean;
  4410. /** @hidden */
  4411. _draw(context: CanvasRenderingContext2D): void;
  4412. /**
  4413. * Tests if a given coordinates belong to the current control
  4414. * @param x defines x coordinate to test
  4415. * @param y defines y coordinate to test
  4416. * @returns true if the coordinates are inside the control
  4417. */
  4418. contains(x: number, y: number): boolean;
  4419. /** @hidden */
  4420. _processPicking(x: number, y: number, type: number, pointerId: number, buttonIndex: number): boolean;
  4421. /** @hidden */
  4422. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4423. /** @hidden */
  4424. _onPointerEnter(target: Control): boolean;
  4425. /** @hidden */
  4426. _onPointerOut(target: Control): void;
  4427. /** @hidden */
  4428. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4429. /** @hidden */
  4430. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4431. /** @hidden */
  4432. _forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  4433. /** @hidden */
  4434. _processObservables(type: number, x: number, y: number, pointerId: number, buttonIndex: number): boolean;
  4435. /** Releases associated resources */
  4436. dispose(): void;
  4437. /** HORIZONTAL_ALIGNMENT_LEFT */
  4438. static readonly HORIZONTAL_ALIGNMENT_LEFT: number;
  4439. /** HORIZONTAL_ALIGNMENT_RIGHT */
  4440. static readonly HORIZONTAL_ALIGNMENT_RIGHT: number;
  4441. /** HORIZONTAL_ALIGNMENT_CENTER */
  4442. static readonly HORIZONTAL_ALIGNMENT_CENTER: number;
  4443. /** VERTICAL_ALIGNMENT_TOP */
  4444. static readonly VERTICAL_ALIGNMENT_TOP: number;
  4445. /** VERTICAL_ALIGNMENT_BOTTOM */
  4446. static readonly VERTICAL_ALIGNMENT_BOTTOM: number;
  4447. /** VERTICAL_ALIGNMENT_CENTER */
  4448. static readonly VERTICAL_ALIGNMENT_CENTER: number;
  4449. /** @hidden */
  4450. static _GetFontOffset(font: string): {
  4451. ascent: number;
  4452. height: number;
  4453. descent: number;
  4454. };
  4455. /**
  4456. * Creates a stack panel that can be used to render headers
  4457. * @param control defines the control to associate with the header
  4458. * @param text defines the text of the header
  4459. * @param size defines the size of the header
  4460. * @param options defines options used to configure the header
  4461. * @returns a new StackPanel
  4462. * @ignore
  4463. * @hidden
  4464. */
  4465. static AddHeader: (control: Control, text: string, size: string | number, options: {
  4466. isHorizontal: boolean;
  4467. controlFirst: boolean;
  4468. }) => any;
  4469. /** @hidden */
  4470. protected static drawEllipse(x: number, y: number, width: number, height: number, context: CanvasRenderingContext2D): void;
  4471. }
  4472. }
  4473. declare module BABYLON.GUI {
  4474. /** Class used to create 2D ellipse containers */
  4475. export class Ellipse extends Container {
  4476. name?: string | undefined;
  4477. /** Gets or sets border thickness */
  4478. thickness: number;
  4479. /**
  4480. * Creates a new Ellipse
  4481. * @param name defines the control name
  4482. */
  4483. constructor(name?: string | undefined);
  4484. protected _getTypeName(): string;
  4485. protected _localDraw(context: CanvasRenderingContext2D): void;
  4486. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4487. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  4488. }
  4489. }
  4490. declare module BABYLON.GUI {
  4491. /**
  4492. * Class used to create a 2D grid container
  4493. */
  4494. export class Grid extends Container {
  4495. name?: string | undefined;
  4496. /**
  4497. * Gets the number of columns
  4498. */
  4499. readonly columnCount: number;
  4500. /**
  4501. * Gets the number of rows
  4502. */
  4503. readonly rowCount: number;
  4504. /** Gets the list of children */
  4505. readonly children: Control[];
  4506. /**
  4507. * Gets the definition of a specific row
  4508. * @param index defines the index of the row
  4509. * @returns the row definition
  4510. */
  4511. getRowDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  4512. /**
  4513. * Gets the definition of a specific column
  4514. * @param index defines the index of the column
  4515. * @returns the column definition
  4516. */
  4517. getColumnDefinition(index: number): BABYLON.Nullable<ValueAndUnit>;
  4518. /**
  4519. * Adds a new row to the grid
  4520. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4521. * @param isPixel defines if the height is expressed in pixel (or in percentage)
  4522. * @returns the current grid
  4523. */
  4524. addRowDefinition(height: number, isPixel?: boolean): Grid;
  4525. /**
  4526. * Adds a new column to the grid
  4527. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4528. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4529. * @returns the current grid
  4530. */
  4531. addColumnDefinition(width: number, isPixel?: boolean): Grid;
  4532. /**
  4533. * Update a row definition
  4534. * @param index defines the index of the row to update
  4535. * @param height defines the height of the row (either in pixel or a value between 0 and 1)
  4536. * @param isPixel defines if the weight is expressed in pixel (or in percentage)
  4537. * @returns the current grid
  4538. */
  4539. setRowDefinition(index: number, height: number, isPixel?: boolean): Grid;
  4540. /**
  4541. * Update a column definition
  4542. * @param index defines the index of the column to update
  4543. * @param width defines the width of the column (either in pixel or a value between 0 and 1)
  4544. * @param isPixel defines if the width is expressed in pixel (or in percentage)
  4545. * @returns the current grid
  4546. */
  4547. setColumnDefinition(index: number, width: number, isPixel?: boolean): Grid;
  4548. /**
  4549. * Gets the list of children stored in a specific cell
  4550. * @param row defines the row to check
  4551. * @param column defines the column to check
  4552. * @returns the list of controls
  4553. */
  4554. getChildrenAt(row: number, column: number): BABYLON.Nullable<Array<Control>>;
  4555. /**
  4556. * Gets a string representing the child cell info (row x column)
  4557. * @param child defines the control to get info from
  4558. * @returns a string containing the child cell info (row x column)
  4559. */
  4560. getChildCellInfo(child: Control): string;
  4561. /**
  4562. * Remove a column definition at specified index
  4563. * @param index defines the index of the column to remove
  4564. * @returns the current grid
  4565. */
  4566. removeColumnDefinition(index: number): Grid;
  4567. /**
  4568. * Remove a row definition at specified index
  4569. * @param index defines the index of the row to remove
  4570. * @returns the current grid
  4571. */
  4572. removeRowDefinition(index: number): Grid;
  4573. /**
  4574. * Adds a new control to the current grid
  4575. * @param control defines the control to add
  4576. * @param row defines the row where to add the control (0 by default)
  4577. * @param column defines the column where to add the control (0 by default)
  4578. * @returns the current grid
  4579. */
  4580. addControl(control: Control, row?: number, column?: number): Grid;
  4581. /**
  4582. * Removes a control from the current container
  4583. * @param control defines the control to remove
  4584. * @returns the current container
  4585. */
  4586. removeControl(control: Control): Container;
  4587. /**
  4588. * Creates a new Grid
  4589. * @param name defines control name
  4590. */
  4591. constructor(name?: string | undefined);
  4592. protected _getTypeName(): string;
  4593. protected _getGridDefinitions(definitionCallback: (lefts: number[], tops: number[], widths: number[], heights: number[]) => void): void;
  4594. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4595. _flagDescendantsAsMatrixDirty(): void;
  4596. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  4597. /** Releases associated resources */
  4598. dispose(): void;
  4599. }
  4600. }
  4601. declare module BABYLON.GUI {
  4602. /**
  4603. * Class used to create 2D images
  4604. */
  4605. export class Image extends Control {
  4606. name?: string | undefined;
  4607. /**
  4608. * BABYLON.Observable notified when the content is loaded
  4609. */
  4610. onImageLoadedObservable: BABYLON.Observable<Image>;
  4611. /**
  4612. * Gets a boolean indicating that the content is loaded
  4613. */
  4614. readonly isLoaded: boolean;
  4615. /**
  4616. * Gets or sets the left coordinate in the source image
  4617. */
  4618. sourceLeft: number;
  4619. /**
  4620. * Gets or sets the top coordinate in the source image
  4621. */
  4622. sourceTop: number;
  4623. /**
  4624. * Gets or sets the width to capture in the source image
  4625. */
  4626. sourceWidth: number;
  4627. /**
  4628. * Gets or sets the height to capture in the source image
  4629. */
  4630. sourceHeight: number;
  4631. /**
  4632. * Gets or sets a boolean indicating if the image can force its container to adapt its size
  4633. * @see http://doc.babylonjs.com/how_to/gui#image
  4634. */
  4635. autoScale: boolean;
  4636. /** Gets or sets the streching mode used by the image */
  4637. stretch: number;
  4638. /**
  4639. * Gets or sets the internal DOM image used to render the control
  4640. */
  4641. domImage: HTMLImageElement;
  4642. /**
  4643. * Gets or sets image source url
  4644. */
  4645. source: BABYLON.Nullable<string>;
  4646. /**
  4647. * Gets or sets the cell width to use when animation sheet is enabled
  4648. * @see http://doc.babylonjs.com/how_to/gui#image
  4649. */
  4650. cellWidth: number;
  4651. /**
  4652. * Gets or sets the cell height to use when animation sheet is enabled
  4653. * @see http://doc.babylonjs.com/how_to/gui#image
  4654. */
  4655. cellHeight: number;
  4656. /**
  4657. * Gets or sets the cell id to use (this will turn on the animation sheet mode)
  4658. * @see http://doc.babylonjs.com/how_to/gui#image
  4659. */
  4660. cellId: number;
  4661. /**
  4662. * Creates a new Image
  4663. * @param name defines the control name
  4664. * @param url defines the image url
  4665. */
  4666. constructor(name?: string | undefined, url?: BABYLON.Nullable<string>);
  4667. protected _getTypeName(): string;
  4668. /** Force the control to synchronize with its content */
  4669. synchronizeSizeWithContent(): void;
  4670. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4671. _draw(context: CanvasRenderingContext2D): void;
  4672. dispose(): void;
  4673. /** STRETCH_NONE */
  4674. static readonly STRETCH_NONE: number;
  4675. /** STRETCH_FILL */
  4676. static readonly STRETCH_FILL: number;
  4677. /** STRETCH_UNIFORM */
  4678. static readonly STRETCH_UNIFORM: number;
  4679. /** STRETCH_EXTEND */
  4680. static readonly STRETCH_EXTEND: number;
  4681. }
  4682. }
  4683. declare module BABYLON.GUI {
  4684. /**
  4685. * Class used to create input text control
  4686. */
  4687. export class InputText extends Control implements IFocusableControl {
  4688. name?: string | undefined;
  4689. /** @hidden */
  4690. _connectedVirtualKeyboard: BABYLON.Nullable<VirtualKeyboard>;
  4691. /** Gets or sets a string representing the message displayed on mobile when the control gets the focus */
  4692. promptMessage: string;
  4693. /** BABYLON.Observable raised when the text changes */
  4694. onTextChangedObservable: BABYLON.Observable<InputText>;
  4695. /** BABYLON.Observable raised just before an entered character is to be added */
  4696. onBeforeKeyAddObservable: BABYLON.Observable<InputText>;
  4697. /** BABYLON.Observable raised when the control gets the focus */
  4698. onFocusObservable: BABYLON.Observable<InputText>;
  4699. /** BABYLON.Observable raised when the control loses the focus */
  4700. onBlurObservable: BABYLON.Observable<InputText>;
  4701. /**Observable raised when the text is highlighted */
  4702. onTextHighlightObservable: BABYLON.Observable<InputText>;
  4703. /**Observable raised when copy event is triggered */
  4704. onTextCopyObservable: BABYLON.Observable<InputText>;
  4705. /** BABYLON.Observable raised when cut event is triggered */
  4706. onTextCutObservable: BABYLON.Observable<InputText>;
  4707. /** BABYLON.Observable raised when paste event is triggered */
  4708. onTextPasteObservable: BABYLON.Observable<InputText>;
  4709. /** Gets or sets the maximum width allowed by the control */
  4710. maxWidth: string | number;
  4711. /** Gets the maximum width allowed by the control in pixels */
  4712. readonly maxWidthInPixels: number;
  4713. /** Gets or sets the text highlighter transparency; default: 0.4 */
  4714. highligherOpacity: number;
  4715. /** Gets or sets a boolean indicating whether to select complete text by default on input focus */
  4716. onFocusSelectAll: boolean;
  4717. /** Gets or sets the text hightlight color */
  4718. textHighlightColor: string;
  4719. /** Gets or sets control margin */
  4720. margin: string;
  4721. /** Gets control margin in pixels */
  4722. readonly marginInPixels: number;
  4723. /** Gets or sets a boolean indicating if the control can auto stretch its width to adapt to the text */
  4724. autoStretchWidth: boolean;
  4725. /** Gets or sets border thickness */
  4726. thickness: number;
  4727. /** Gets or sets the background color when focused */
  4728. focusedBackground: string;
  4729. /** Gets or sets the background color */
  4730. background: string;
  4731. /** Gets or sets the placeholder color */
  4732. placeholderColor: string;
  4733. /** Gets or sets the text displayed when the control is empty */
  4734. placeholderText: string;
  4735. /** Gets or sets the dead key flag */
  4736. deadKey: boolean;
  4737. /** Gets or sets the highlight text */
  4738. highlightedText: string;
  4739. /** Gets or sets if the current key should be added */
  4740. addKey: boolean;
  4741. /** Gets or sets the value of the current key being entered */
  4742. currentKey: string;
  4743. /** Gets or sets the text displayed in the control */
  4744. text: string;
  4745. /** Gets or sets control width */
  4746. width: string | number;
  4747. /**
  4748. * Creates a new InputText
  4749. * @param name defines the control name
  4750. * @param text defines the text of the control
  4751. */
  4752. constructor(name?: string | undefined, text?: string);
  4753. /** @hidden */
  4754. onBlur(): void;
  4755. /** @hidden */
  4756. onFocus(): void;
  4757. protected _getTypeName(): string;
  4758. /**
  4759. * Function called to get the list of controls that should not steal the focus from this control
  4760. * @returns an array of controls
  4761. */
  4762. keepsFocusWith(): BABYLON.Nullable<Control[]>;
  4763. /** @hidden */
  4764. processKey(keyCode: number, key?: string, evt?: KeyboardEvent): void;
  4765. /**
  4766. * Handles the keyboard event
  4767. * @param evt Defines the KeyboardEvent
  4768. */
  4769. processKeyboard(evt: KeyboardEvent): void;
  4770. _draw(context: CanvasRenderingContext2D): void;
  4771. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4772. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  4773. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  4774. protected _beforeRenderText(text: string): string;
  4775. dispose(): void;
  4776. }
  4777. }
  4778. declare module BABYLON.GUI {
  4779. /**
  4780. * Class used to create a password control
  4781. */
  4782. export class InputPassword extends InputText {
  4783. protected _beforeRenderText(text: string): string;
  4784. }
  4785. }
  4786. declare module BABYLON.GUI {
  4787. /** Class used to render 2D lines */
  4788. export class Line extends Control {
  4789. name?: string | undefined;
  4790. /** Gets or sets the dash pattern */
  4791. dash: Array<number>;
  4792. /** Gets or sets the control connected with the line end */
  4793. connectedControl: Control;
  4794. /** Gets or sets start coordinates on X axis */
  4795. x1: string | number;
  4796. /** Gets or sets start coordinates on Y axis */
  4797. y1: string | number;
  4798. /** Gets or sets end coordinates on X axis */
  4799. x2: string | number;
  4800. /** Gets or sets end coordinates on Y axis */
  4801. y2: string | number;
  4802. /** Gets or sets line width */
  4803. lineWidth: number;
  4804. /** Gets or sets horizontal alignment */
  4805. horizontalAlignment: number;
  4806. /** Gets or sets vertical alignment */
  4807. verticalAlignment: number;
  4808. /**
  4809. * Creates a new Line
  4810. * @param name defines the control name
  4811. */
  4812. constructor(name?: string | undefined);
  4813. protected _getTypeName(): string;
  4814. _draw(context: CanvasRenderingContext2D): void;
  4815. _measure(): void;
  4816. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4817. /**
  4818. * Move one end of the line given 3D cartesian coordinates.
  4819. * @param position Targeted world position
  4820. * @param scene BABYLON.Scene
  4821. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4822. */
  4823. moveToVector3(position: BABYLON.Vector3, scene: BABYLON.Scene, end?: boolean): void;
  4824. /**
  4825. * Move one end of the line to a position in screen absolute space.
  4826. * @param projectedPosition Position in screen absolute space (X, Y)
  4827. * @param end (opt) Set to true to assign x2 and y2 coordinates of the line. Default assign to x1 and y1.
  4828. */
  4829. _moveToProjectedPosition(projectedPosition: BABYLON.Vector3, end?: boolean): void;
  4830. }
  4831. }
  4832. declare module BABYLON.GUI {
  4833. /**
  4834. * Class used to create multi line control
  4835. */
  4836. export class MultiLine extends Control {
  4837. name?: string | undefined;
  4838. /**
  4839. * Creates a new MultiLine
  4840. * @param name defines the control name
  4841. */
  4842. constructor(name?: string | undefined);
  4843. /** Gets or sets dash pattern */
  4844. dash: Array<number>;
  4845. /**
  4846. * Gets point stored at specified index
  4847. * @param index defines the index to look for
  4848. * @returns the requested point if found
  4849. */
  4850. getAt(index: number): MultiLinePoint;
  4851. /** Function called when a point is updated */
  4852. onPointUpdate: () => void;
  4853. /**
  4854. * Adds new points to the point collection
  4855. * @param items defines the list of items (mesh, control or 2d coordiantes) to add
  4856. * @returns the list of created MultiLinePoint
  4857. */
  4858. add(...items: (AbstractMesh | Control | {
  4859. x: string | number;
  4860. y: string | number;
  4861. })[]): MultiLinePoint[];
  4862. /**
  4863. * Adds a new point to the point collection
  4864. * @param item defines the item (mesh, control or 2d coordiantes) to add
  4865. * @returns the created MultiLinePoint
  4866. */
  4867. push(item?: (AbstractMesh | Control | {
  4868. x: string | number;
  4869. y: string | number;
  4870. })): MultiLinePoint;
  4871. /**
  4872. * Remove a specific value or point from the active point collection
  4873. * @param value defines the value or point to remove
  4874. */
  4875. remove(value: number | MultiLinePoint): void;
  4876. /**
  4877. * Resets this object to initial state (no point)
  4878. */
  4879. reset(): void;
  4880. /**
  4881. * Resets all links
  4882. */
  4883. resetLinks(): void;
  4884. /** Gets or sets line width */
  4885. lineWidth: number;
  4886. horizontalAlignment: number;
  4887. verticalAlignment: number;
  4888. protected _getTypeName(): string;
  4889. _draw(context: CanvasRenderingContext2D): void;
  4890. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4891. _measure(): void;
  4892. protected _computeAlignment(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4893. dispose(): void;
  4894. }
  4895. }
  4896. declare module BABYLON.GUI {
  4897. /**
  4898. * Class used to create radio button controls
  4899. */
  4900. export class RadioButton extends Control {
  4901. name?: string | undefined;
  4902. /** Gets or sets border thickness */
  4903. thickness: number;
  4904. /** Gets or sets group name */
  4905. group: string;
  4906. /** BABYLON.Observable raised when isChecked is changed */
  4907. onIsCheckedChangedObservable: BABYLON.Observable<boolean>;
  4908. /** Gets or sets a value indicating the ratio between overall size and check size */
  4909. checkSizeRatio: number;
  4910. /** Gets or sets background color */
  4911. background: string;
  4912. /** Gets or sets a boolean indicating if the checkbox is checked or not */
  4913. isChecked: boolean;
  4914. /**
  4915. * Creates a new RadioButton
  4916. * @param name defines the control name
  4917. */
  4918. constructor(name?: string | undefined);
  4919. protected _getTypeName(): string;
  4920. _draw(context: CanvasRenderingContext2D): void;
  4921. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  4922. /**
  4923. * Utility function to easily create a radio button with a header
  4924. * @param title defines the label to use for the header
  4925. * @param group defines the group to use for the radio button
  4926. * @param isChecked defines the initial state of the radio button
  4927. * @param onValueChanged defines the callback to call when value changes
  4928. * @returns a StackPanel containing the radio button and a textBlock
  4929. */
  4930. static AddRadioButtonWithHeader(title: string, group: string, isChecked: boolean, onValueChanged: (button: RadioButton, value: boolean) => void): StackPanel;
  4931. }
  4932. }
  4933. declare module BABYLON.GUI {
  4934. /**
  4935. * Class used to create a 2D stack panel container
  4936. */
  4937. export class StackPanel extends Container {
  4938. name?: string | undefined;
  4939. /** Gets or sets a boolean indicating if the stack panel is vertical or horizontal*/
  4940. isVertical: boolean;
  4941. /**
  4942. * Gets or sets panel width.
  4943. * This value should not be set when in horizontal mode as it will be computed automatically
  4944. */
  4945. width: string | number;
  4946. /**
  4947. * Gets or sets panel height.
  4948. * This value should not be set when in vertical mode as it will be computed automatically
  4949. */
  4950. height: string | number;
  4951. /**
  4952. * Creates a new StackPanel
  4953. * @param name defines control name
  4954. */
  4955. constructor(name?: string | undefined);
  4956. protected _getTypeName(): string;
  4957. /** @hidden */
  4958. protected _preMeasure(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4959. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  4960. protected _postMeasure(): void;
  4961. }
  4962. }
  4963. declare module BABYLON.GUI {
  4964. /** Class used to create a RadioGroup
  4965. * which contains groups of radio buttons
  4966. */
  4967. export class SelectorGroup {
  4968. /** name of SelectorGroup */
  4969. name: string;
  4970. /**
  4971. * Creates a new SelectorGroup
  4972. * @param name of group, used as a group heading
  4973. */
  4974. constructor(
  4975. /** name of SelectorGroup */
  4976. name: string);
  4977. /** Gets the groupPanel of the SelectorGroup */
  4978. readonly groupPanel: StackPanel;
  4979. /** Gets the selectors array */
  4980. readonly selectors: StackPanel[];
  4981. /** Gets and sets the group header */
  4982. header: string;
  4983. /** @hidden*/
  4984. _getSelector(selectorNb: number): StackPanel | undefined;
  4985. /** Removes the selector at the given position
  4986. * @param selectorNb the position of the selector within the group
  4987. */
  4988. removeSelector(selectorNb: number): void;
  4989. }
  4990. /** Class used to create a CheckboxGroup
  4991. * which contains groups of checkbox buttons
  4992. */
  4993. export class CheckboxGroup extends SelectorGroup {
  4994. /** Adds a checkbox as a control
  4995. * @param text is the label for the selector
  4996. * @param func is the function called when the Selector is checked
  4997. * @param checked is true when Selector is checked
  4998. */
  4999. addCheckbox(text: string, func?: (s: boolean) => void, checked?: boolean): void;
  5000. /** @hidden */
  5001. _setSelectorLabel(selectorNb: number, label: string): void;
  5002. /** @hidden */
  5003. _setSelectorLabelColor(selectorNb: number, color: string): void;
  5004. /** @hidden */
  5005. _setSelectorButtonColor(selectorNb: number, color: string): void;
  5006. /** @hidden */
  5007. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  5008. }
  5009. /** Class used to create a RadioGroup
  5010. * which contains groups of radio buttons
  5011. */
  5012. export class RadioGroup extends SelectorGroup {
  5013. /** Adds a radio button as a control
  5014. * @param label is the label for the selector
  5015. * @param func is the function called when the Selector is checked
  5016. * @param checked is true when Selector is checked
  5017. */
  5018. addRadio(label: string, func?: (n: number) => void, checked?: boolean): void;
  5019. /** @hidden */
  5020. _setSelectorLabel(selectorNb: number, label: string): void;
  5021. /** @hidden */
  5022. _setSelectorLabelColor(selectorNb: number, color: string): void;
  5023. /** @hidden */
  5024. _setSelectorButtonColor(selectorNb: number, color: string): void;
  5025. /** @hidden */
  5026. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  5027. }
  5028. /** Class used to create a SliderGroup
  5029. * which contains groups of slider buttons
  5030. */
  5031. export class SliderGroup extends SelectorGroup {
  5032. /**
  5033. * Adds a slider to the SelectorGroup
  5034. * @param label is the label for the SliderBar
  5035. * @param func is the function called when the Slider moves
  5036. * @param unit is a string describing the units used, eg degrees or metres
  5037. * @param min is the minimum value for the Slider
  5038. * @param max is the maximum value for the Slider
  5039. * @param value is the start value for the Slider between min and max
  5040. * @param onValueChange is the function used to format the value displayed, eg radians to degrees
  5041. */
  5042. addSlider(label: string, func?: (v: number) => void, unit?: string, min?: number, max?: number, value?: number, onValueChange?: (v: number) => number): void;
  5043. /** @hidden */
  5044. _setSelectorLabel(selectorNb: number, label: string): void;
  5045. /** @hidden */
  5046. _setSelectorLabelColor(selectorNb: number, color: string): void;
  5047. /** @hidden */
  5048. _setSelectorButtonColor(selectorNb: number, color: string): void;
  5049. /** @hidden */
  5050. _setSelectorButtonBackground(selectorNb: number, color: string): void;
  5051. }
  5052. /** Class used to hold the controls for the checkboxes, radio buttons and sliders
  5053. * @see http://doc.babylonjs.com/how_to/selector
  5054. */
  5055. export class SelectionPanel extends Rectangle {
  5056. /** name of SelectionPanel */
  5057. name: string;
  5058. /** an array of SelectionGroups */
  5059. groups: SelectorGroup[];
  5060. /**
  5061. * Creates a new SelectionPanel
  5062. * @param name of SelectionPanel
  5063. * @param groups is an array of SelectionGroups
  5064. */
  5065. constructor(
  5066. /** name of SelectionPanel */
  5067. name: string,
  5068. /** an array of SelectionGroups */
  5069. groups?: SelectorGroup[]);
  5070. protected _getTypeName(): string;
  5071. /** Gets or sets the headerColor */
  5072. headerColor: string;
  5073. /** Gets or sets the button color */
  5074. buttonColor: string;
  5075. /** Gets or sets the label color */
  5076. labelColor: string;
  5077. /** Gets or sets the button background */
  5078. buttonBackground: string;
  5079. /** Gets or sets the color of separator bar */
  5080. barColor: string;
  5081. /** Gets or sets the height of separator bar */
  5082. barHeight: string;
  5083. /** Gets or sets the height of spacers*/
  5084. spacerHeight: string;
  5085. /** Add a group to the selection panel
  5086. * @param group is the selector group to add
  5087. */
  5088. addGroup(group: SelectorGroup): void;
  5089. /** Remove the group from the given position
  5090. * @param groupNb is the position of the group in the list
  5091. */
  5092. removeGroup(groupNb: number): void;
  5093. /** Change a group header label
  5094. * @param label is the new group header label
  5095. * @param groupNb is the number of the group to relabel
  5096. * */
  5097. setHeaderName(label: string, groupNb: number): void;
  5098. /** Change selector label to the one given
  5099. * @param label is the new selector label
  5100. * @param groupNb is the number of the groupcontaining the selector
  5101. * @param selectorNb is the number of the selector within a group to relabel
  5102. * */
  5103. relabel(label: string, groupNb: number, selectorNb: number): void;
  5104. /** For a given group position remove the selector at the given position
  5105. * @param groupNb is the number of the group to remove the selector from
  5106. * @param selectorNb is the number of the selector within the group
  5107. */
  5108. removeFromGroupSelector(groupNb: number, selectorNb: number): void;
  5109. /** For a given group position of correct type add a checkbox button
  5110. * @param groupNb is the number of the group to remove the selector from
  5111. * @param label is the label for the selector
  5112. * @param func is the function called when the Selector is checked
  5113. * @param checked is true when Selector is checked
  5114. */
  5115. addToGroupCheckbox(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  5116. /** For a given group position of correct type add a radio button
  5117. * @param groupNb is the number of the group to remove the selector from
  5118. * @param label is the label for the selector
  5119. * @param func is the function called when the Selector is checked
  5120. * @param checked is true when Selector is checked
  5121. */
  5122. addToGroupRadio(groupNb: number, label: string, func?: () => void, checked?: boolean): void;
  5123. /**
  5124. * For a given slider group add a slider
  5125. * @param groupNb is the number of the group to add the slider to
  5126. * @param label is the label for the Slider
  5127. * @param func is the function called when the Slider moves
  5128. * @param unit is a string describing the units used, eg degrees or metres
  5129. * @param min is the minimum value for the Slider
  5130. * @param max is the maximum value for the Slider
  5131. * @param value is the start value for the Slider between min and max
  5132. * @param onVal is the function used to format the value displayed, eg radians to degrees
  5133. */
  5134. addToGroupSlider(groupNb: number, label: string, func?: () => void, unit?: string, min?: number, max?: number, value?: number, onVal?: (v: number) => number): void;
  5135. }
  5136. }
  5137. declare module BABYLON.GUI {
  5138. /**
  5139. * Class used to hold a viewer window and sliders in a grid
  5140. */
  5141. export class ScrollViewer extends Rectangle {
  5142. /**
  5143. * Adds a new control to the current container
  5144. * @param control defines the control to add
  5145. * @returns the current container
  5146. */
  5147. addControl(control: BABYLON.Nullable<Control>): Container;
  5148. /**
  5149. * Removes a control from the current container
  5150. * @param control defines the control to remove
  5151. * @returns the current container
  5152. */
  5153. removeControl(control: Control): Container;
  5154. /** Gets the list of children */
  5155. readonly children: Control[];
  5156. _flagDescendantsAsMatrixDirty(): void;
  5157. /**
  5158. * Creates a new ScrollViewer
  5159. * @param name of ScrollViewer
  5160. */
  5161. constructor(name?: string);
  5162. /** Reset the scroll viewer window to initial size */
  5163. resetWindow(): void;
  5164. protected _getTypeName(): string;
  5165. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5166. protected _postMeasure(): void;
  5167. /**
  5168. * Gets or sets the mouse wheel precision
  5169. * from 0 to 1 with a default value of 0.05
  5170. * */
  5171. wheelPrecision: number;
  5172. /** Gets or sets the bar color */
  5173. barColor: string;
  5174. /** Gets or sets the size of the bar */
  5175. barSize: number;
  5176. /** Gets or sets the bar background */
  5177. barBackground: string;
  5178. _link(host: AdvancedDynamicTexture): void;
  5179. _renderHighlightSpecific(context: CanvasRenderingContext2D): void;
  5180. /** Releases associated resources */
  5181. dispose(): void;
  5182. }
  5183. }
  5184. declare module BABYLON.GUI {
  5185. /**
  5186. * Enum that determines the text-wrapping mode to use.
  5187. */
  5188. export enum TextWrapping {
  5189. /**
  5190. * Clip the text when it's larger than Control.width; this is the default mode.
  5191. */
  5192. Clip = 0,
  5193. /**
  5194. * Wrap the text word-wise, i.e. try to add line-breaks at word boundary to fit within Control.width.
  5195. */
  5196. WordWrap = 1,
  5197. /**
  5198. * Ellipsize the text, i.e. shrink with trailing … when text is larger than Control.width.
  5199. */
  5200. Ellipsis = 2
  5201. }
  5202. /**
  5203. * Class used to create text block control
  5204. */
  5205. export class TextBlock extends Control {
  5206. /**
  5207. * Defines the name of the control
  5208. */
  5209. name?: string | undefined;
  5210. /**
  5211. * An event triggered after the text is changed
  5212. */
  5213. onTextChangedObservable: BABYLON.Observable<TextBlock>;
  5214. /**
  5215. * An event triggered after the text was broken up into lines
  5216. */
  5217. onLinesReadyObservable: BABYLON.Observable<TextBlock>;
  5218. /**
  5219. * Return the line list (you may need to use the onLinesReadyObservable to make sure the list is ready)
  5220. */
  5221. readonly lines: any[];
  5222. /**
  5223. * Gets or sets an boolean indicating that the TextBlock will be resized to fit container
  5224. */
  5225. resizeToFit: boolean;
  5226. /**
  5227. * Gets or sets a boolean indicating if text must be wrapped
  5228. */
  5229. textWrapping: TextWrapping | boolean;
  5230. /**
  5231. * Gets or sets text to display
  5232. */
  5233. text: string;
  5234. /**
  5235. * Gets or sets text horizontal alignment (BABYLON.GUI.Control.HORIZONTAL_ALIGNMENT_CENTER by default)
  5236. */
  5237. textHorizontalAlignment: number;
  5238. /**
  5239. * Gets or sets text vertical alignment (BABYLON.GUI.Control.VERTICAL_ALIGNMENT_CENTER by default)
  5240. */
  5241. textVerticalAlignment: number;
  5242. /**
  5243. * Gets or sets line spacing value
  5244. */
  5245. lineSpacing: string | number;
  5246. /**
  5247. * Gets or sets outlineWidth of the text to display
  5248. */
  5249. outlineWidth: number;
  5250. /**
  5251. * Gets or sets outlineColor of the text to display
  5252. */
  5253. outlineColor: string;
  5254. /**
  5255. * Creates a new TextBlock object
  5256. * @param name defines the name of the control
  5257. * @param text defines the text to display (emptry string by default)
  5258. */
  5259. constructor(
  5260. /**
  5261. * Defines the name of the control
  5262. */
  5263. name?: string | undefined, text?: string);
  5264. protected _getTypeName(): string;
  5265. protected _processMeasures(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5266. /** @hidden */
  5267. _draw(context: CanvasRenderingContext2D): void;
  5268. protected _applyStates(context: CanvasRenderingContext2D): void;
  5269. protected _breakLines(refWidth: number, context: CanvasRenderingContext2D): object[];
  5270. protected _parseLine(line: string | undefined, context: CanvasRenderingContext2D): object;
  5271. protected _parseLineEllipsis(line: string | undefined, width: number, context: CanvasRenderingContext2D): object;
  5272. protected _parseLineWordWrap(line: string | undefined, width: number, context: CanvasRenderingContext2D): object[];
  5273. protected _renderLines(context: CanvasRenderingContext2D): void;
  5274. /**
  5275. * Given a width constraint applied on the text block, find the expected height
  5276. * @returns expected height
  5277. */
  5278. computeExpectedHeight(): number;
  5279. dispose(): void;
  5280. }
  5281. }
  5282. declare module BABYLON.GUI {
  5283. /**
  5284. * Class used to store key control properties
  5285. */
  5286. export class KeyPropertySet {
  5287. /** Width */
  5288. width?: string;
  5289. /** Height */
  5290. height?: string;
  5291. /** Left padding */
  5292. paddingLeft?: string;
  5293. /** Right padding */
  5294. paddingRight?: string;
  5295. /** Top padding */
  5296. paddingTop?: string;
  5297. /** Bottom padding */
  5298. paddingBottom?: string;
  5299. /** Foreground color */
  5300. color?: string;
  5301. /** Background color */
  5302. background?: string;
  5303. }
  5304. /**
  5305. * Class used to create virtual keyboard
  5306. */
  5307. export class VirtualKeyboard extends StackPanel {
  5308. /** BABYLON.Observable raised when a key is pressed */
  5309. onKeyPressObservable: BABYLON.Observable<string>;
  5310. /** Gets or sets default key button width */
  5311. defaultButtonWidth: string;
  5312. /** Gets or sets default key button height */
  5313. defaultButtonHeight: string;
  5314. /** Gets or sets default key button left padding */
  5315. defaultButtonPaddingLeft: string;
  5316. /** Gets or sets default key button right padding */
  5317. defaultButtonPaddingRight: string;
  5318. /** Gets or sets default key button top padding */
  5319. defaultButtonPaddingTop: string;
  5320. /** Gets or sets default key button bottom padding */
  5321. defaultButtonPaddingBottom: string;
  5322. /** Gets or sets default key button foreground color */
  5323. defaultButtonColor: string;
  5324. /** Gets or sets default key button background color */
  5325. defaultButtonBackground: string;
  5326. /** Gets or sets shift button foreground color */
  5327. shiftButtonColor: string;
  5328. /** Gets or sets shift button thickness*/
  5329. selectedShiftThickness: number;
  5330. /** Gets shift key state */
  5331. shiftState: number;
  5332. protected _getTypeName(): string;
  5333. /**
  5334. * Adds a new row of keys
  5335. * @param keys defines the list of keys to add
  5336. * @param propertySets defines the associated property sets
  5337. */
  5338. addKeysRow(keys: Array<string>, propertySets?: Array<KeyPropertySet>): void;
  5339. /**
  5340. * Set the shift key to a specific state
  5341. * @param shiftState defines the new shift state
  5342. */
  5343. applyShiftState(shiftState: number): void;
  5344. /** Gets the input text control currently attached to the keyboard */
  5345. readonly connectedInputText: BABYLON.Nullable<InputText>;
  5346. /**
  5347. * Connects the keyboard with an input text control
  5348. *
  5349. * @param input defines the target control
  5350. */
  5351. connect(input: InputText): void;
  5352. /**
  5353. * Disconnects the keyboard from connected InputText controls
  5354. *
  5355. * @param input optionally defines a target control, otherwise all are disconnected
  5356. */
  5357. disconnect(input?: InputText): void;
  5358. /**
  5359. * Release all resources
  5360. */
  5361. dispose(): void;
  5362. /**
  5363. * Creates a new keyboard using a default layout
  5364. *
  5365. * @param name defines control name
  5366. * @returns a new VirtualKeyboard
  5367. */
  5368. static CreateDefaultLayout(name?: string): VirtualKeyboard;
  5369. }
  5370. }
  5371. declare module BABYLON.GUI {
  5372. /** Class used to create rectangle container */
  5373. export class Rectangle extends Container {
  5374. name?: string | undefined;
  5375. /** Gets or sets border thickness */
  5376. thickness: number;
  5377. /** Gets or sets the corner radius angle */
  5378. cornerRadius: number;
  5379. /**
  5380. * Creates a new Rectangle
  5381. * @param name defines the control name
  5382. */
  5383. constructor(name?: string | undefined);
  5384. protected _getTypeName(): string;
  5385. protected _localDraw(context: CanvasRenderingContext2D): void;
  5386. protected _additionalProcessing(parentMeasure: Measure, context: CanvasRenderingContext2D): void;
  5387. protected _clipForChildren(context: CanvasRenderingContext2D): void;
  5388. }
  5389. }
  5390. declare module BABYLON.GUI {
  5391. /** Class used to render a grid */
  5392. export class DisplayGrid extends Control {
  5393. name?: string | undefined;
  5394. /** Gets or sets a boolean indicating if minor lines must be rendered (true by default)) */
  5395. displayMinorLines: boolean;
  5396. /** Gets or sets a boolean indicating if major lines must be rendered (true by default)) */
  5397. displayMajorLines: boolean;
  5398. /** Gets or sets background color (Black by default) */
  5399. background: string;
  5400. /** Gets or sets the width of each cell (20 by default) */
  5401. cellWidth: number;
  5402. /** Gets or sets the height of each cell (20 by default) */
  5403. cellHeight: number;
  5404. /** Gets or sets the tickness of minor lines (1 by default) */
  5405. minorLineTickness: number;
  5406. /** Gets or sets the color of minor lines (DarkGray by default) */
  5407. minorLineColor: string;
  5408. /** Gets or sets the tickness of major lines (2 by default) */
  5409. majorLineTickness: number;
  5410. /** Gets or sets the color of major lines (White by default) */
  5411. majorLineColor: string;
  5412. /** Gets or sets the frequency of major lines (default is 1 every 5 minor lines)*/
  5413. majorLineFrequency: number;
  5414. /**
  5415. * Creates a new GridDisplayRectangle
  5416. * @param name defines the control name
  5417. */
  5418. constructor(name?: string | undefined);
  5419. _draw(context: CanvasRenderingContext2D): void;
  5420. protected _getTypeName(): string;
  5421. }
  5422. }
  5423. declare module BABYLON.GUI {
  5424. /**
  5425. * Class used to create slider controls
  5426. */
  5427. export class BaseSlider extends Control {
  5428. name?: string | undefined;
  5429. protected _thumbWidth: ValueAndUnit;
  5430. protected _barOffset: ValueAndUnit;
  5431. protected _displayThumb: boolean;
  5432. protected _effectiveBarOffset: number;
  5433. protected _renderLeft: number;
  5434. protected _renderTop: number;
  5435. protected _renderWidth: number;
  5436. protected _renderHeight: number;
  5437. protected _backgroundBoxLength: number;
  5438. protected _backgroundBoxThickness: number;
  5439. protected _effectiveThumbThickness: number;
  5440. /** BABYLON.Observable raised when the sldier value changes */
  5441. onValueChangedObservable: BABYLON.Observable<number>;
  5442. /** Gets or sets a boolean indicating if the thumb must be rendered */
  5443. displayThumb: boolean;
  5444. /** Gets or sets main bar offset (ie. the margin applied to the value bar) */
  5445. barOffset: string | number;
  5446. /** Gets main bar offset in pixels*/
  5447. readonly barOffsetInPixels: number;
  5448. /** Gets or sets thumb width */
  5449. thumbWidth: string | number;
  5450. /** Gets thumb width in pixels */
  5451. readonly thumbWidthInPixels: number;
  5452. /** Gets or sets minimum value */
  5453. minimum: number;
  5454. /** Gets or sets maximum value */
  5455. maximum: number;
  5456. /** Gets or sets current value */
  5457. value: number;
  5458. /**Gets or sets a boolean indicating if the slider should be vertical or horizontal */
  5459. isVertical: boolean;
  5460. /** Gets or sets a value indicating if the thumb can go over main bar extends */
  5461. isThumbClamped: boolean;
  5462. /**
  5463. * Creates a new BaseSlider
  5464. * @param name defines the control name
  5465. */
  5466. constructor(name?: string | undefined);
  5467. protected _getTypeName(): string;
  5468. protected _getThumbPosition(): number;
  5469. protected _getThumbThickness(type: string): number;
  5470. protected _prepareRenderingData(type: string): void;
  5471. /** @hidden */
  5472. protected _updateValueFromPointer(x: number, y: number): void;
  5473. _onPointerDown(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number): boolean;
  5474. _onPointerMove(target: Control, coordinates: BABYLON.Vector2): void;
  5475. _onPointerUp(target: Control, coordinates: BABYLON.Vector2, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5476. }
  5477. }
  5478. declare module BABYLON.GUI {
  5479. /**
  5480. * Class used to create slider controls
  5481. */
  5482. export class Slider extends BaseSlider {
  5483. name?: string | undefined;
  5484. protected _displayValueBar: boolean;
  5485. /** Gets or sets a boolean indicating if the value bar must be rendered */
  5486. displayValueBar: boolean;
  5487. /** Gets or sets border color */
  5488. borderColor: string;
  5489. /** Gets or sets background color */
  5490. background: string;
  5491. /** Gets or sets a boolean indicating if the thumb should be round or square */
  5492. isThumbCircle: boolean;
  5493. /**
  5494. * Creates a new Slider
  5495. * @param name defines the control name
  5496. */
  5497. constructor(name?: string | undefined);
  5498. protected _getTypeName(): string;
  5499. _draw(context: CanvasRenderingContext2D): void;
  5500. }
  5501. }
  5502. declare module BABYLON.GUI {
  5503. /**
  5504. * Class used to create slider controls based on images
  5505. */
  5506. export class ImageBasedSlider extends BaseSlider {
  5507. name?: string | undefined;
  5508. displayThumb: boolean;
  5509. /**
  5510. * Gets or sets the image used to render the background
  5511. */
  5512. backgroundImage: Image;
  5513. /**
  5514. * Gets or sets the image used to render the value bar
  5515. */
  5516. valueBarImage: Image;
  5517. /**
  5518. * Gets or sets the image used to render the thumb
  5519. */
  5520. thumbImage: Image;
  5521. /**
  5522. * Creates a new ImageBasedSlider
  5523. * @param name defines the control name
  5524. */
  5525. constructor(name?: string | undefined);
  5526. protected _getTypeName(): string;
  5527. _draw(context: CanvasRenderingContext2D): void;
  5528. }
  5529. }
  5530. declare module BABYLON.GUI {
  5531. /**
  5532. * Forcing an export so that this code will execute
  5533. * @hidden
  5534. */
  5535. const name = "Statics";
  5536. }
  5537. declare module BABYLON.GUI {
  5538. /**
  5539. * Class used as a root to all buttons
  5540. */
  5541. export class AbstractButton3D extends Control3D {
  5542. /**
  5543. * Creates a new button
  5544. * @param name defines the control name
  5545. */
  5546. constructor(name?: string);
  5547. protected _getTypeName(): string;
  5548. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5549. }
  5550. }
  5551. declare module BABYLON.GUI {
  5552. /**
  5553. * Class used to create a button in 3D
  5554. */
  5555. export class Button3D extends AbstractButton3D {
  5556. /** @hidden */
  5557. protected _currentMaterial: BABYLON.Material;
  5558. /**
  5559. * Gets or sets the texture resolution used to render content (512 by default)
  5560. */
  5561. contentResolution: BABYLON.int;
  5562. /**
  5563. * Gets or sets the texture scale ratio used to render content (2 by default)
  5564. */
  5565. contentScaleRatio: number;
  5566. protected _disposeFacadeTexture(): void;
  5567. protected _resetContent(): void;
  5568. /**
  5569. * Creates a new button
  5570. * @param name defines the control name
  5571. */
  5572. constructor(name?: string);
  5573. /**
  5574. * Gets or sets the GUI 2D content used to display the button's facade
  5575. */
  5576. content: Control;
  5577. /**
  5578. * Apply the facade texture (created from the content property).
  5579. * This function can be overloaded by child classes
  5580. * @param facadeTexture defines the AdvancedDynamicTexture to use
  5581. */
  5582. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5583. protected _getTypeName(): string;
  5584. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5585. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5586. /**
  5587. * Releases all associated resources
  5588. */
  5589. dispose(): void;
  5590. }
  5591. }
  5592. declare module BABYLON.GUI {
  5593. /**
  5594. * Class used to create containers for controls
  5595. */
  5596. export class Container3D extends Control3D {
  5597. /**
  5598. * Gets the list of child controls
  5599. */
  5600. protected _children: Control3D[];
  5601. /**
  5602. * Gets the list of child controls
  5603. */
  5604. readonly children: Array<Control3D>;
  5605. /**
  5606. * Gets or sets a boolean indicating if the layout must be blocked (default is false).
  5607. * This is helpful to optimize layout operation when adding multiple children in a row
  5608. */
  5609. blockLayout: boolean;
  5610. /**
  5611. * Creates a new container
  5612. * @param name defines the container name
  5613. */
  5614. constructor(name?: string);
  5615. /**
  5616. * Force the container to update the layout. Please note that it will not take blockLayout property in account
  5617. * @returns the current container
  5618. */
  5619. updateLayout(): Container3D;
  5620. /**
  5621. * Gets a boolean indicating if the given control is in the children of this control
  5622. * @param control defines the control to check
  5623. * @returns true if the control is in the child list
  5624. */
  5625. containsControl(control: Control3D): boolean;
  5626. /**
  5627. * Adds a control to the children of this control
  5628. * @param control defines the control to add
  5629. * @returns the current container
  5630. */
  5631. addControl(control: Control3D): Container3D;
  5632. /**
  5633. * This function will be called everytime a new control is added
  5634. */
  5635. protected _arrangeChildren(): void;
  5636. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5637. /**
  5638. * Removes a control from the children of this control
  5639. * @param control defines the control to remove
  5640. * @returns the current container
  5641. */
  5642. removeControl(control: Control3D): Container3D;
  5643. protected _getTypeName(): string;
  5644. /**
  5645. * Releases all associated resources
  5646. */
  5647. dispose(): void;
  5648. /** Control rotation will remain unchanged */
  5649. static readonly UNSET_ORIENTATION: number;
  5650. /** Control will rotate to make it look at sphere central axis */
  5651. static readonly FACEORIGIN_ORIENTATION: number;
  5652. /** Control will rotate to make it look back at sphere central axis */
  5653. static readonly FACEORIGINREVERSED_ORIENTATION: number;
  5654. /** Control will rotate to look at z axis (0, 0, 1) */
  5655. static readonly FACEFORWARD_ORIENTATION: number;
  5656. /** Control will rotate to look at negative z axis (0, 0, -1) */
  5657. static readonly FACEFORWARDREVERSED_ORIENTATION: number;
  5658. }
  5659. }
  5660. declare module BABYLON.GUI {
  5661. /**
  5662. * Class used as base class for controls
  5663. */
  5664. export class Control3D implements BABYLON.IDisposable, BABYLON.IBehaviorAware<Control3D> {
  5665. /** Defines the control name */
  5666. name?: string | undefined;
  5667. /** @hidden */
  5668. _host: GUI3DManager;
  5669. /** Gets or sets the control position in world space */
  5670. position: BABYLON.Vector3;
  5671. /** Gets or sets the control scaling in world space */
  5672. scaling: BABYLON.Vector3;
  5673. /** Callback used to start pointer enter animation */
  5674. pointerEnterAnimation: () => void;
  5675. /** Callback used to start pointer out animation */
  5676. pointerOutAnimation: () => void;
  5677. /** Callback used to start pointer down animation */
  5678. pointerDownAnimation: () => void;
  5679. /** Callback used to start pointer up animation */
  5680. pointerUpAnimation: () => void;
  5681. /**
  5682. * An event triggered when the pointer move over the control
  5683. */
  5684. onPointerMoveObservable: BABYLON.Observable<BABYLON.Vector3>;
  5685. /**
  5686. * An event triggered when the pointer move out of the control
  5687. */
  5688. onPointerOutObservable: BABYLON.Observable<Control3D>;
  5689. /**
  5690. * An event triggered when the pointer taps the control
  5691. */
  5692. onPointerDownObservable: BABYLON.Observable<Vector3WithInfo>;
  5693. /**
  5694. * An event triggered when pointer is up
  5695. */
  5696. onPointerUpObservable: BABYLON.Observable<Vector3WithInfo>;
  5697. /**
  5698. * An event triggered when a control is clicked on (with a mouse)
  5699. */
  5700. onPointerClickObservable: BABYLON.Observable<Vector3WithInfo>;
  5701. /**
  5702. * An event triggered when pointer enters the control
  5703. */
  5704. onPointerEnterObservable: BABYLON.Observable<Control3D>;
  5705. /**
  5706. * Gets or sets the parent container
  5707. */
  5708. parent: BABYLON.Nullable<Container3D>;
  5709. /**
  5710. * Gets the list of attached behaviors
  5711. * @see http://doc.babylonjs.com/features/behaviour
  5712. */
  5713. readonly behaviors: BABYLON.Behavior<Control3D>[];
  5714. /**
  5715. * Attach a behavior to the control
  5716. * @see http://doc.babylonjs.com/features/behaviour
  5717. * @param behavior defines the behavior to attach
  5718. * @returns the current control
  5719. */
  5720. addBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5721. /**
  5722. * Remove an attached behavior
  5723. * @see http://doc.babylonjs.com/features/behaviour
  5724. * @param behavior defines the behavior to attach
  5725. * @returns the current control
  5726. */
  5727. removeBehavior(behavior: BABYLON.Behavior<Control3D>): Control3D;
  5728. /**
  5729. * Gets an attached behavior by name
  5730. * @param name defines the name of the behavior to look for
  5731. * @see http://doc.babylonjs.com/features/behaviour
  5732. * @returns null if behavior was not found else the requested behavior
  5733. */
  5734. getBehaviorByName(name: string): BABYLON.Nullable<BABYLON.Behavior<Control3D>>;
  5735. /** Gets or sets a boolean indicating if the control is visible */
  5736. isVisible: boolean;
  5737. /**
  5738. * Creates a new control
  5739. * @param name defines the control name
  5740. */
  5741. constructor(
  5742. /** Defines the control name */
  5743. name?: string | undefined);
  5744. /**
  5745. * Gets a string representing the class name
  5746. */
  5747. readonly typeName: string;
  5748. /**
  5749. * Get the current class name of the control.
  5750. * @returns current class name
  5751. */
  5752. getClassName(): string;
  5753. protected _getTypeName(): string;
  5754. /**
  5755. * Gets the transform node used by this control
  5756. */
  5757. readonly node: BABYLON.Nullable<BABYLON.TransformNode>;
  5758. /**
  5759. * Gets the mesh used to render this control
  5760. */
  5761. readonly mesh: BABYLON.Nullable<BABYLON.AbstractMesh>;
  5762. /**
  5763. * Link the control as child of the given node
  5764. * @param node defines the node to link to. Use null to unlink the control
  5765. * @returns the current control
  5766. */
  5767. linkToTransformNode(node: BABYLON.Nullable<BABYLON.TransformNode>): Control3D;
  5768. /** @hidden **/
  5769. _prepareNode(scene: BABYLON.Scene): void;
  5770. /**
  5771. * Node creation.
  5772. * Can be overriden by children
  5773. * @param scene defines the scene where the node must be attached
  5774. * @returns the attached node or null if none. Must return a BABYLON.Mesh or BABYLON.AbstractMesh if there is an atttached visible object
  5775. */
  5776. protected _createNode(scene: BABYLON.Scene): BABYLON.Nullable<BABYLON.TransformNode>;
  5777. /**
  5778. * Affect a material to the given mesh
  5779. * @param mesh defines the mesh which will represent the control
  5780. */
  5781. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5782. /** @hidden */
  5783. _onPointerMove(target: Control3D, coordinates: BABYLON.Vector3): void;
  5784. /** @hidden */
  5785. _onPointerEnter(target: Control3D): boolean;
  5786. /** @hidden */
  5787. _onPointerOut(target: Control3D): void;
  5788. /** @hidden */
  5789. _onPointerDown(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5790. /** @hidden */
  5791. _onPointerUp(target: Control3D, coordinates: BABYLON.Vector3, pointerId: number, buttonIndex: number, notifyClick: boolean): void;
  5792. /** @hidden */
  5793. forcePointerUp(pointerId?: BABYLON.Nullable<number>): void;
  5794. /** @hidden */
  5795. _processObservables(type: number, pickedPoint: BABYLON.Vector3, pointerId: number, buttonIndex: number): boolean;
  5796. /** @hidden */
  5797. _disposeNode(): void;
  5798. /**
  5799. * Releases all associated resources
  5800. */
  5801. dispose(): void;
  5802. }
  5803. }
  5804. declare module BABYLON.GUI {
  5805. /**
  5806. * Class used to create a container panel deployed on the surface of a cylinder
  5807. */
  5808. export class CylinderPanel extends VolumeBasedPanel {
  5809. /**
  5810. * Gets or sets the radius of the cylinder where to project controls (5 by default)
  5811. */
  5812. radius: BABYLON.float;
  5813. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5814. }
  5815. }
  5816. declare module BABYLON.GUI {
  5817. /**
  5818. * Class used to create a holographic button in 3D
  5819. */
  5820. export class HolographicButton extends Button3D {
  5821. /**
  5822. * Text to be displayed on the tooltip shown when hovering on the button. When set to null tooltip is disabled. (Default: null)
  5823. */
  5824. tooltipText: BABYLON.Nullable<string>;
  5825. /**
  5826. * Gets or sets text for the button
  5827. */
  5828. text: string;
  5829. /**
  5830. * Gets or sets the image url for the button
  5831. */
  5832. imageUrl: string;
  5833. /**
  5834. * Gets the back material used by this button
  5835. */
  5836. readonly backMaterial: FluentMaterial;
  5837. /**
  5838. * Gets the front material used by this button
  5839. */
  5840. readonly frontMaterial: FluentMaterial;
  5841. /**
  5842. * Gets the plate material used by this button
  5843. */
  5844. readonly plateMaterial: BABYLON.StandardMaterial;
  5845. /**
  5846. * Gets a boolean indicating if this button shares its material with other HolographicButtons
  5847. */
  5848. readonly shareMaterials: boolean;
  5849. /**
  5850. * Creates a new button
  5851. * @param name defines the control name
  5852. */
  5853. constructor(name?: string, shareMaterials?: boolean);
  5854. protected _getTypeName(): string;
  5855. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5856. protected _applyFacade(facadeTexture: AdvancedDynamicTexture): void;
  5857. protected _affectMaterial(mesh: BABYLON.Mesh): void;
  5858. /**
  5859. * Releases all associated resources
  5860. */
  5861. dispose(): void;
  5862. }
  5863. }
  5864. declare module BABYLON.GUI {
  5865. /**
  5866. * Class used to create an interactable object. It's a 3D button using a mesh coming from the current scene
  5867. */
  5868. export class MeshButton3D extends Button3D {
  5869. /** @hidden */
  5870. protected _currentMesh: BABYLON.Mesh;
  5871. /**
  5872. * Creates a new 3D button based on a mesh
  5873. * @param mesh mesh to become a 3D button
  5874. * @param name defines the control name
  5875. */
  5876. constructor(mesh: BABYLON.Mesh, name?: string);
  5877. protected _getTypeName(): string;
  5878. protected _createNode(scene: BABYLON.Scene): BABYLON.TransformNode;
  5879. protected _affectMaterial(mesh: BABYLON.AbstractMesh): void;
  5880. }
  5881. }
  5882. declare module BABYLON.GUI {
  5883. /**
  5884. * Class used to create a container panel deployed on the surface of a plane
  5885. */
  5886. export class PlanePanel extends VolumeBasedPanel {
  5887. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5888. }
  5889. }
  5890. declare module BABYLON.GUI {
  5891. /**
  5892. * Class used to create a container panel where items get randomized planar mapping
  5893. */
  5894. export class ScatterPanel extends VolumeBasedPanel {
  5895. /**
  5896. * Gets or sets the number of iteration to use to scatter the controls (100 by default)
  5897. */
  5898. iteration: BABYLON.float;
  5899. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5900. protected _finalProcessing(): void;
  5901. }
  5902. }
  5903. declare module BABYLON.GUI {
  5904. /**
  5905. * Class used to create a container panel deployed on the surface of a sphere
  5906. */
  5907. export class SpherePanel extends VolumeBasedPanel {
  5908. /**
  5909. * Gets or sets the radius of the sphere where to project controls (5 by default)
  5910. */
  5911. radius: BABYLON.float;
  5912. protected _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5913. }
  5914. }
  5915. declare module BABYLON.GUI {
  5916. /**
  5917. * Class used to create a stack panel in 3D on XY plane
  5918. */
  5919. export class StackPanel3D extends Container3D {
  5920. /**
  5921. * Gets or sets a boolean indicating if the stack panel is vertical or horizontal (horizontal by default)
  5922. */
  5923. isVertical: boolean;
  5924. /**
  5925. * Gets or sets the distance between elements
  5926. */
  5927. margin: number;
  5928. /**
  5929. * Creates new StackPanel
  5930. * @param isVertical
  5931. */
  5932. constructor(isVertical?: boolean);
  5933. protected _arrangeChildren(): void;
  5934. }
  5935. }
  5936. declare module BABYLON.GUI {
  5937. /**
  5938. * Abstract class used to create a container panel deployed on the surface of a volume
  5939. */
  5940. export abstract class VolumeBasedPanel extends Container3D {
  5941. protected _cellWidth: number;
  5942. protected _cellHeight: number;
  5943. /**
  5944. * Gets or sets the distance between elements
  5945. */
  5946. margin: number;
  5947. /**
  5948. * Gets or sets the orientation to apply to all controls (BABYLON.Container3D.FaceOriginReversedOrientation by default)
  5949. * | Value | Type | Description |
  5950. * | ----- | ----------------------------------- | ----------- |
  5951. * | 0 | UNSET_ORIENTATION | Control rotation will remain unchanged |
  5952. * | 1 | FACEORIGIN_ORIENTATION | Control will rotate to make it look at sphere central axis |
  5953. * | 2 | FACEORIGINREVERSED_ORIENTATION | Control will rotate to make it look back at sphere central axis |
  5954. * | 3 | FACEFORWARD_ORIENTATION | Control will rotate to look at z axis (0, 0, 1) |
  5955. * | 4 | FACEFORWARDREVERSED_ORIENTATION | Control will rotate to look at negative z axis (0, 0, -1) |
  5956. */
  5957. orientation: number;
  5958. /**
  5959. * Gets or sets the number of columns requested (10 by default).
  5960. * The panel will automatically compute the number of rows based on number of child controls.
  5961. */
  5962. columns: BABYLON.int;
  5963. /**
  5964. * Gets or sets a the number of rows requested.
  5965. * The panel will automatically compute the number of columns based on number of child controls.
  5966. */
  5967. rows: BABYLON.int;
  5968. /**
  5969. * Creates new VolumeBasedPanel
  5970. */
  5971. constructor();
  5972. protected _arrangeChildren(): void;
  5973. /** Child classes must implement this function to provide correct control positioning */
  5974. protected abstract _mapGridNode(control: Control3D, nodePosition: BABYLON.Vector3): void;
  5975. /** Child classes can implement this function to provide additional processing */
  5976. protected _finalProcessing(): void;
  5977. }
  5978. }
  5979. declare module BABYLON.GUI {
  5980. /** @hidden */
  5981. export class FluentMaterialDefines extends BABYLON.MaterialDefines {
  5982. INNERGLOW: boolean;
  5983. BORDER: boolean;
  5984. HOVERLIGHT: boolean;
  5985. TEXTURE: boolean;
  5986. constructor();
  5987. }
  5988. /**
  5989. * Class used to render controls with fluent desgin
  5990. */
  5991. export class FluentMaterial extends BABYLON.PushMaterial {
  5992. /**
  5993. * Gets or sets inner glow intensity. A value of 0 means no glow (default is 0.5)
  5994. */
  5995. innerGlowColorIntensity: number;
  5996. /**
  5997. * Gets or sets the inner glow color (white by default)
  5998. */
  5999. innerGlowColor: BABYLON.Color3;
  6000. /**
  6001. * Gets or sets alpha value (default is 1.0)
  6002. */
  6003. alpha: number;
  6004. /**
  6005. * Gets or sets the albedo color (Default is BABYLON.Color3(0.3, 0.35, 0.4))
  6006. */
  6007. albedoColor: BABYLON.Color3;
  6008. /**
  6009. * Gets or sets a boolean indicating if borders must be rendered (default is false)
  6010. */
  6011. renderBorders: boolean;
  6012. /**
  6013. * Gets or sets border width (default is 0.5)
  6014. */
  6015. borderWidth: number;
  6016. /**
  6017. * Gets or sets a value indicating the smoothing value applied to border edges (0.02 by default)
  6018. */
  6019. edgeSmoothingValue: number;
  6020. /**
  6021. * Gets or sets the minimum value that can be applied to border width (default is 0.1)
  6022. */
  6023. borderMinValue: number;
  6024. /**
  6025. * Gets or sets a boolean indicating if hover light must be rendered (default is false)
  6026. */
  6027. renderHoverLight: boolean;
  6028. /**
  6029. * Gets or sets the radius used to render the hover light (default is 1.0)
  6030. */
  6031. hoverRadius: number;
  6032. /**
  6033. * Gets or sets the color used to render the hover light (default is BABYLON.Color4(0.3, 0.3, 0.3, 1.0))
  6034. */
  6035. hoverColor: BABYLON.Color4;
  6036. /**
  6037. * Gets or sets the hover light position in world space (default is BABYLON.Vector3.Zero())
  6038. */
  6039. hoverPosition: BABYLON.Vector3;
  6040. /** Gets or sets the texture to use for albedo color */
  6041. albedoTexture: BABYLON.Nullable<BABYLON.BaseTexture>;
  6042. /**
  6043. * Creates a new Fluent material
  6044. * @param name defines the name of the material
  6045. * @param scene defines the hosting scene
  6046. */
  6047. constructor(name: string, scene: BABYLON.Scene);
  6048. needAlphaBlending(): boolean;
  6049. needAlphaTesting(): boolean;
  6050. getAlphaTestTexture(): BABYLON.Nullable<BABYLON.BaseTexture>;
  6051. isReadyForSubMesh(mesh: BABYLON.AbstractMesh, subMesh: BABYLON.SubMesh, useInstances?: boolean): boolean;
  6052. bindForSubMesh(world: BABYLON.Matrix, mesh: BABYLON.Mesh, subMesh: BABYLON.SubMesh): void;
  6053. getActiveTextures(): BABYLON.BaseTexture[];
  6054. hasTexture(texture: BABYLON.BaseTexture): boolean;
  6055. dispose(forceDisposeEffect?: boolean): void;
  6056. clone(name: string): FluentMaterial;
  6057. serialize(): any;
  6058. getClassName(): string;
  6059. static Parse(source: any, scene: BABYLON.Scene, rootUrl: string): FluentMaterial;
  6060. }
  6061. }