babylon.gui.module.d.ts 288 KB

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