babylon.gui.module.d.ts 277 KB

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