babylon.gui.module.d.ts 294 KB

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