babylon.gui.module.d.ts 275 KB

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