babylon.gui.module.d.ts 278 KB

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